subroutine ESMF_DistGridConnectionInt(connection, tileIndexA, tileIndexB, &
positionVector, keywordEnforcer, orientationVector, rc)
!
! !ARGUMENTS:
integer, target, intent(out) :: connection(:)
integer, intent(in) :: tileIndexA
integer, intent(in) :: tileIndexB
integer, intent(in) :: positionVector(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(in), optional :: orientationVector(:)
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! This call helps to construct a DistGrid connection,
! which is a simple vector of integers, out of its components.
!
! The arguments are:
! \begin{description}
! \item[connection]
! Element to be constructed. The provided {\tt connection} array must
! be dimensioned to hold exactly the number of integers that result from
! the input information.
! \item[tileIndexA]
! Index of one of the two tiles that are to be connected.
! \item[tileIndexB]
! Index of one of the two tiles that are to be connected.
! \item[positionVector]
! Position of tile B's minIndex with respect to tile A's minIndex.
! \item[{[orientationVector]}]
! Associates each dimension of tile A with a dimension in tile B's
! index space. Negative index values may be used to indicate a
! reversal in index orientation. It is erroneous to associate multiple
! dimensions of tile A with the same index in tile B. By default
! {\tt orientationVector = (/1,2,3,.../)}, i.e. same orientation as tile A.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_InterArray) :: connectionArg ! helper variable
type(ESMF_InterArray) :: positionVectorArg ! helper variable
type(ESMF_InterArray) :: orientationVectorArg ! helper variable
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Deal with (optional) array arguments
connectionArg = ESMF_InterArrayCreate(connection, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
positionVectorArg = ESMF_InterArrayCreate(positionVector, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
orientationVectorArg = ESMF_InterArrayCreate(orientationVector, &
rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! call into the C++ interface, which will sort out optional arguments
call c_ESMC_DistGridConnection(connectionArg, &
tileIndexA, tileIndexB, positionVectorArg, orientationVectorArg, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! garbage collection
call ESMF_InterArrayDestroy(connectionArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(positionVectorArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(orientationVectorArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_DistGridConnectionInt