subroutine ESMF_GridGetCoordR8(grid, staggerloc, localDE, &
index, coord, keywordEnforcer, rc)
!
! !ARGUMENTS:
type(ESMF_Grid), intent(in) :: grid
type (ESMF_StaggerLoc), intent(in), optional :: staggerloc
integer, intent(in), optional :: localDE
integer, intent(in) :: index(:)
real(ESMF_KIND_R8), intent(out) :: coord(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! Given a specific index location in a Grid, this method returns the full set
! of coordinates from that index location. This method should work no matter what
! the factorization of the Grid's coordinate components.
!
! The arguments are:
! \begin{description}
! \item[grid]
! Grid to get the information from.
! \item[{[staggerloc]}]
! The stagger location to get the information for.
! Please see Section~\ref{const:staggerloc} for a list
! of predefined stagger locations. If not present, defaults to
! ESMF\_STAGGERLOC\_CENTER.
! \item[{[localDE]}]
! The local DE for which information is requested. {\tt [0,..,localDECount-1]}.
! For {\tt localDECount==1} the {\tt localDE} argument may be omitted,
! in which case it will default to {\tt localDE=0}.
! \item[index]
! This array holds the index location to be queried in the Grid. This array must
! at least be of the size Grid rank.
! \item[coord]
! This array will be filled with the coordinate data. This array must
! at least be of the size Grid rank.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
! Local variables
integer :: localrc
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(ESMF_GridGetInit, grid, rc)
! Have default option for staggerloc
if (present(staggerloc)) then
tmp_staggerloc=staggerloc%staggerloc
else
tmp_staggerloc=ESMF_STAGGERLOC_CENTER%staggerloc ! default
endif
! NOTE THERE IS NO INPUT VALUE CHECKING HERE BECAUSE IT'S DONE IN
! THE C++ VERSION.
! Call into the C++ interface
call c_esmc_gridgetcoordr8(grid, localDE, tmp_staggerloc, &
index, coord, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_GridGetCoordR8