MAPL_DestroyStateSave Subroutine

public recursive subroutine MAPL_DestroyStateSave(GC, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC
integer, intent(out), optional :: rc

Calls

proc~~mapl_destroystatesave~~CallsGraph proc~mapl_destroystatesave MAPL_DestroyStateSave proc~mapl_destroystatesave->proc~mapl_destroystatesave none~get_child_gridcomp MAPL_MetaComp%get_child_gridcomp proc~mapl_destroystatesave->none~get_child_gridcomp none~get_num_children~3 CompositeComponent%get_num_children proc~mapl_destroystatesave->none~get_num_children~3 proc~getfile GETFILE proc~mapl_destroystatesave->proc~getfile proc~mapl_destroyfile MAPL_DestroyFile proc~mapl_destroystatesave->proc~mapl_destroyfile proc~mapl_internalstateretrieve MAPL_InternalStateRetrieve proc~mapl_destroystatesave->proc~mapl_internalstateretrieve proc~mapl_verify MAPL_Verify proc~mapl_destroystatesave->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 proc~getfile->proc~mapl_verify interface~mapl_am_i_root MAPL_Am_I_Root proc~getfile->interface~mapl_am_i_root proc~mapl_return MAPL_Return proc~getfile->proc~mapl_return proc~dealloc_ dealloc_ proc~mapl_destroyfile->proc~dealloc_ proc~mapl_internalstateretrieve->proc~mapl_verify ESMF_GridCompGet ESMF_GridCompGet proc~mapl_internalstateretrieve->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_internalstateretrieve->ESMF_UserCompGetInternalState proc~mapl_internalstatecreate MAPL_InternalStateCreate proc~mapl_internalstateretrieve->proc~mapl_internalstatecreate proc~mapl_internalstateretrieve->proc~mapl_return proc~mapl_throw_exception 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 proc~dealloc_->proc~mapl_return interface~mapl_assert MAPL_Assert proc~dealloc_->interface~mapl_assert proc~mapl_internalstatecreate->proc~mapl_verify proc~mapl_internalstatecreate->ESMF_GridCompGet proc~mapl_internalstatecreate->proc~mapl_return ESMF_UserCompSetInternalState ESMF_UserCompSetInternalState proc~mapl_internalstatecreate->ESMF_UserCompSetInternalState none~get_component~4 ConcreteComposite%get_component proc~mapl_internalstatecreate->none~get_component~4 none~initialize~19 ConcreteComposite%initialize proc~mapl_internalstatecreate->none~initialize~19 none~set_composite~2 CompositeComponent%set_composite proc~mapl_internalstatecreate->none~set_composite~2 proc~mapl_return->proc~mapl_throw_exception at at proc~mapl_return->at insert insert proc~mapl_return->insert 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_DestroyStateSave(gc,rc)
      type(ESMF_GridComp), intent(inout) :: GC
      integer, optional,   intent(out) :: rc
      type(MAPL_MetaComp), pointer :: state
      integer :: unit, i, status

      type (ESMF_GridComp), pointer :: gridcomp

      call MAPL_InternalStateRetrieve(GC, STATE, RC=status)
      _VERIFY(status)
      do I=1,STATE%get_num_children()
         gridcomp => STATE%GET_CHILD_GRIDCOMP(I)
         call MAPL_DestroyStateSave (gridcomp, RC=status )
         _VERIFY(status)
      enddo

      if (allocated(STATE%initial_state%imp_fname)) then
         UNIT = GETFILE(STATE%initial_state%IMP_FNAME, RC=status)
         _VERIFY(status)
         call MAPL_DestroyFile(unit = UNIT, rc=status)
         _VERIFY(status)
         deallocate(STATE%initial_state%imp_fname)
      end if

      if (allocated(state%initial_state%int_fname)) then
         UNIT = GETFILE(STATE%initial_state%INT_FNAME, RC=status)
         _VERIFY(status)
         call MAPL_DestroyFile(unit = UNIT, rc=status)
         _VERIFY(status)
         deallocate(state%initial_state%int_fname)
      end if

   end subroutine MAPL_DestroyStateSave