MAPL_InternalStateCreate Subroutine

public subroutine MAPL_InternalStateCreate(GC, MAPLOBJ, RC)

Uses

  • proc~~mapl_internalstatecreate~~UsesGraph proc~mapl_internalstatecreate MAPL_InternalStateCreate module~mapl_concretecomposite mapl_ConcreteComposite proc~mapl_internalstatecreate->module~mapl_concretecomposite gFTL_StringVector gFTL_StringVector module~mapl_concretecomposite->gFTL_StringVector module~mapl_abstractcomposite mapl_AbstractComposite module~mapl_concretecomposite->module~mapl_abstractcomposite module~mapl_abstractframeworkcomponent mapl_AbstractFrameworkComponent module~mapl_concretecomposite->module~mapl_abstractframeworkcomponent module~mapl_stringcompositemap mapl_StringCompositeMap module~mapl_concretecomposite->module~mapl_stringcompositemap module~mapl_surrogateframeworkcomponent mapl_SurrogateFrameworkComponent module~mapl_abstractframeworkcomponent->module~mapl_surrogateframeworkcomponent module~mapl_stringcompositemap->module~mapl_abstractcomposite

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC
type(MAPL_MetaComp), pointer :: MAPLOBJ
integer, intent(out), optional :: RC

Calls

proc~~mapl_internalstatecreate~~CallsGraph proc~mapl_internalstatecreate MAPL_InternalStateCreate ESMF_GridCompGet ESMF_GridCompGet proc~mapl_internalstatecreate->ESMF_GridCompGet ESMF_UserCompSetInternalState ESMF_UserCompSetInternalState proc~mapl_internalstatecreate->ESMF_UserCompSetInternalState none~get_component~2 ConcreteComposite%get_component proc~mapl_internalstatecreate->none~get_component~2 none~initialize~15 ConcreteComposite%initialize proc~mapl_internalstatecreate->none~initialize~15 none~set_composite~2 CompositeComponent%set_composite proc~mapl_internalstatecreate->none~set_composite~2 proc~mapl_return MAPL_Return proc~mapl_internalstatecreate->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_internalstatecreate->proc~mapl_verify 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

Called by

proc~~mapl_internalstatecreate~~CalledByGraph proc~mapl_internalstatecreate MAPL_InternalStateCreate proc~mapl_capgridcompcreate MAPL_CapGridCompCreate proc~mapl_capgridcompcreate->proc~mapl_internalstatecreate proc~mapl_internalstateretrieve MAPL_InternalStateRetrieve proc~mapl_internalstateretrieve->proc~mapl_internalstatecreate proc~run_component_driver run_component_driver proc~run_component_driver->proc~mapl_internalstatecreate proc~run_component_driver->proc~mapl_internalstateretrieve none~initialize_cap_gc MAPL_Cap%initialize_cap_gc none~initialize_cap_gc->proc~mapl_capgridcompcreate proc~main main proc~main->proc~run_component_driver proc~mapl_advertiseservice MAPL_AdvertiseService proc~mapl_advertiseservice->proc~mapl_internalstateretrieve proc~mapl_childaddattribtoimportspec MAPL_ChildAddAttribToImportSpec proc~mapl_childaddattribtoimportspec->proc~mapl_internalstateretrieve proc~mapl_destroystatesave MAPL_DestroyStateSave proc~mapl_destroystatesave->proc~mapl_internalstateretrieve proc~mapl_destroystatesave->proc~mapl_destroystatesave proc~mapl_donotdeferexport MAPL_DoNotDeferExport proc~mapl_donotdeferexport->proc~mapl_internalstateretrieve proc~mapl_friendlyget MAPL_FriendlyGet proc~mapl_friendlyget->proc~mapl_internalstateretrieve proc~mapl_genericfinalize MAPL_GenericFinalize proc~mapl_genericfinalize->proc~mapl_internalstateretrieve proc~mapl_genericinitialize MAPL_GenericInitialize proc~mapl_genericinitialize->proc~mapl_internalstateretrieve proc~mapl_genericrecord MAPL_GenericRecord proc~mapl_genericrecord->proc~mapl_internalstateretrieve proc~mapl_genericrefresh MAPL_GenericRefresh proc~mapl_genericrefresh->proc~mapl_internalstateretrieve proc~mapl_genericrefresh->proc~mapl_genericrefresh proc~mapl_genericsetservices MAPL_GenericSetServices proc~mapl_genericsetservices->proc~mapl_internalstateretrieve proc~mapl_gridcompsetentrypoint MAPL_GridCompSetEntryPoint proc~mapl_genericsetservices->proc~mapl_gridcompsetentrypoint proc~mapl_genericstaterestore MAPL_GenericStateRestore proc~mapl_genericstaterestore->proc~mapl_internalstateretrieve proc~mapl_genericstaterestore->proc~mapl_genericstaterestore proc~mapl_genericstatesave MAPL_GenericStateSave proc~mapl_genericstatesave->proc~mapl_internalstateretrieve proc~mapl_genericstatesave->proc~mapl_genericstatesave proc~mapl_gridcompsetentrypoint->proc~mapl_internalstateretrieve proc~mapl_requestservice MAPL_RequestService proc~mapl_requestservice->proc~mapl_internalstateretrieve proc~mapl_setvarspecforcc MAPL_SetVarSpecForCC proc~mapl_setvarspecforcc->proc~mapl_internalstateretrieve proc~mapl_stateprintspeccsv MAPL_StatePrintSpecCSV proc~mapl_stateprintspeccsv->proc~mapl_internalstateretrieve proc~mapl_stateprintspeccsv->proc~mapl_stateprintspeccsv none~run_model MAPL_Cap%run_model none~run_model->none~initialize_cap_gc proc~setservices~2 SetServices proc~setservices~2->proc~mapl_genericsetservices proc~setservices~2->proc~mapl_gridcompsetentrypoint proc~setservices~4 SetServices proc~setservices~4->proc~mapl_genericsetservices proc~setservices~4->proc~mapl_gridcompsetentrypoint proc~setservices~5 SetServices proc~setservices~5->proc~mapl_genericsetservices proc~setservices~5->proc~mapl_gridcompsetentrypoint proc~setservices~6 SetServices proc~setservices~6->proc~mapl_genericsetservices proc~setservices~6->proc~mapl_gridcompsetentrypoint proc~setservices~7 SetServices proc~setservices~7->proc~mapl_genericsetservices proc~setservices~7->proc~mapl_gridcompsetentrypoint program~comp_testing_driver comp_testing_driver program~comp_testing_driver->proc~main none~run_member MAPL_Cap%run_member none~run_member->none~run_model

