ESMF_GridGetItemInfo Subroutine

private subroutine ESMF_GridGetItemInfo(grid, itemflag, keywordEnforcer, staggerloc, isPresent, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid
type(ESMF_GridItem_Flag), intent(in) :: itemflag
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_GridGetItemInfo(grid, itemflag, keywordEnforcer, &
        staggerloc, isPresent, rc)
!
! !ARGUMENTS:
      type(ESMF_Grid),           intent(in)            :: grid
      type (ESMF_GridItem_Flag), intent(in)            :: itemflag
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 a given item on a given
!    stagger.
!
!     The arguments are:
!     \begin{description}
!     \item[grid]
!          Grid to get the information from.
!     \item[itemflag]
!          The item for which to get information. Please see Section~\ref{const:griditem} for a
!          list of valid items.
!     \item[{[staggerloc]}]
!          The stagger location for 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 an item of type itemflag has been added to 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_gridgetitempresent(grid%this,tmp_staggerloc, itemflag,  &
            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_GridGetItemInfo