calc_grid_rank Function

public function calc_grid_rank(lstring, MemBeg, MemEnd, localrc)

Arguments

Type IntentOptional Attributes Name
character(len=THARN_MAXSTR), intent(in) :: lstring
integer, intent(in) :: MemBeg
integer, intent(in) :: MemEnd
integer, intent(out) :: localrc

Return Value integer


Source Code

    integer function calc_grid_rank(lstring, MemBeg, MemEnd, localrc)
    !---------------------------------------------------------------------------
    ! This function returns the grid rank as specified by the descriptor
    ! string.
    !---------------------------------------------------------------------------

    ! arguments
    character(len=THARN_MAXSTR), intent(in   ) :: lstring
    integer,          intent(in   ) :: MemBeg, MemEnd
    integer,          intent(  out) :: localrc

    ! local variables
    character(len=3) :: pattern3
    integer :: nGrid

    ! initialize variables
    localrc = ESMF_RC_NOT_IMPL

    !---------------------------------------------------------------------------
    ! Check each memory chunk to see if any of the dimensions are associated
    ! with a grid.
    !---------------------------------------------------------------------------
    pattern3 = 'GU'
    nGrid = set_query(lstring(MemBeg:MemEnd), pattern3)

    if ( nGrid == 0 ) then
       ! syntax error, no grid layout specified
       print*,'Syntax error, no grid layout'
       call ESMF_LogSetError( ESMF_FAILURE, msg="syntax error, no grid " //     &
                "layout specified", rcToReturn=localrc)
       return
    endif
    calc_grid_rank = nGrid

    !---------------------------------------------------------------------------
    ! if I've gotten this far without an error, then the routine has succeeded.
    !---------------------------------------------------------------------------
    localrc = ESMF_SUCCESS

    !---------------------------------------------------------------------------
    end function calc_grid_rank