Source Code

   subroutine MAPL_InternalStateCreate( GC, MAPLOBJ, RC)
      use mapl_ConcreteComposite
      type(ESMF_GridComp),                  intent(INOUT) :: GC ! Gridded component
      type (MAPL_MetaComp),                       pointer :: MAPLOBJ
      integer,                    optional, intent(  OUT) :: RC ! Return code

      ! ErrLog Variables

      character(len=ESMF_MAXSTR)        :: IAm
      character(len=ESMF_MAXSTR)        :: comp_name
      integer                           :: status
      ! Local variables
      ! ---------------

      type (MAPL_GenericWrap )          :: WRAP
#if defined(ABSOFT) || defined(sysIRIX64)
      type(MAPL_MetaComp ), target      :: DUMMY
#endif
      type(ConcreteComposite), pointer :: root_composite
      class(AbstractFrameworkComponent), pointer :: tmp_component
      !=============================================================================

      ! Begin...

      ! Get the target components name and set-up traceback handle.
      ! -----------------------------------------------------------

      Iam = "MAPL_InternalStateCreate"
      call ESMF_GridCompGet( GC, name=comp_name, RC=status )
      _VERIFY(status)
      Iam = trim(comp_name) // trim(Iam)

#if defined(ABSOFT) || defined(sysIRIX64)
      WRAP%MAPLOBJ => DUMMY
#endif

      ! Allocate this instance of the internal state and put it in wrapper.
      ! -------------------------------------------------------------------

      if (.not. associated(MAPLOBJ)) then
         ! Root component (hopefully)
         allocate(MAPLOBJ, STAT=status)
         _VERIFY(status)
! Memory leak !
         allocate(root_composite)
         ! TODO: test if workaround is needed for 10.2
         ! workaround for gfortran 10.1
!C$       root_composite = ConcreteComposite(MAPLOBJ)
         call root_composite%initialize(MAPLOBJ)
         tmp_component => root_composite%get_component()
         select type (tmp_component)
            class is (MAPL_MetaComp)
            MAPLOBJ => tmp_component
         end select
         call MAPLOBJ%set_composite(root_composite)
      end if

      WRAP%MAPLOBJ => MAPLOBJ

      ! Have ESMF save pointer to the wrapped internal state in the G.C.
      ! ----------------------------------------------------------------

      call ESMF_UserCompSetInternalState(GC, "MAPL_GenericInternalState", WRAP, status)
      _VERIFY(status)

      _RETURN(ESMF_SUCCESS)
   end subroutine MAPL_InternalStateCreate