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_GenericMod::MAPL_DestroyStateSave proc~mapl_destroystatesave->proc~mapl_destroystatesave none~get_child_gridcomp MAPL_GenericMod::MAPL_MetaComp%get_child_gridcomp proc~mapl_destroystatesave->none~get_child_gridcomp none~get_num_children~2 mapl_CompositeComponent::CompositeComponent%get_num_children proc~mapl_destroystatesave->none~get_num_children~2 proc~getfile BinIOMod::GETFILE proc~mapl_destroystatesave->proc~getfile proc~mapl_destroyfile BinIOMod::MAPL_DestroyFile proc~mapl_destroystatesave->proc~mapl_destroyfile proc~mapl_internalstateretrieve MAPL_GenericMod::MAPL_InternalStateRetrieve proc~mapl_destroystatesave->proc~mapl_internalstateretrieve proc~mapl_verify MAPL_ErrorHandlingMod::MAPL_Verify proc~mapl_destroystatesave->proc~mapl_verify none~get_gridcomp mapl_MaplGenericComponent::MaplGenericComponent%get_gridcomp none~get_child_gridcomp->none~get_gridcomp none~get_ith_child MAPL_GenericMod::MAPL_MetaComp%get_ith_child none~get_child_gridcomp->none~get_ith_child none~get_num_children~3 mapl_ConcreteComposite::ConcreteComposite%get_num_children none~get_num_children~2->none~get_num_children~3 proc~getfile->proc~mapl_verify interface~mapl_am_i_root MAPL_CommsMod::MAPL_Am_I_Root proc~getfile->interface~mapl_am_i_root proc~mapl_return MAPL_ErrorHandlingMod::MAPL_Return proc~getfile->proc~mapl_return proc~dealloc_ FileIOSharedMod::dealloc_ proc~mapl_destroyfile->proc~dealloc_ proc~mapl_internalstateretrieve->proc~mapl_verify ESMF_GridCompGet ESMF::ESMF_GridCompGet proc~mapl_internalstateretrieve->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF::ESMF_UserCompGetInternalState proc~mapl_internalstateretrieve->ESMF_UserCompGetInternalState proc~mapl_internalstatecreate MAPL_GenericMod::MAPL_InternalStateCreate proc~mapl_internalstateretrieve->proc~mapl_internalstatecreate proc~mapl_internalstateretrieve->proc~mapl_return proc~mapl_throw_exception MAPL_ThrowMod::MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~is_threading_active mapl_MaplGenericComponent::MaplGenericComponent%is_threading_active none~get_gridcomp->none~is_threading_active proc~get_current_thread MAPL_OpenMP_Support::get_current_thread none~get_gridcomp->proc~get_current_thread none~get_child MAPL_GenericMod::MAPL_MetaComp%get_child none~get_ith_child->none~get_child proc~dealloc_->proc~mapl_return interface~mapl_assert MAPL_ErrorHandlingMod::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::ESMF_UserCompSetInternalState proc~mapl_internalstatecreate->ESMF_UserCompSetInternalState none~get_component mapl_ConcreteComposite::ConcreteComposite%get_component proc~mapl_internalstatecreate->none~get_component none~initialize mapl_ConcreteComposite::ConcreteComposite%initialize proc~mapl_internalstatecreate->none~initialize none~set_composite mapl_CompositeComponent::CompositeComponent%set_composite proc~mapl_internalstatecreate->none~set_composite proc~mapl_return->proc~mapl_throw_exception at at proc~mapl_return->at insert insert proc~mapl_return->insert none~get_child_by_index mapl_CompositeComponent::CompositeComponent%get_child_by_index none~get_child->none~get_child_by_index none~get_child_by_name~2 mapl_CompositeComponent::CompositeComponent%get_child_by_name none~get_child->none~get_child_by_name~2

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