MAPL_InternalESMFStateGet Subroutine

public recursive subroutine MAPL_InternalESMFStateGet(GC, name, result, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC
character(len=*), intent(in) :: name
type(ESMF_State), intent(out) :: result
integer, intent(out) :: rc

Calls

proc~~mapl_internalesmfstateget~~CallsGraph proc~mapl_internalesmfstateget MAPL_InternalESMFStateGet proc~mapl_internalesmfstateget->proc~mapl_internalesmfstateget ESMF_GridCompGet ESMF_GridCompGet proc~mapl_internalesmfstateget->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_internalesmfstateget->ESMF_UserCompGetInternalState esmf_stateget esmf_stateget proc~mapl_internalesmfstateget->esmf_stateget interface~mapl_get MAPL_Get proc~mapl_internalesmfstateget->interface~mapl_get none~get_child_gridcomp MAPL_MetaComp%get_child_gridcomp proc~mapl_internalesmfstateget->none~get_child_gridcomp none~get_num_children~3 CompositeComponent%get_num_children proc~mapl_internalesmfstateget->none~get_num_children~3 proc~mapl_return MAPL_Return proc~mapl_internalesmfstateget->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_internalesmfstateget->proc~mapl_verify none~get_gridcomp MaplGenericComponent%get_gridcomp none~get_child_gridcomp->none~get_gridcomp none~get_ith_child MAPL_MetaComp%get_ith_child none~get_child_gridcomp->none~get_ith_child none~get_num_children~5 ConcreteComposite%get_num_children none~get_num_children~3->none~get_num_children~5 at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~is_threading_active MaplGenericComponent%is_threading_active none~get_gridcomp->none~is_threading_active proc~get_current_thread get_current_thread none~get_gridcomp->proc~get_current_thread none~get_child~26 MAPL_MetaComp%get_child none~get_ith_child->none~get_child~26 none~get_child_by_index CompositeComponent%get_child_by_index none~get_child~26->none~get_child_by_index none~get_child_by_name CompositeComponent%get_child_by_name none~get_child~26->none~get_child_by_name

Source Code

   recursive subroutine MAPL_InternalESMFStateGet ( GC, name, result, rc )
      type(ESMF_GridComp), intent(INout)  :: GC
      character(len=*),  intent(IN   ) :: name
      type (ESMF_State), intent(  OUT) :: result
      integer,           intent(  OUT) :: rc

      character(len=ESMF_MAXSTR), parameter :: IAm="MAPL_InternalESMFStateGet"
      integer                               :: status
      integer                               :: I
      logical                               :: have_ens
      character(len=ESMF_MAXSTR)            :: sname
      type (MAPL_MetaComp),pointer          :: STATE
      type(ESMF_State)                      :: internal
      type(ESMF_GridComp), pointer :: gridcomp

      have_ens = index(name,":") /= 0

      call MAPL_InternalStateGet ( GC, STATE, RC=status)
      _VERIFY(status)
      call MAPL_Get(STATE,INTERNAL_ESMF_STATE=internal,rc=status)
      _VERIFY(status)
      call ESMF_StateGet(internal, name=sname, rc=status)
      _VERIFY(status)
      if (have_ens) then
         if (sname == trim(name) // '_INTERNAL') then
            result = internal
            _RETURN(ESMF_SUCCESS)
         end if
      else
         if (sname(index(sname,":")+1:) == trim(name) // '_INTERNAL') then
            result = internal
            _RETURN(ESMF_SUCCESS)
         end if
      end if

      do I = 1, STATE%get_num_children()
         gridcomp => STATE%GET_CHILD_GRIDCOMP(I)
         call MAPL_InternalESMFStateGet(gridcomp, name, result, RC=status)
         if (status == ESMF_SUCCESS) then
            _RETURN(ESMF_SUCCESS)
         end if
      end do
      rc = ESMF_FAILURE
      return
   end subroutine MAPL_InternalESMFStateGet