OuterMetaComponent.F90 Source File


This file depends on

sourcefile~~outermetacomponent.f90~~EfferentGraph sourcefile~outermetacomponent.f90 OuterMetaComponent.F90 sourcefile~actualptcomponentdrivermap.f90 ActualPtComponentDriverMap.F90 sourcefile~outermetacomponent.f90->sourcefile~actualptcomponentdrivermap.f90 sourcefile~actualptvector.f90 ActualPtVector.F90 sourcefile~outermetacomponent.f90->sourcefile~actualptvector.f90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~outermetacomponent.f90->sourcefile~componentdriver.f90 sourcefile~componentdrivervector.f90 ComponentDriverVector.F90 sourcefile~outermetacomponent.f90->sourcefile~componentdrivervector.f90 sourcefile~componentspec.f90 ComponentSpec.F90 sourcefile~outermetacomponent.f90->sourcefile~componentspec.f90 sourcefile~connection.f90 Connection.F90 sourcefile~outermetacomponent.f90->sourcefile~connection.f90 sourcefile~connectionpt.f90 ConnectionPt.F90 sourcefile~outermetacomponent.f90->sourcefile~connectionpt.f90 sourcefile~connectionvector.f90 ConnectionVector.F90 sourcefile~outermetacomponent.f90->sourcefile~connectionvector.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~outermetacomponent.f90->sourcefile~errorhandling.f90 sourcefile~esmf_interfaces.f90 ESMF_Interfaces.F90 sourcefile~outermetacomponent.f90->sourcefile~esmf_interfaces.f90 sourcefile~geom_mgr.f90 geom_mgr.F90 sourcefile~outermetacomponent.f90->sourcefile~geom_mgr.f90 sourcefile~geometryspec.f90 GeometrySpec.F90 sourcefile~outermetacomponent.f90->sourcefile~geometryspec.f90 sourcefile~griddedcomponentdriver.f90 GriddedComponentDriver.F90 sourcefile~outermetacomponent.f90->sourcefile~griddedcomponentdriver.f90 sourcefile~griddedcomponentdrivermap.f90 GriddedComponentDriverMap.F90 sourcefile~outermetacomponent.f90->sourcefile~griddedcomponentdrivermap.f90 sourcefile~innermetacomponent.f90 InnerMetaComponent.F90 sourcefile~outermetacomponent.f90->sourcefile~innermetacomponent.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~outermetacomponent.f90->sourcefile~keywordenforcer.f90 sourcefile~matchconnection.f90 MatchConnection.F90 sourcefile~outermetacomponent.f90->sourcefile~matchconnection.f90 sourcefile~methodphasesmap.f90 MethodPhasesMap.F90 sourcefile~outermetacomponent.f90->sourcefile~methodphasesmap.f90 sourcefile~multistate.f90 MultiState.F90 sourcefile~outermetacomponent.f90->sourcefile~multistate.f90 sourcefile~pflogger_stub.f90 pflogger_stub.F90 sourcefile~outermetacomponent.f90->sourcefile~pflogger_stub.f90 sourcefile~stateitem.f90 StateItem.F90 sourcefile~outermetacomponent.f90->sourcefile~stateitem.f90 sourcefile~stateitemspec.f90 StateItemSpec.F90 sourcefile~outermetacomponent.f90->sourcefile~stateitemspec.f90 sourcefile~stateregistry.f90 StateRegistry.F90 sourcefile~outermetacomponent.f90->sourcefile~stateregistry.f90 sourcefile~usersetservices.f90 UserSetServices.F90 sourcefile~outermetacomponent.f90->sourcefile~usersetservices.f90 sourcefile~variablespec.f90 VariableSpec.F90 sourcefile~outermetacomponent.f90->sourcefile~variablespec.f90 sourcefile~variablespecvector.f90 VariableSpecVector.F90 sourcefile~outermetacomponent.f90->sourcefile~variablespecvector.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~outermetacomponent.f90->sourcefile~verticalgrid.f90 sourcefile~virtualconnectionpt.f90 VirtualConnectionPt.F90 sourcefile~outermetacomponent.f90->sourcefile~virtualconnectionpt.f90

