subroutine Setup2PeriodicConn(dimCount, minIndex, maxIndex, &
connList, rc)
integer, intent(in) :: dimCount
integer, intent(in) :: minIndex(:)
integer, intent(in) :: maxIndex(:)
type(ESMF_DistgridConnection), pointer :: connList(:)
integer, intent(out), optional :: rc
integer :: connListCount
integer :: posVec(ESMF_MAXDIM)
integer :: localrc
! Allocate connection list
allocate(connList(2), stat=localrc)
if (ESMF_LogFoundAllocError(localrc, msg="Allocating connList", &
ESMF_CONTEXT, rcToReturn=rc)) return
! Add dimension 1 periodic connection
posVec=0
posVec(1)=maxIndex(1)-minIndex(1)+1
call ESMF_DistgridConnectionSet(connection=connList(1), &
tileIndexA=1,tileIndexB=1, &
positionVector=posVec(1:dimCount), rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Add dimension 2 periodic connection
posVec=0
posVec(2)=maxIndex(2)-minIndex(2)+1
call ESMF_DistgridConnectionSet(connection=connList(2), &
tileIndexA=1,tileIndexB=1, &
positionVector=posVec(1:dimCount), rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
end subroutine Setup2PeriodicConn