ESMF_GridCompGet Subroutine

public recursive subroutine ESMF_GridCompGet(gridcomp, keywordEnforcer, gridIsPresent, grid, gridList, meshIsPresent, mesh, meshList, locstreamIsPresent, locstream, locstreamList, xgridIsPresent, xgrid, xgridList, importStateIsPresent, importState, exportStateIsPresent, exportState, configIsPresent, config, configFileIsPresent, configFile, clockIsPresent, clock, localPet, petCount, contextflag, currentMethod, currentPhase, comptype, vmIsPresent, vm, name, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(in) :: gridcomp
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(out), optional :: gridIsPresent
type(ESMF_Grid), intent(out), optional :: grid
type(ESMF_Grid), intent(out), optional, allocatable :: gridList(:)
logical, intent(out), optional :: meshIsPresent
type(ESMF_Mesh), intent(out), optional :: mesh
type(ESMF_Mesh), intent(out), optional, allocatable :: meshList(:)
logical, intent(out), optional :: locstreamIsPresent
type(ESMF_LocStream), intent(out), optional :: locstream
type(ESMF_LocStream), intent(out), optional, allocatable :: locstreamList(:)
logical, intent(out), optional :: xgridIsPresent
type(ESMF_XGrid), intent(out), optional :: xgrid
type(ESMF_XGrid), intent(out), optional, allocatable :: xgridList(:)
logical, intent(out), optional :: importStateIsPresent
type(ESMF_State), intent(out), optional :: importState
logical, intent(out), optional :: exportStateIsPresent
type(ESMF_State), intent(out), optional :: exportState
logical, intent(out), optional :: configIsPresent
type(ESMF_Config), intent(out), optional :: config
logical, intent(out), optional :: configFileIsPresent
character(len=*), intent(out), optional :: configFile
logical, intent(out), optional :: clockIsPresent
type(ESMF_Clock), intent(out), optional :: clock
integer, intent(out), optional :: localPet
integer, intent(out), optional :: petCount
type(ESMF_Context_Flag), intent(out), optional :: contextflag
type(ESMF_Method_Flag), intent(out), optional :: currentMethod
integer, intent(out), optional :: currentPhase
type(ESMF_CompType_Flag), intent(out), optional :: comptype
logical, intent(out), optional :: vmIsPresent
type(ESMF_VM), intent(out), optional :: vm
character(len=*), intent(out), optional :: name
integer, intent(out), optional :: rc

Source Code

  recursive subroutine ESMF_GridCompGet(gridcomp, keywordEnforcer, &
    gridIsPresent, grid, gridList, meshIsPresent, mesh, meshList, &
    locstreamIsPresent, locstream, locstreamList, xgridIsPresent, &
    xgrid, xgridList, importStateIsPresent, importState, &
    exportStateIsPresent, exportState, configIsPresent, config, &
    configFileIsPresent, configFile, clockIsPresent, clock, localPet, &
    petCount, contextflag, currentMethod, currentPhase, comptype, &
    vmIsPresent, vm, name, rc)
!
! !ARGUMENTS:
    type(ESMF_GridComp),           intent(in)            :: gridcomp
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    logical,                       intent(out), optional :: gridIsPresent
    type(ESMF_Grid),               intent(out), optional :: grid
    type(ESMF_Grid), allocatable,  intent(out), optional :: gridList(:)
    logical,                       intent(out), optional :: meshIsPresent
    type(ESMF_Mesh),               intent(out), optional :: mesh
    type(ESMF_Mesh), allocatable,  intent(out), optional :: meshList(:)
    logical,                       intent(out), optional :: locstreamIsPresent
    type(ESMF_LocStream),          intent(out), optional :: locstream
    type(ESMF_LocStream), allocatable, intent(out), optional :: locstreamList(:)
    logical,                       intent(out), optional :: xgridIsPresent
    type(ESMF_XGrid),              intent(out), optional :: xgrid
    type(ESMF_XGrid), allocatable, intent(out), optional :: xgridList(:)
    logical,                       intent(out), optional :: importStateIsPresent
    type(ESMF_State),              intent(out), optional :: importState
    logical,                       intent(out), optional :: exportStateIsPresent
    type(ESMF_State),              intent(out), optional :: exportState
    logical,                       intent(out), optional :: configIsPresent
    type(ESMF_Config),             intent(out), optional :: config
    logical,                       intent(out), optional :: configFileIsPresent
    character(len=*),              intent(out), optional :: configFile
    logical,                       intent(out), optional :: clockIsPresent
    type(ESMF_Clock),              intent(out), optional :: clock
    integer,                       intent(out), optional :: localPet
    integer,                       intent(out), optional :: petCount
    type(ESMF_Context_Flag),       intent(out), optional :: contextflag
    type(ESMF_Method_Flag),        intent(out), optional :: currentMethod
    integer,                       intent(out), optional :: currentPhase
    type(ESMF_CompType_Flag),      intent(out), optional :: comptype
    logical,                       intent(out), optional :: vmIsPresent
    type(ESMF_VM),                 intent(out), optional :: vm
    character(len=*),              intent(out), optional :: name
    integer,                       intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \item\apiStatusModifiedSinceVersion{5.2.0r}
! \begin{description}
! \begin{sloppypar}
! \item[7.1.0r] Added arguments {\tt gridList}, {\tt meshIsPresent}, {\tt mesh},
!   {\tt meshList}, {\tt locstreamIsPresent}, {\tt locstream},
!   {\tt locstreamList}, {\tt xgridIsPresent}, {\tt xgrid}, and {\tt xgridList}.
!   These arguments add support for accessing references to multiple geom objects,
!   either of the same type, or different type, associated with the same
!   {\tt ESMF\_GridComp} object.
! \end{sloppypar}
! \end{description}
! \end{itemize}
!
! !DESCRIPTION:
! Get information about an {\tt ESMF\_GridComp} object.
!
! The arguments are:
! \begin{description}
! \item[gridcomp]
!   The {\tt ESMF\_GridComp} object being queried.
! \item[{[gridIsPresent]}]
!   Set to {\tt .true.} if at least one {\tt ESMF\_Grid} object is
!   associated with the {\tt gridcomp} component.
!   Set to {\tt .false.} otherwise.
! \item[{[grid]}]
!   Return the {\tt ESMF\_Grid} object associated with the {\tt gridcomp}
!   component. If multiple {\tt ESMF\_Grid} objects are associated, return the
!   first in the list.
!   It is an error to query for {\tt grid} if no {\tt ESMF\_Grid} object is
!   associated with the {\tt gridcomp} component.
!   If unsure, query for {\tt gridIsPresent} first, or use the {\tt gridList}
!   variant.
! \item[{[gridList]}]
!   Return a list of all {\tt ESMF\_Grid} objects associated with the
!   {\tt gridcomp} component. The size of the returned {\tt gridList}
!   corresponds to the number of {\tt ESMF\_Grid} objects associated.
!   If no {\tt ESMF\_Grid} object is associated with the {\tt gridcomp}
!   component, the size of the returned {\tt gridList} is zero.
! \item[{[meshIsPresent]}]
!   Set to {\tt .true.} if at least one {\tt ESMF\_Mesh} object is
!   associated with the {\tt gridcomp} component.
!   Set to {\tt .false.} otherwise.
! \item[{[mesh]}]
!   Return the {\tt ESMF\_Mesh} object associated with the {\tt gridcomp}
!   component. If multiple {\tt ESMF\_Mesh} objects are associated, return the
!   first in the list.
!   It is an error to query for {\tt mesh} if no {\tt ESMF\_Mesh} object is
!   associated with the {\tt gridcomp} component.
!   If unsure, query for {\tt meshIsPresent} first, or use the {\tt meshList}
!   variant.
! \item[{[meshList]}]
!   Return a list of all {\tt ESMF\_Mesh} objects associated with the
!   {\tt gridcomp} component. The size of the returned {\tt meshList}
!   corresponds to the number of {\tt ESMF\_Mesh} objects associated.
!   If no {\tt ESMF\_Mesh} object is associated with the {\tt gridcomp}
!   component, the size of the returned {\tt meshList} is zero.
! \item[{[locstreamIsPresent]}]
!   Set to {\tt .true.} if at least one {\tt ESMF\_LocStream} object is
!   associated with the {\tt gridcomp} component.
!   Set to {\tt .false.} otherwise.
! \item[{[locstream]}]
! \begin{sloppypar}
!   Return the {\tt ESMF\_LocStream} object associated with the {\tt gridcomp}
!   component. If multiple {\tt ESMF\_LocStream} objects are associated, return
!   the first in the list.
!   It is an error to query for {\tt locstream} if no {\tt ESMF\_Grid} object is
!   associated with the {\tt gridcomp} component.
!   If unsure, query for {\tt locstreamIsPresent} first, or use the
!   {\tt locstreamList} variant.
! \end{sloppypar}
! \item[{[locstreamList]}]
!   Return a list of all {\tt ESMF\_LocStream} objects associated with the
!   {\tt gridcomp} component. The size of the returned {\tt locstreamList}
!   corresponds to the number of {\tt ESMF\_LocStream} objects associated.
!   If no {\tt ESMF\_LocStream} object is associated with the {\tt gridcomp}
!   component, the size of the returned {\tt locstreamList} is zero.
! \item[{[xgridIsPresent]}]
!   Set to {\tt .true.} if at least one {\tt ESMF\_XGrid} object is
!   associated with the {\tt gridcomp} component.
!   Set to {\tt .false.} otherwise.
! \item[{[xgrid]}]
!   Return the {\tt ESMF\_XGrid} object associated with the {\tt gridcomp}
!   component. If multiple {\tt ESMF\_XGrid} objects are associated, return the
!   first in the list.
!   It is an error to query for {\tt xgrid} if no {\tt ESMF\_XGrid} object is
!   associated with the {\tt gridcomp} component.
!   If unsure, query for {\tt xgridIsPresent} first, or use the {\tt xgridList}
!   variant.
! \item[{[xgridList]}]
!   Return a list of all {\tt ESMF\_XGrid} objects associated with the
!   {\tt gridcomp} component. The size of the returned {\tt xgridList}
!   corresponds to the number of {\tt ESMF\_XGrid} objects associated.
!   If no {\tt ESMF\_XGrid} object is associated with the {\tt gridcomp}
!   component, the size of the returned {\tt xgridList} is zero.
! \item[{[importStateIsPresent]}]
!   {\tt .true.} if {\tt importState} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[importState]}]
!   Return the associated import State.
!   It is an error to query for the import State if none is associated with
!   the GridComp. If unsure, get {\tt importStateIsPresent} first to determine
!   the status.
! \item[{[exportStateIsPresent]}]
!   {\tt .true.} if {\tt exportState} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[exportState]}]
!   Return the associated export State.
!   It is an error to query for the export State if none is associated with
!   the GridComp. If unsure, get {\tt exportStateIsPresent} first to determine
!   the status.
! \item[{[configIsPresent]}]
!   {\tt .true.} if {\tt config} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[config]}]
!   Return the associated Config.
!   It is an error to query for the Config if none is associated with
!   the GridComp. If unsure, get {\tt configIsPresent} first to determine
!   the status.
! \item[{[configFileIsPresent]}]
!   {\tt .true.} if {\tt configFile} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[configFile]}]
!   Return the associated configuration filename.
!   It is an error to query for the configuration filename if none is associated with
!   the GridComp. If unsure, get {\tt configFileIsPresent} first to determine
!   the status.
! \item[{[clockIsPresent]}]
!   {\tt .true.} if {\tt clock} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[clock]}]
!   Return the associated Clock.
!   It is an error to query for the Clock if none is associated with
!   the GridComp. If unsure, get {\tt clockIsPresent} first to determine
!   the status.
! \item[{[localPet]}]
!   Return the local PET id within the {\tt ESMF\_GridComp} object.
! \item[{[petCount]}]
!   Return the number of PETs in the the {\tt ESMF\_GridComp} object.
! \item[{[contextflag]}]
!   Return the {\tt ESMF\_Context\_Flag} for this {\tt ESMF\_GridComp}.
!   See section \ref{const:contextflag} for a complete list of valid flags.
! \item[{[currentMethod]}]
!   Return the current {\tt ESMF\_Method\_Flag} of the {\tt ESMF\_GridComp}
!   execution. See section \ref{const:method}  for a complete list of valid
!   options.
! \item[{[currentPhase]}]
!   Return the current {\tt phase} of the {\tt ESMF\_GridComp} execution.
! \item[{[comptype]}]
!   Return the Component type.
!   See section \ref{const:comptype} for a complete list of valid flags.
! \item[{[vmIsPresent]}]
!   {\tt .true.} if {\tt vm} was set in GridComp object,
!   {\tt .false.} otherwise.
! \item[{[vm]}]
!   Return the associated VM.
!   It is an error to query for the VM if none is associated with
!   the GridComp. If unsure, get {\tt vmIsPresent} first to determine
!   the status.
! \item[{[name]}]
!   Return the name of the {\tt ESMF\_GridComp}.
! \item[{[rc]}]
!   Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
    integer               :: localrc      ! local return code
    type(ESMF_CompStatus) :: compStatus

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

    ESMF_INIT_CHECK_DEEP(ESMF_GridCompGetInit,gridcomp,rc)

    ! call Comp method
    call ESMF_CompGet(gridcomp%compp, name=name, vm=vm, contextflag=contextflag,&
      grid=grid, gridList=gridList, mesh=mesh, meshList=meshList, &
      locstream=locstream, locstreamList=locstreamList, &
      xgrid=xgrid, xgridList=xgridList, &
      importState=importState, exportState=exportState, clock=clock,&
      configFile=configFile, config=config, currentMethod=currentMethod, &
      currentPhase=currentPhase, localPet=localPet, petCount=petCount, &
      comptype=comptype, compStatus=compStatus, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    if (gridcomp%isNamedAlias .and. present(name)) then
      ! access NamedAlias name
      name = trim(gridcomp%name)
    endif

    ! call Comp method
    call ESMF_CompStatusGet(compStatus, &
      clockIsPresent = clockIsPresent, &
      configIsPresent = configIsPresent, &
      configFileIsPresent = configFileIsPresent, &
      vmIsPresent = vmIsPresent, &
      isIsPresent = importStateIsPresent, &
      esIsPresent = exportStateIsPresent, &
      gridIsPresent = gridIsPresent, &
      meshIsPresent = meshIsPresent, &
      locstreamIsPresent = locstreamIsPresent, &
      xgridIsPresent = xgridIsPresent, &
      rc = localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS
  end subroutine ESMF_GridCompGet