get_substates Subroutine

public recursive subroutine get_substates(gc, states, component_path, substates, rc)

Uses

  • proc~~get_substates~~UsesGraph proc~get_substates get_substates module~mapl3g_griddedcomponentdriver mapl3g_GriddedComponentDriver proc~get_substates->module~mapl3g_griddedcomponentdriver ESMF ESMF module~mapl3g_griddedcomponentdriver->ESMF module~mapl3g_componentdriver mapl3g_ComponentDriver module~mapl3g_griddedcomponentdriver->module~mapl3g_componentdriver module~mapl3g_componentdrivervector mapl3g_ComponentDriverVector module~mapl3g_griddedcomponentdriver->module~mapl3g_componentdrivervector module~mapl3g_multistate mapl3g_MultiState module~mapl3g_griddedcomponentdriver->module~mapl3g_multistate module~mapl_errorhandlingmod mapl_ErrorHandlingMod module~mapl3g_griddedcomponentdriver->module~mapl_errorhandlingmod module~mapl_keywordenforcer mapl_KeywordEnforcer module~mapl3g_griddedcomponentdriver->module~mapl_keywordenforcer module~mapl3g_componentdriver->ESMF module~mapl3g_componentdriver->module~mapl3g_multistate module~mapl3g_componentdriver->module~mapl_errorhandlingmod module~maplshared MaplShared module~mapl3g_componentdriver->module~maplshared module~mapl3g_componentdrivervector->module~mapl3g_componentdriver module~mapl3g_multistate->ESMF module~mapl3g_multistate->module~mapl_keywordenforcer module~mapl3g_esmf_utilities mapl3g_ESMF_Utilities module~mapl3g_multistate->module~mapl3g_esmf_utilities module~mapl_errorhandling mapl_ErrorHandling module~mapl3g_multistate->module~mapl_errorhandling module~mapl_errorhandlingmod->module~mapl_errorhandling module~mapl3g_esmf_utilities->ESMF module~mapl3g_esmf_utilities->module~mapl_errorhandling module~mapl_throwmod MAPL_ThrowMod module~mapl_errorhandling->module~mapl_throwmod mpi mpi module~mapl_errorhandling->mpi module~maplshared->module~mapl_errorhandlingmod module~mapl_abstractcommsplittermod MAPL_AbstractCommSplitterMod module~maplshared->module~mapl_abstractcommsplittermod module~mapl_commgroupdescriptionmod MAPL_CommGroupDescriptionMod module~maplshared->module~mapl_commgroupdescriptionmod module~mapl_constants MAPL_Constants module~maplshared->module~mapl_constants module~mapl_dirpathmod MAPL_DirPathMod module~maplshared->module~mapl_dirpathmod module~mapl_downbitmod MAPL_DownbitMod module~maplshared->module~mapl_downbitmod module~mapl_dso_utilities mapl_DSO_Utilities module~maplshared->module~mapl_dso_utilities module~mapl_filesystemutilities mapl_FileSystemUtilities module~maplshared->module~mapl_filesystemutilities module~mapl_hashmod MAPL_HashMod module~maplshared->module~mapl_hashmod module~mapl_interpmod MAPL_InterpMod module~maplshared->module~mapl_interpmod module~mapl_keywordenforcermod mapl_KeywordEnforcerMod module~maplshared->module~mapl_keywordenforcermod module~mapl_loadbalancemod MAPL_LoadBalanceMod module~maplshared->module~mapl_loadbalancemod module~mapl_minmaxmod MAPL_MinMaxMod module~maplshared->module~mapl_minmaxmod module~mapl_rangemod MAPL_RangeMod module~maplshared->module~mapl_rangemod module~mapl_shmemmod MAPL_ShmemMod module~maplshared->module~mapl_shmemmod module~mapl_simplecommsplittermod MAPL_SimpleCommSplitterMod module~maplshared->module~mapl_simplecommsplittermod module~mapl_sleepmod MAPL_SleepMod module~maplshared->module~mapl_sleepmod module~mapl_sortmod MAPL_SortMod module~maplshared->module~mapl_sortmod module~mapl_splitcommunicatormod MAPL_SplitCommunicatorMod module~maplshared->module~mapl_splitcommunicatormod module~mapl_string MAPL_String module~maplshared->module~mapl_string module~maplshared->module~mapl_throwmod

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout), target :: gc
type(MultiState), intent(in) :: states
character(len=*), intent(in) :: component_path
type(MultiState), intent(out) :: substates
integer, intent(out) :: rc

Calls

proc~~get_substates~~CallsGraph proc~get_substates get_substates proc~get_substates->proc~get_substates anyexceptions anyexceptions proc~get_substates->anyexceptions assert_that assert_that proc~get_substates->assert_that interface~get_outer_meta get_outer_meta proc~get_substates->interface~get_outer_meta none~get_child~27 OuterMetaComponent%get_child proc~get_substates->none~get_child~27 none~get_gridcomp~3 GriddedComponentDriver%get_gridcomp proc~get_substates->none~get_gridcomp~3 none~get_states GriddedComponentDriver%get_states proc~get_substates->none~get_states none~get_user_gc_driver OuterMetaComponent%get_user_gc_driver proc~get_substates->none~get_user_gc_driver sourcelocation sourcelocation proc~get_substates->sourcelocation

Called by

proc~~get_substates~~CalledByGraph proc~get_substates get_substates proc~get_substates->proc~get_substates proc~test_anything test_anything proc~test_anything->proc~get_substates

Source Code

   recursive subroutine get_substates(gc, states, component_path, substates, rc)
      use mapl3g_GriddedComponentDriver
      type(ESMF_GridComp), target, intent(inout) :: gc
      type(MultiState), intent(in) :: states
      character(*), intent(in) :: component_path
      type(MultiState), intent(out) :: substates
      integer, intent(out) :: rc

      integer :: status
      character(:), allocatable :: child_name
      type(GriddedComponentDriver) :: child
      type(ESMF_GridComp) :: child_gc
      type(OuterMetaComponent), pointer :: outer_meta
      integer :: idx
      type(GriddedComponentDriver), pointer :: user_component

      rc = 0

      if (component_path == '<root>' .or. component_path == '') then
         substates = states
         return
      end if

      outer_meta => get_outer_meta(gc, _RC)

      ! Parse path
      idx = index(component_path, '/')
      if (idx == 0) idx = len(component_path) + 1
      child_name = component_path(:idx-1)
      
      if (child_name == '<user>') then
         user_component => outer_meta%get_user_gc_driver()
         substates = user_component%get_states()
         return
      end if

      ! Otherwise drill down 1 level.
      child = outer_meta%get_child(child_name, _RC)

      child_gc = child%get_gridcomp()

      call get_substates(child_gc, child%get_states(), component_path(idx+1:), &
           substates, _RC)

      return
   end subroutine get_substates