ESMF_GridGetPSloc Subroutine

private subroutine ESMF_GridGetPSloc(grid, staggerloc, keywordEnforcer, distgrid, staggerEdgeLWidth, staggerEdgeUWidth, staggerAlign, staggerLBound, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid
type(ESMF_StaggerLoc), intent(in) :: staggerloc
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_DistGrid), intent(out), optional :: distgrid
integer, intent(out), optional :: staggerEdgeLWidth(:)
integer, intent(out), optional :: staggerEdgeUWidth(:)
integer, intent(out), optional :: staggerAlign(:)
integer, intent(out), optional :: staggerLBound(:)
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_GridGetPSloc(grid, staggerloc, &
        keywordEnforcer, distgrid, &
        staggerEdgeLWidth, staggerEdgeUWidth, &
        staggerAlign, staggerLBound, rc)

!
! !ARGUMENTS:
      type(ESMF_Grid),        intent(in)            :: grid
      type (ESMF_StaggerLoc), intent(in)            :: staggerloc
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      type(ESMF_DistGrid),    intent(out), optional :: distgrid
      integer,                intent(out), optional :: staggerEdgeLWidth(:)
      integer,                intent(out), optional :: staggerEdgeUWidth(:)
      integer,                intent(out), optional :: staggerAlign(:)
      integer,                intent(out), optional :: staggerLBound(:)
      integer,                intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \item\apiStatusModifiedSinceVersion{5.2.0r}
! \begin{description}
! \item[7.1.0r] Added arguments {\tt staggerEdgeLWidth}, {\tt staggerEdgeUWidth},
!               {\tt staggerAlign}, and {\tt staggerLBound}. These new arguments 
!                allow the user to get width, alignment, and bound information for
!                the given stagger location. 
! \end{description}
! \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[staggerloc]
!     The stagger location to get the information for.
!     Please see Section~\ref{const:staggerloc} for a list
!     of predefined stagger locations.
!\item[{[distgrid]}]
!   The structure describing the distribution of this staggerloc in this grid.
! \item[{[staggerEdgeLWidth]}]
!      This array should be the same dimCount as the grid. It specifies the lower corner of the stagger
!      region with respect to the lower corner of the exclusive region.
! \item[{[staggerEdgeUWidth]}]
!      This array should be the same dimCount as the grid. It specifies the upper corner of the stagger
!      region with respect to the upper corner of the exclusive region.
! \item[{[staggerAlign]}]
!      This array is of size  grid dimCount.
!      For this stagger location, it specifies which element
!      has the same index value as the center. For example,
!      for a 2D cell with corner stagger it specifies which
!      of the 4 corners has the same index as the center.
! \item[{[staggerLBound]}]
!      Specifies the lower index range of the memory of every DE in this staggerloc in this Grid.
!      Only used when Grid indexflag is {\tt ESMF\_INDEX\_USER}.
!\item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!\end{description}
!
!EOP

 ! XMRKX
    integer :: localrc ! local error status
    type(ESMF_InterArray) :: staggerEdgeLWidthArg ! helper variable
    type(ESMF_InterArray) :: staggerEdgeUWidthArg ! helper variable
    type(ESMF_InterArray) :: staggerAlignArg ! helper variable
    type(ESMF_InterArray) :: staggerLBoundArg ! helper variable
    integer :: tmp_staggerloc

    ! Initialize return code
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! If not asking for anything, then just leave
    if (.not. present(distgrid) .and. &
        .not. present(staggerEdgeLWidth) .and. &
        .not. present(staggerEdgeUWidth) .and. &
        .not. present(staggerAlign) .and. &
        .not. present(staggerLBound)) then
       ! Return successfully
       if (present(rc)) rc = ESMF_SUCCESS
       return
    endif


    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP_SHORT(ESMF_GridGetInit, grid, rc)
    tmp_staggerloc=staggerloc%staggerloc


    ! process optional arguments into interface ints
    staggerEdgeLWidthArg=ESMF_InterArrayCreate(staggerEdgeLWidth, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    staggerEdgeUWidthArg=ESMF_InterArrayCreate(staggerEdgeUWidth, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    staggerAlignArg=ESMF_InterArrayCreate(staggerAlign, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    staggerLBoundArg=ESMF_InterArrayCreate(staggerLBound, 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_GridGetPSloc(grid, tmp_staggerLoc, &
         distgrid, staggerEdgeLWidthArg, staggerEdgeUWidthArg, &
         staggerAlignArg, staggerLBoundArg, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
       ESMF_CONTEXT, rcToReturn=rc)) return


    ! Deallocate interface ints
    call ESMF_InterArrayDestroy(staggerEdgeLWidthArg, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    call ESMF_InterArrayDestroy(staggerEdgeUWidthArg, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    call ESMF_InterArrayDestroy(staggerAlignArg, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    call ESMF_InterArrayDestroy(staggerLBoundArg, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return


    ! Set Deep Classes as created
    if (present(distgrid)) then
       call ESMF_DistGridSetInitCreated(distgrid, rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
           ESMF_CONTEXT, rcToReturn=rc)) return
    endif

    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS

      end subroutine ESMF_GridGetPSloc