Type | Intent | Optional | 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 |
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