MAPL_ImportStateGet Subroutine

public recursive subroutine MAPL_ImportStateGet(GC, import, name, result, rc)

Arguments

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

Calls

proc~~mapl_importstateget~~CallsGraph proc~mapl_importstateget MAPL_ImportStateGet proc~mapl_importstateget->proc~mapl_importstateget ESMF_GridCompGet ESMF_GridCompGet proc~mapl_importstateget->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_importstateget->ESMF_UserCompGetInternalState esmf_stateget esmf_stateget proc~mapl_importstateget->esmf_stateget none~get_child_gridcomp MAPL_MetaComp%get_child_gridcomp proc~mapl_importstateget->none~get_child_gridcomp none~get_child_import_state MAPL_MetaComp%get_child_import_state proc~mapl_importstateget->none~get_child_import_state none~get_num_children~4 CompositeComponent%get_num_children proc~mapl_importstateget->none~get_num_children~4 proc~mapl_return MAPL_Return proc~mapl_importstateget->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_importstateget->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_import_state MaplGenericComponent%get_import_state none~get_child_import_state->none~get_import_state none~get_child_import_state->none~get_ith_child none~get_num_children~2 ConcreteComposite%get_num_children none~get_num_children~4->none~get_num_children~2 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_import_state->none~is_threading_active none~get_import_state->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~3 CompositeComponent%get_child_by_index none~get_child~26->none~get_child_by_index~3 none~get_child_by_name~3 CompositeComponent%get_child_by_name none~get_child~26->none~get_child_by_name~3

Source Code

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

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

      have_ens = index(name,":") /= 0
      call ESMF_StateGet(import, name=sname, rc=status)
      _VERIFY(status)
      if (have_ens) then
         if (sname == trim(name) // '_Imports') then
            result = import
            _RETURN(ESMF_SUCCESS)
         end if
      else
         if (sname(index(sname,":")+1:) == trim(name) // '_Imports') then
            result = import
            _RETURN(ESMF_SUCCESS)
         end if
      end if

      call MAPL_InternalStateGet ( GC, STATE, RC=status)
      _VERIFY(status)

      do I = 1, STATE%get_num_children()
         gridcomp => STATE%GET_CHILD_GRIDCOMP(I)
         child_import_state => STATE%get_child_import_state(i)
         call MAPL_ImportStateGet(gridcomp, child_import_state, name, result, RC=status)
         if (status == ESMF_SUCCESS) then
            _RETURN(ESMF_SUCCESS)
         end if
      end do

      rc = ESMF_FAILURE
      return
   end subroutine MAPL_ImportStateGet