Files dependent on this one

OuterMetaComponent.F90wadd_child_by_name.F90
w
wapply_to_children_custom.F90
w
wattach_outer_meta.F90
w
wclock_advance.F90
w
wconnect_all.F90
w
wfinalize.F90
w
wfinalize.F90
w
wfree_outer_meta.F90
w
wGeneric3g.F90
w
wGenericGridComp.F90
w
wget_child_by_name.F90
w
wget_clock.F90
w
wget_component_spec.F90
w
wget_geom.F90
w
wget_gridcomp.F90
w
wget_hconfig.F90
w
wget_internal_state.F90
w
wget_lgr.F90
w
wget_name.F90
w
wget_outer_meta_from_outer_gc.F90
w
wget_phases.F90
w
wget_registry.F90
w
wget_states.F90
w
wget_user_gc_driver.F90
w
wget_vertical_grid.F90
w
winit_meta.F90
w
winitialize.F90
w
winitialize_advertise.F90
w
winitialize_modify_advertised.F90
w
winitialize_modify_advertised2.F90
w
winitialize_realize.F90
w
winitialize_user.F90
w
wMAPL_Generic.F90
w
wnew_outer_meta.F90
w
wProtoExtDataGC.F90
w
wread_restart.F90
w
wread_restart.F90
w
wrecurse.F90
w
wrun.F90
w
wrun_child_by_name.F90
w
wrun_children.F90
w
wrun_clock_advance.F90
w
wrun_custom.F90
w
wrun_export_couplers.F90
w
wrun_import_couplers.F90
w
wrun_user.F90
w
wset_clock.F90
w
wset_entry_point.F90
w
wset_geom.F90
w
wset_hconfig.F90
w
wset_vertical_grid.F90
w
wSetServices.F90
w
wSimpleParentGridComp.F90
w
wTest_RunChild.pf
w
wTest_Scenarios.pf
w
wTest_SimpleLeafGridComp.pf
w
wTest_SimpleParentGridComp.pf
w
wwrite_restart.F90
w
wwrite_restart.F90
w

Source Code

#include "MAPL_Generic.h"

