Skip to content

Commit

Permalink
Convert internal procedures in OuterMetaComponent.F90 into submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesKouatchou committed May 23, 2024
1 parent a612ba4 commit 7a4eeeb
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 31 deletions.
58 changes: 30 additions & 28 deletions generic3g/OuterMetaComponent.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module mapl3g_OuterMetaComponent
use mapl3g_geom_mgr
use mapl3g_UserSetServices
!use mapl3g_UserSetServices, only: AbstractUserSetServices
use mapl3g_UserSetServices, only: AbstractUserSetServices
use mapl3g_VariableSpec
use mapl3g_StateItem
use mapl3g_MultiState
Expand Down Expand Up @@ -137,36 +137,14 @@ module mapl3g_OuterMetaComponent
character(len=*), parameter :: OUTER_META_PRIVATE_STATE = "MAPL::OuterMetaComponent::private"


interface OuterMetaComponent
module procedure new_outer_meta
end interface OuterMetaComponent

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

interface recurse
module procedure recurse_
end interface recurse

interface apply_to_children
module procedure apply_to_children_custom
end interface apply_to_children

integer, save :: counter = 0

! Submodule interfaces
interface

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

module recursive subroutine add_child_by_name(this, child_name, setservices, hconfig, rc)
class(OuterMetaComponent), intent(inout) :: this
Expand Down Expand Up @@ -285,7 +263,7 @@ module recursive subroutine initialize_realize(this, unusable, rc)
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
Expand Down Expand Up @@ -377,18 +355,18 @@ module subroutine set_vertical_geom(this, vertical_geom)
class(OuterMetaComponent), intent(inout) :: this
type(VerticalGeom), intent(in) :: verticaL_geom
end subroutine set_vertical_geom

module function get_registry(this) result(registry)
type(HierarchicalRegistry), 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)
module function get_internal_state(this) result(internal_state)
type(ESMF_State) :: internal_state
class(OuterMetaComponent), intent(in) :: this
end function get_internal_state
Expand Down Expand Up @@ -421,4 +399,28 @@ end subroutine set_entry_point

end interface

interface OuterMetaComponent
module procedure new_outer_meta
end interface OuterMetaComponent


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

interface recurse
module procedure recurse_
end interface recurse

interface apply_to_children
module procedure apply_to_children_custom
end interface apply_to_children

integer, save :: counter = 0

end module mapl3g_OuterMetaComponent
6 changes: 6 additions & 0 deletions generic3g/OuterMetaComponent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,41 @@ target_sources(MAPL.generic3g PRIVATE
add_child_by_name.F90
new_outer_meta.F90
init_meta.F90

get_child_by_name.F90
run_child_by_name.F90
run_children.F90
get_outer_meta_from_outer_gc.F90
attach_outer_meta.F90
free_outer_meta.F90

get_phases.F90
set_hconfig.F90
get_hconfig.F90
get_geom.F90

initialize_advertise_geom.F90
initialize_realize_geom.F90
initialize_advertise.F90
initialize_post_advertise.F90
initialize_realize.F90

recurse.F90
apply_to_children_custom.F90
initialize_user.F90
run_custom.F90
run_user.F90
run_clock_advance.F90
finalize.F90

read_restart.F90
write_restart.F90
get_name.F90
get_gridcomp.F90
set_geom.F90
set_vertical_geom.F90
get_registry.F90

get_component_spec.F90
get_internal_state.F90
get_lgr.F90
Expand Down
2 changes: 2 additions & 0 deletions generic3g/OuterMetaComponent/get_phases.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "MAPL_Generic.h"

submodule (mapl3g_OuterMetaComponent) get_phases_smod
use :: esmf, only: ESMF_Method_Flag
use :: gFTL2_StringVector, only: StringVector
implicit none

contains
Expand Down
3 changes: 0 additions & 3 deletions generic3g/OuterMetaComponent/initialize_post_advertise.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ module recursive subroutine initialize_post_advertise(this, importState, exportS
user_states = this%user_gc_driver%get_states()
call this%registry%add_to_states(user_states, mode='user', _RC)

user_states = this%user_gc_driver%get_states()
call this%registry%add_to_states(user_states, mode='user', _RC)

outer_states = MultiState(importState=importState, exportState=exportState)
call this%registry%add_to_states(outer_states, mode='outer', _RC)

Expand Down

0 comments on commit 7a4eeeb

Please sign in to comment.