ESMF_GridGetCoordInfo Subroutine

private subroutine ESMF_GridGetCoordInfo(grid, keywordEnforcer, staggerloc, isPresent, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_StaggerLoc), intent(in), optional :: staggerloc
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_GridGetCoordInfo(grid, keywordEnforcer, &
        staggerloc, isPresent, rc)
!
! !ARGUMENTS:
      type(ESMF_Grid),           intent(in)            :: grid
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      type (ESMF_StaggerLoc),    intent(in),  optional :: staggerloc
      logical,                   intent(out), optional :: isPresent
      integer,                   intent(out), optional :: rc
!
!
! !DESCRIPTION:
!    This method allows the user to get information about the coordinates on a given
!    stagger.
!
!     The arguments are:
!     \begin{description}
!     \item[grid]
!          Grid to get the information from.
!     \item[{[staggerloc]}]
!          The stagger location from which to get information.
!          Please see Section~\ref{const:staggerloc} for a list
!          of predefined stagger locations. If not present, defaults to ESMF\_STAGGERLOC\_CENTER.
!     \item[{[isPresent]}]
!          If .true. then coordinates have been added on this staggerloc.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP

    integer :: tmp_staggerloc
    integer :: localrc ! local error status
    integer :: isPresentInt

    ! Initialize return code; assume failure until success is certain
    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)

    ! handle staggerloc
    if (present(staggerloc)) then
       tmp_staggerloc=staggerloc%staggerloc
    else
       tmp_staggerloc=ESMF_STAGGERLOC_CENTER%staggerloc
    endif

 ! XMRKX

    ! Call C++ Subroutine
    if (present(isPresent)) then
       isPresent=.false.
       call c_ESMC_gridgetcoordpresent(grid%this,tmp_staggerloc,  &
            isPresentInt, localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
            ESMF_CONTEXT, rcToReturn=rc)) return

       ! Interpret isPresentInt
       if (isPresentInt==1) then
          isPresent=.true.
       else
          isPresent=.false.
       endif
    endif

    if (present(rc)) rc = ESMF_SUCCESS

      end subroutine ESMF_GridGetCoordInfo