module mapl3g_OuterMetaComponent

   use mapl3g_geom_mgr
   use mapl3g_UserSetServices, only: AbstractUserSetServices
   use mapl3g_VariableSpec
   use mapl3g_StateItem
   use mapl3g_MultiState
   use mapl3g_VariableSpecVector
   use mapl3g_ComponentSpec
   use mapl3g_GenericPhases
   use mapl3g_InnerMetaComponent
   use mapl3g_MethodPhasesMap
   use mapl3g_StateItemSpec
   use mapl3g_Connection
   use mapl3g_ConnectionPt
   use mapl3g_MatchConnection
   use mapl3g_VirtualConnectionPt
   use mapl3g_ActualPtVector
   use mapl3g_ConnectionVector
   use mapl3g_StateRegistry
   use mapl3g_ESMF_Interfaces, only: I_Run
   use mapl3g_ComponentDriver
   use mapl3g_GriddedComponentDriver
   use mapl3g_ComponentDriverVector
   use mapl3g_GriddedComponentDriverMap, only: GriddedComponentDriverMap
   use mapl3g_GriddedComponentDriverMap, only: operator(/=)
   use mapl3g_ActualPtComponentDriverMap
   use mapl_ErrorHandling
   use mapl3g_VerticalGrid
   use mapl3g_GeometrySpec
   use gFTL2_StringVector
   use mapl_keywordEnforcer, only: KE => KeywordEnforcer
   use esmf
   use pflogger, only: Logger

   implicit none
   private

   public :: OuterMetaComponent
   public :: get_outer_meta
   public :: attach_outer_meta
   public :: free_outer_meta

   type :: OuterMetaComponent
      private

      type(ESMF_GridComp)                         :: self_gridcomp
      type(GriddedComponentDriver)                :: user_gc_driver
      class(AbstractUserSetServices), allocatable :: user_setservices
      type(MethodPhasesMap)                       :: user_phases_map
      type(ESMF_HConfig)                          :: hconfig

      type(ESMF_Geom), allocatable                :: geom
      class(VerticalGrid), allocatable            :: vertical_grid

      type(InnerMetaComponent), allocatable       :: inner_meta

      ! Hierarchy
      type(GriddedComponentDriverMap)             :: children
      type(StateRegistry) :: registry

      class(Logger), pointer :: lgr  => null() ! "MAPL.Generic" // name

      type(ComponentSpec)                         :: component_spec

      integer :: counter

   contains

      procedure :: get_user_gc_driver
      procedure :: set_hconfig
      procedure :: get_hconfig
      procedure :: get_geom
      procedure :: get_registry
      procedure :: get_lgr

      procedure :: get_phases

      ! Generic methods
      procedure :: setServices => setservices_

      procedure :: init_meta  ! object

      procedure :: run_custom
      procedure :: initialize_user
      procedure :: initialize_advertise
      procedure :: initialize_modify_advertised
      procedure :: initialize_modify_advertised2
      procedure :: initialize_realize

      procedure :: run_user
      procedure :: run_clock_advance
      procedure :: finalize
      procedure :: read_restart
      procedure :: write_restart

      ! Hierarchy
      procedure, private :: add_child_by_name
      procedure, private :: get_child_by_name
      procedure, private :: run_child_by_name
      procedure, private :: run_children_

      generic :: add_child => add_child_by_name
      generic :: get_child => get_child_by_name
      generic :: run_child => run_child_by_name
      generic :: run_children => run_children_

      procedure :: set_entry_point
      procedure :: set_geom
      procedure :: get_name
      procedure :: get_gridcomp

      procedure :: get_component_spec
      procedure :: get_internal_state

      procedure :: set_vertical_grid
      procedure :: get_vertical_grid

      procedure :: connect_all

   end type OuterMetaComponent

   type OuterMetaWrapper
      type(OuterMetaComponent), pointer :: outer_meta
   end type OuterMetaWrapper


   interface get_outer_meta
      module procedure :: get_outer_meta_from_outer_gc
   end interface get_outer_meta

   character(len=*), parameter :: OUTER_META_PRIVATE_STATE = "MAPL::OuterMetaComponent::private"

   abstract interface
      subroutine I_child_op(this, child_meta, rc)
         import OuterMetaComponent
         class(OuterMetaComponent), target, intent(inout) :: this
         type(OuterMetaComponent), target, intent(inout) :: child_meta
         integer, optional, intent(out) :: rc
      end subroutine I_child_Op
   end interface

   ! Submodule interfaces
   interface

      recursive module subroutine SetServices_(this, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         integer, intent(out) :: rc
      end subroutine

      module recursive subroutine add_child_by_name(this, child_name, setservices, hconfig, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         character(len=*), intent(in) :: child_name
         class(AbstractUserSetServices), intent(in) :: setservices
         type(ESMF_HConfig), intent(in) :: hconfig
         integer, optional, intent(out) :: rc
      end subroutine add_child_by_name

      module function new_outer_meta(gridcomp, user_gc_driver, user_setServices, hconfig) result(outer_meta)
         type(OuterMetaComponent) :: outer_meta
         type(ESMF_GridComp), intent(in) :: gridcomp
         type(GriddedComponentDriver), intent(in) :: user_gc_driver
         class(AbstractUserSetServices), intent(in) :: user_setservices
         type(ESMF_HConfig), intent(in) :: hconfig
      end function new_outer_meta
   
      module subroutine init_meta(this, rc)
         class(OuterMetaComponent), intent(inout) :: this
         integer, optional, intent(out) :: rc
      end subroutine init_meta
   
      module function get_child_by_name(this, child_name, rc) result(child_component)
         type(GriddedComponentDriver) :: child_component
         class(OuterMetaComponent), intent(in) :: this
         character(len=*), intent(in) :: child_name
         integer, optional, intent(out) :: rc
      end function get_child_by_name
   
      module recursive subroutine run_child_by_name(this, child_name, unusable, phase_name, rc)
         class(OuterMetaComponent), intent(inout) :: this
         character(len=*), intent(in) :: child_name
         class(KE), optional, intent(in) :: unusable
         character(len=*), optional, intent(in) :: phase_name
         integer, optional, intent(out) :: rc
      end subroutine run_child_by_name
   
      module recursive subroutine run_children_(this, unusable, phase_name, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         class(KE), optional, intent(in) :: unusable
         character(len=*), optional, intent(in) :: phase_name
         integer, optional, intent(out) :: rc
      end subroutine run_children_
   
      module function get_outer_meta_from_outer_gc(gridcomp, rc) result(outer_meta)
         type(OuterMetaComponent), pointer :: outer_meta
         type(ESMF_GridComp), intent(inout) :: gridcomp
         integer, optional, intent(out) :: rc
      end function get_outer_meta_from_outer_gc
   
      module subroutine attach_outer_meta(gridcomp, rc)
         type(ESMF_GridComp), intent(inout) :: gridcomp
         integer, optional, intent(out) :: rc
      end subroutine attach_outer_meta
   
      module subroutine free_outer_meta(gridcomp, rc)
         type(ESMF_GridComp), intent(inout) :: gridcomp
         integer, optional, intent(out) :: rc
      end subroutine free_outer_meta
   
      module function get_phases(this, method_flag) result(phases)
         type(StringVector), pointer :: phases
         class(OuterMetaComponent), target, intent(inout):: this
         type(ESMF_Method_Flag), intent(in) :: method_flag
      end function get_phases
   
      module subroutine set_hconfig(this, hconfig)
         class(OuterMetaComponent), intent(inout) :: this
         type(ESMF_HConfig), intent(in) :: hconfig
      end subroutine set_hconfig
   
      module function get_hconfig(this) result(hconfig)
         type(ESMF_Hconfig) :: hconfig
         class(OuterMetaComponent), intent(inout) :: this
      end function get_hconfig
   
      module function get_geom(this) result(geom)
         type(ESMF_Geom) :: geom
         class(OuterMetaComponent), intent(inout) :: this
      end function get_geom
   
      module recursive subroutine initialize_advertise(this, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
     end subroutine initialize_advertise
   
     module recursive subroutine initialize_modify_advertised(this, importState, exportState, clock, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         ! optional arguments
         type(ESMF_State) :: importState
         type(ESMF_State) :: exportState
         type(ESMF_Clock) :: clock
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine initialize_modify_advertised
   
     module recursive subroutine initialize_modify_advertised2(this, importState, exportState, clock, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         ! optional arguments
         type(ESMF_State) :: importState
         type(ESMF_State) :: exportState
         type(ESMF_Clock) :: clock
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine initialize_modify_advertised2
   
      module recursive subroutine initialize_realize(this, unusable, rc)
         class(OuterMetaComponent), intent(inout) :: this
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine initialize_realize
   
      module recursive subroutine recurse_(this, phase_idx, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         integer :: phase_idx
         integer, optional, intent(out) :: rc
      end subroutine recurse_
   
      module recursive subroutine recurse_read_restart_(this, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         integer, optional, intent(out) :: rc
      end subroutine recurse_read_restart_

      module recursive subroutine recurse_write_restart_(this, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         integer, optional, intent(out) :: rc
      end subroutine recurse_write_restart_

      module subroutine apply_to_children_custom(this, oper, rc)
         class(OuterMetaComponent), intent(inout) :: this
         procedure(I_child_op) :: oper
         integer, optional, intent(out) :: rc
      end subroutine apply_to_children_custom
   
      module recursive subroutine initialize_user(this, unusable, rc)
         class(OuterMetaComponent), intent(inout) :: this
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine initialize_user
   
      module subroutine run_custom(this, method_flag, phase_name, rc)
         class(OuterMetaComponent), intent(inout) :: this
         type(ESMF_METHOD_FLAG), intent(in) :: method_flag
         character(*), intent(in) :: phase_name
         integer, optional, intent(out) :: rc
      end subroutine run_custom
   
      module recursive subroutine run_user(this, phase_name, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         ! optional arguments
         character(len=*), optional, intent(in) :: phase_name
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine run_user
   
      module recursive subroutine run_clock_advance(this, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine run_clock_advance
   
      module recursive subroutine finalize(this, importState, exportState, clock, unusable, rc)
         class(OuterMetaComponent), intent(inout) :: this
         type(ESMF_State) :: importState
         type(ESMF_State) :: exportState
         type(ESMF_Clock) :: clock
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine finalize
   
      module recursive subroutine read_restart(this, importState, exportState, clock, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         type(ESMF_State) :: importState
         type(ESMF_State) :: exportState
         type(ESMF_Clock) :: clock
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine read_restart
   
      module recursive subroutine write_restart(this, importState, exportState, clock, unusable, rc)
         class(OuterMetaComponent), target, intent(inout) :: this
         type(ESMF_State) :: importState
         type(ESMF_State) :: exportState
         type(ESMF_Clock) :: clock
         ! optional arguments
         class(KE), optional, intent(in) :: unusable
         integer, optional, intent(out) :: rc
      end subroutine write_restart
   
      module function get_name(this, rc) result(name)
         character(:), allocatable :: name
         class(OuterMetaComponent), intent(in) :: this
         integer, optional, intent(out) :: rc
      end function get_name
   
      module function get_gridcomp(this) result(gridcomp)
         type(ESMF_GridComp) :: gridcomp
         class(OuterMetaComponent), intent(in) :: this
      end function get_gridcomp
   
      module subroutine set_geom(this, geom)
         class(OuterMetaComponent), intent(inout) :: this
         type(ESMF_Geom), intent(in) :: geom
      end subroutine set_geom
   
      module subroutine set_vertical_grid(this, vertical_grid)
         class(OuterMetaComponent), intent(inout) :: this
         class(VerticalGrid), intent(in) :: verticaL_grid
      end subroutine set_vertical_grid
    
      module function get_vertical_grid(this) result(vertical_grid)
         class(VerticalGrid), allocatable :: verticaL_grid
         class(OuterMetaComponent), intent(inout) :: this
      end function get_vertical_grid

      module function get_registry(this) result(registry)
         type(StateRegistry), pointer :: registry
         class(OuterMetaComponent), target, intent(in) :: this
      end function get_registry
   
      module function get_component_spec(this) result(component_spec)
         type(ComponentSpec), pointer :: component_spec
         class(OuterMetaComponent), target, intent(in) :: this
      end function get_component_spec
   
      module function get_internal_state(this) result(internal_state)
         type(ESMF_State) :: internal_state
         class(OuterMetaComponent), intent(in) :: this
      end function get_internal_state

      module function get_lgr(this) result(lgr)
         class(Logger), pointer :: lgr
         class(OuterMetaComponent), target, intent(in) :: this
      end function get_lgr
   
      module function get_user_gc_driver(this) result(user_gc_driver)
         type(GriddedComponentDriver), pointer :: user_gc_driver
         class(OuterMetaComponent), target, intent(in) :: this
      end function get_user_gc_driver
   
      module subroutine connect_all(this, src_comp, dst_comp, rc)
         class(OuterMetaComponent), intent(inout) :: this
         character(*), intent(in) :: src_comp
         character(*), intent(in) :: dst_comp
         integer, optional, intent(out) :: rc
      end subroutine connect_all
   
      module subroutine set_entry_point(this, method_flag, userProcedure, unusable, phase_name, rc)
         class(OuterMetaComponent), intent(inout) :: this
         type(ESMF_Method_Flag), intent(in) :: method_flag
         procedure(I_Run) :: userProcedure
         class(KE), optional, intent(in) :: unusable
         character(len=*), optional, intent(in) :: phase_name
         integer, optional, intent(out) ::rc
      end subroutine set_entry_point
   
   end interface

   interface OuterMetaComponent
      module procedure new_outer_meta
   end interface OuterMetaComponent


   interface recurse
      module procedure recurse_
   end interface recurse

   interface recurse_read_restart
      module procedure recurse_read_restart_
   end interface recurse_read_restart

   interface recurse_write_restart
      module procedure recurse_write_restart_
   end interface recurse_write_restart

   interface apply_to_children
      module procedure apply_to_children_custom
   end interface apply_to_children

   integer, save :: counter = 0

end module mapl3g_OuterMetaComponent