ESMF_LocStreamGet Subroutine

public subroutine ESMF_LocStreamGet(locstream, keywordEnforcer, distgrid, keyCount, keyNames, localDECount, indexflag, coordSys, name, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_LocStream), intent(in) :: locstream
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_DistGrid), intent(out), optional :: distgrid
integer, intent(out), optional :: keyCount
character(len=ESMF_MAXSTR), optional :: keyNames(:)
integer, intent(out), optional :: localDECount
type(ESMF_Index_Flag), intent(out), optional :: indexflag
type(ESMF_CoordSys_Flag), intent(out), optional :: coordSys
character(len=*), intent(out), optional :: name
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_LocStreamGet(locstream, keywordEnforcer, &
       distgrid, keyCount, keyNames, localDECount, indexflag, &
       coordSys, name, rc)
!
! !ARGUMENTS:
    type(ESMF_Locstream),         intent(in)            :: locstream
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    type(ESMF_DistGrid),          intent(out), optional :: distgrid
    integer,                      intent(out), optional :: keyCount
    character(len=ESMF_MAXSTR),                optional :: keyNames(:) 
    integer,                      intent(out), optional :: localDECount
    type(ESMF_Index_Flag),        intent(out), optional :: indexflag
    type(ESMF_CoordSys_Flag),     intent(out), optional :: coordSys
    character(len=*),             intent(out), optional :: name
    integer,                      intent(out), optional :: rc


!
! !DESCRIPTION:
! Query an {\tt ESMF\_LocStream} for various information. All arguments after
! the {\tt locstream} are optional. 
!
! The arguments are:
! \begin{description}
! \item [locstream]
! The {\tt ESMF\_LocStream} object to query.
! \item [{[distgrid]}]
! The {\tt ESMF\_DistGrid} object that describes 
! \item [{[keyCount]}]
! Number of keys in the {\tt locstream}.
! \item [{[keyNames]}]
! The names of the keys in the {\tt locstream}. Keynames should
! be an array of character strings. The character strings should
! be of length ESMF\_MAXSTR and the array's length should be
! at least keyCount. 
! \item [{[localDECount]}]
! Number of DEs on this PET in the {\tt locstream}.
! \item [{[indexflag]}]
! The indexflag for this indexflag.
! \item [{[coordSys]}]
! The coordinate system for this location stream.
! \item [{[name]}]
! Name of queried item.
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!EOP
!------------------------------------------------------------------------------
    type(ESMF_LocStreamType), pointer :: lstypep
    integer :: localrc
    type(ESMF_DELayout) :: delayout

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

    ! check variables
    ESMF_INIT_CHECK_DEEP(ESMF_LocStreamGetInit,locstream,rc)

    ! Get pointer
    lstypep => locstream%lstypep

    ! get distgrid
    if (present(distgrid)) then
        distgrid = lstypep%distgrid
    endif

    ! get keyCount
    if (present(keyCount)) then
        keyCount = lstypep%keyCount
    endif

    ! get keyNames
    if (present(keyNames)) then
       if (size(keyNames) .lt. lstypep%keyCount) then
          call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, & 
              msg="- keyNames array too short", & 
              ESMF_CONTEXT, rcToReturn=rc) 
          return 
       endif

       if (lstypep%keyCount .gt. 0) then
          keyNames(1:lstypep%keyCount)=lstypep%keyNames(1:lstypep%keyCount)
       endif
    endif


   ! Get localDECount
   if (present(localDECount)) then
      call ESMF_DistGridGet(lstypep%distgrid, delayout=delayout, rc=localrc) 
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & 
          ESMF_CONTEXT, rcToReturn=rc)) return
 
      call ESMF_DELayoutGet(delayout, localDeCount=localDECount, rc=localrc) 
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, & 
       ESMF_CONTEXT, rcToReturn=rc)) return
    endif

    ! get indexflag
    if (present(indexflag)) then
        indexflag = lstypep%indexflag
    endif

    ! get coordSys
    if (present(coordSys)) then
        coordSys = lstypep%coordSys
    endif

    if (present(name)) then
        call ESMF_GetName(lstypep%base, name, localrc)
        if (ESMF_LogFoundError(localrc, &
                              ESMF_ERR_PASSTHRU, &
                              ESMF_CONTEXT, rcToReturn=rc)) return
    endif

    if (present(rc)) rc = ESMF_SUCCESS

  end subroutine ESMF_LocStreamGet