subroutine ESMF_RouteHandleAppend(routehandle, appendRoutehandle, rraShift, &
vectorLengthShift, transferflag, rc)
!
! !ARGUMENTS:
type(ESMF_RouteHandle), intent(inout) :: routehandle
type(ESMF_RouteHandle), intent(inout) :: appendRoutehandle
integer, intent(in) :: rraShift
integer, intent(in) :: vectorLengthShift
logical, intent(in), optional :: transferflag
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Append the exchange pattern stored in {\tt appendRoutehandle} to the
! {\tt routehandle}. Optionally transfer ownership of the exchange pattern
! stored in the incoming {\tt appendRoutehandle} to the {\tt routehandle}.
!
! The arguments are:
! \begin{description}
! \item[routehandle]
! {\tt ESMF\_RouteHandle} to be appended to.
! \item[appendRoutehandle]
! {\tt ESMF\_RouteHandle} to be appended and cleared.
! \item[{[transferflag]}]
! If set to {\tt .true.}, the ownership of the appended exchange will be
! transferred to {\tt routehandle}. This means that the exchange will be
! released when {\tt routehandle} is released. Even when ownership of the
! exchange pattern is transferred, {\tt appendRoutehandle} still can be used
! as a container to reference the exchange, e.g. to append the same
! exchange pattern multiple times. The default is {\tt .false.}.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_Logical) :: transferflagArg
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
ESMF_INIT_CHECK_DEEP(ESMF_RouteHandleGetInit,routehandle,rc)
if (present(transferflag)) then
transferflagArg = transferflag
else
transferflagArg = ESMF_FALSE ! default
endif
call c_ESMC_RouteHandleAppend(routehandle, appendRoutehandle, &
rraShift, vectorLengthShift, transferflagArg, localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_RouteHandleAppend