ESMF_StaggerLocGetDim Subroutine

private subroutine ESMF_StaggerLocGetDim(staggerloc, dim, loc, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_StaggerLoc), intent(in) :: staggerloc
integer, intent(in) :: dim
integer, intent(out), optional :: loc
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, optional :: rc

Source Code

      subroutine ESMF_StaggerLocGetDim(staggerloc, dim, loc, &
           keywordEnforcer, rc)
!
! !ARGUMENTS:
      type (ESMF_StaggerLoc), intent(in)  :: staggerloc
      integer,                intent(in)  :: dim
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      integer, optional,      intent(out) :: loc
      integer, optional                   :: rc 

! !DESCRIPTION:
!   Gets the position of a particular dimension of a cell {\tt staggerloc}
!   The argument {\tt loc} will be only be 0,1. 
!    If {\tt loc} is 0 it means the position 
!    should be in the center in that dimension. If {\tt loc} is +1 then
!    for the dimension, the position should be on the positive side of the cell. 
!    Please see Section~\ref{sec:usage:staggerloc:adv} for diagrams.
!
!     The arguments are:
!     \begin{description}
!     \item[staggerloc]
!          Stagger location for which to get information. 
!     \item[dim]
!          Dimension for which to get information (1-7).
!     \item[{[loc]}]
!          Output position data (should be either 0,1).
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
     integer :: tmp

     ! Initialize return code; assume routine not implemented
     if (present(rc)) rc = ESMF_RC_NOT_IMPL

     ! Get stagger location value
     if (present(loc)) then
        tmp=(staggerloc%staggerloc)/(2**(dim-1))
        loc=mod(tmp,2)
     endif

     ! Set return values.
     if (present(rc)) rc = ESMF_SUCCESS


     end subroutine ESMF_StaggerLocGetDim