subroutine ESMF_GridGetPSlocPTile(grid, tile, staggerloc, &
keywordEnforcer, minIndex, maxIndex, rc)
!
! !ARGUMENTS:
type(ESMF_Grid), intent(in) :: grid
integer, intent(in) :: tile
type (ESMF_StaggerLoc), intent(in) :: staggerloc
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, target, intent(out), optional :: minIndex(:)
integer, target, intent(out), optional :: maxIndex(:)
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! This method gets information about a particular stagger location.
! This information is useful for creating an ESMF Array to hold
! the data at the stagger location.
!
!The arguments are:
!\begin{description}
!\item[grid]
! Grid to get the information from.
!\item[tile]
! The tile number to get the data from. Tile numbers range from 1 to TileCount.
!\item[staggerloc]
! The stagger location to get the information for.
! Please see Section~\ref{const:staggerloc} for a list
! of predefined stagger locations.
!\item[{[minIndex]}]
! Upon return this holds the global lower index of this stagger location.
! {\tt minIndex} must be allocated to be of size equal to the grid DimCount.
! Note that this value is only for the first Grid tile, as multigrid support
! is added, this interface will likely be changed or moved to adapt.
!\item[{[maxIndex]}]
! Upon return this holds the global upper index of this stagger location.
! {\tt maxIndex} must be allocated to be of size equal to the grid DimCount.
! Note that this value is only for the first Grid tile, as multigrid support
! is added, this interface will likely be changed or moved to adapt.
!\item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!\end{description}
!
!EOP
integer :: localrc ! local error status
type(ESMF_InterArray) :: minIndexArg ! helper variable
type(ESMF_InterArray) :: maxIndexArg ! helper variable
integer :: tmp_staggerloc
! Initialize return code
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP_SHORT(ESMF_GridGetInit, grid, rc)
tmp_staggerloc=staggerloc%staggerloc
! process optional arguments
minIndexArg=ESMF_InterArrayCreate(minIndex, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
maxIndexArg=ESMF_InterArrayCreate(maxIndex, 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_GridGetPSlocPTile(grid, tile, tmp_staggerLoc, &
minIndexArg, maxIndexArg,localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Deallocate interface ints
call ESMF_InterArrayDestroy(minIndexArg, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(maxIndexArg, 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_GridGetPSlocPTile