ESMF_GridLUA2PeriDim Subroutine

private subroutine ESMF_GridLUA2PeriDim(dimCount, periodicDim1, periodicDim2, lWidthIn, uWidthIn, alignIn, lWidthOut, uWidthOut, alignOut, rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: dimCount
integer, intent(in) :: periodicDim1
integer, intent(in) :: periodicDim2
integer, intent(in), optional, target :: lWidthIn(:)
integer, intent(in), optional, target :: uWidthIn(:)
integer, intent(in), optional, target :: alignIn(:)
integer, intent(out), target :: lWidthOut(:)
integer, intent(out), target :: uWidthOut(:)
integer, intent(out), target :: alignOut(:)
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_GridLUA2PeriDim(dimCount, &
                                     periodicDim1, periodicDim2, &
                                     lWidthIn, uWidthIn, alignIn, &
                                     lWidthOut, uWidthOut, alignOut, &
                                     rc)
!
! !ARGUMENTS:
       integer,               intent(in)              :: dimCount
       integer,               intent(in)              :: periodicDim1
       integer,               intent(in)              :: periodicDim2
       integer,       target, intent(in),   optional  :: lWidthIn(:)
       integer,       target, intent(in),   optional  :: uWidthIn(:)
       integer,       target, intent(in),   optional  :: alignIn(:)
       integer,       target, intent(out)             :: lWidthOut(:)
       integer,       target, intent(out)             :: uWidthOut(:)
       integer,       target, intent(out)             :: alignOut(:)
       integer,               intent(out),  optional  :: rc
!
! !DESCRIPTION:
! This routine sets the default values of the lwidth, uwidth, and align
! based on the user's passed in values for these.
!
! The arguments are:
! \begin{description}
! \item[{[lWidthIn]}]
!     The lower width from the user.
! \item[{[uWidthIn]}]
!     The upper width from the user.
! \item[{[alignIn]}]
!     The lower width from the user.
! \item[{[lWidthOut]}]
!     The lower width based on user input.
! \item[{[uWidthIn]}]
!     The upper width based on user input.
! \item[{[alignIn]}]
!     The lower width based on user input.
! \item[{[rc]}]
!      Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
    integer :: localrc ! local error status

    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! Check DimCount of gridWidths and Aligns
    if (present(lWidthIn)) then
        if (size(lWidthIn) /= dimCount) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeLWidth must be of size equal to Grid dimCount", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
        if (lWidthIn(periodicDim1) /= 0) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeLWidth must be of size 0 on a periodic dimension", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
        if (lWidthIn(periodicDim2) /= 0) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeLWidth must be of size 0 on a periodic dimension", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
    endif

    if (present(uWidthIn)) then
        if (size(uWidthIn) /= dimCount) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeUWidth must be of size equal to Grid dimCount", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
        if (uWidthIn(periodicDim1) /= 0) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeUWidth must be of size 0 on a periodic dimension", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
        if (uWidthIn(periodicDim2) /= 0) then
           call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
                     msg="- gridEdgeUWidth must be of size 0 on a periodic dimension", &
                     ESMF_CONTEXT, rcToReturn=rc)
              return
        endif
    endif

    call ESMF_GridLUADefault(dimCount, &
         lWidthIn, uWidthIn, alignIn, &
         lWidthOut, uWidthOut, alignOut, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
         ESMF_CONTEXT, rcToReturn=rc)) return

    ! Make default 0 for periodic dimension
    lWidthOut(periodicDim1)=0
    lWidthOut(periodicDim2)=0
    uWidthOut(periodicDim1)=0
    uWidthOut(periodicDim2)=0

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

    end subroutine ESMF_GridLUA2PeriDim