MAPL_GetChildLocstream Subroutine

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

Arguments

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

Calls

proc~~mapl_getchildlocstream~~CallsGraph proc~mapl_getchildlocstream MAPL_GetChildLocstream proc~mapl_getchildlocstream->proc~mapl_getchildlocstream ESMF_GridCompGet ESMF_GridCompGet proc~mapl_getchildlocstream->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_getchildlocstream->ESMF_UserCompGetInternalState none~get_child_gridcomp MAPL_MetaComp%get_child_gridcomp proc~mapl_getchildlocstream->none~get_child_gridcomp none~get_num_children~3 CompositeComponent%get_num_children proc~mapl_getchildlocstream->none~get_num_children~3 proc~mapl_return MAPL_Return proc~mapl_getchildlocstream->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_getchildlocstream->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_GetChildLocstream(GC, result, name, rc)
      type(ESMF_GridComp),   intent(INout) :: GC
      type (MAPL_LocStream), intent(  OUT) :: result
      character(len=*),      intent(IN   ) :: name
      integer,               intent(  OUT) :: rc

      character(len=ESMF_MAXSTR), parameter :: IAm="MAPL_GetChildLocstream"
      integer                               :: status
      integer                               :: I
      logical                               :: have_ens
      character(len=ESMF_MAXSTR)            :: comp_name
      type (MAPL_MetaComp),pointer          :: STATE
      type(ESMF_GridComp), pointer :: gridcomp

      call ESMF_GridCompGet(GC, name=comp_name, rc=status)
      _VERIFY(status)

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

      have_ens = index(name,":") /= 0
      if (have_ens) then ! the name contains ensemble #
         if (name == comp_name) then
            result = state%locstream
            _RETURN(status)
         end if
      else
         if (name == comp_name(index(comp_name,":")+1:)) then
            result = state%locstream
            _RETURN(status)
         end if
      end if


      do I = 1, STATE%get_num_children()
         gridcomp => STATE%GET_CHILD_GRIDCOMP(I)
         call MAPL_GetChildLocstream(gridcomp, result, name, rc=status)
         if (status == ESMF_SUCCESS) then
            _RETURN(ESMF_SUCCESS)
         end if
      end do

      rc = ESMF_FAILURE
      return
   end subroutine MAPL_GetChildLocstream