ESMF_XGridGetGB Subroutine

private subroutine ESMF_XGridGetGB(xgrid, sideA, sideB, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_XGrid), intent(in) :: xgrid
type(ESMF_XGridGeomBase), intent(out) :: sideA(:)
type(ESMF_XGridGeomBase), intent(out) :: sideB(:)
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_XGridGetGB(xgrid, sideA, sideB, rc) 

!
! !ARGUMENTS:
type(ESMF_XGrid), intent(in)                :: xgrid
type(ESMF_XGridGeomBase), intent(out)       :: sideA(:), sideB(:)
integer, intent(out), optional              :: rc 
!
! !DESCRIPTION:
!      Get information about XGrid
!
!     The arguments are:
!     \begin{description}
!     \item [xgrid]
!       The {\tt ESMF\_XGrid} object used to retrieve information from.
!     \item [{[sideA]}]
!           2D GeomBase objects on side A
!     \item [{[sideB]}]
!           2D GeomBase objects on side B
!     \item [{[rc]}]
!           Return code; equals {\tt ESMF\_SUCCESS} only if the {\tt ESMF\_XGrid} 
!           is created.
!     \end{description}
!
!EOPI

    integer :: localrc, ngrid_a, ngrid_b, i
    type(ESMF_XGridType), pointer :: xgtypep

    ! Initialize
    localrc = ESMF_RC_NOT_IMPL

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

    ! check init status of input XGrid
    ESMF_INIT_CHECK_DEEP(ESMF_XGridGetInit,xgrid,rc)

    xgtypep => xgrid%xgtypep

    ngrid_a = size(sideA, 1)
    if(ngrid_a /= size(xgtypep%sideA, 1)) then
        call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_WRONG, & 
           msg="- size of sideA doesn't match the size of sideA in the XGrid", &
           ESMF_CONTEXT, rcToReturn=rc) 
        return
    endif
    do i = 1, ngrid_a
        sideA(i) = xgtypep%sideA(i)
    enddo 

    ngrid_b = size(sideB, 1)
    if(ngrid_b /= size(xgtypep%sideB, 1)) then
        call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_WRONG, & 
           msg="- size of sideB doesn't match the size of sideB in the XGrid", &
           ESMF_CONTEXT, rcToReturn=rc) 
        return
    endif
    do i = 1, ngrid_b
        sideB(i) = xgtypep%sideB(i)
    enddo 

    ! success
    if(present(rc)) rc = ESMF_SUCCESS

end subroutine ESMF_XGridGetGB