Skip to content

Commit

Permalink
Merge pull request #2839 from GEOS-ESM/MAPL-v3/smods/generic3g/v3_2
Browse files Browse the repository at this point in the history
Complete the creation of submodules for GriddedComponentDriver.F90
  • Loading branch information
tclune authored May 22, 2024
2 parents 44dfddf + 19d70cb commit 9f92718
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 45 deletions.
70 changes: 25 additions & 45 deletions generic3g/GriddedComponentDriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -103,55 +103,35 @@ module subroutine clock_advance(this, rc)
integer, optional, intent(out) :: rc
end subroutine clock_advance

end interface

contains

function new_GriddedComponentDriver(gridcomp, clock, states) result(child)
type(GriddedComponentDriver) :: child
type(ESMF_GridComp), intent(in) :: gridcomp
type(ESMF_Clock), intent(in) :: clock
type(MultiState), intent(in) :: states

child%gridcomp = gridcomp
child%clock = clock
child%states = states

end function new_GriddedComponentDriver


function get_gridcomp(this) result(gridcomp)
use esmf, only: ESMF_GridComp
type(ESMF_GridComp) :: gridcomp
class(GriddedComponentDriver), intent(in) :: this
gridcomp = this%gridcomp
end function get_gridcomp

function get_name(this, rc) result(name)
character(:), allocatable :: name
class(GriddedComponentDriver), intent(in) :: this
integer, optional, intent(out) :: rc

integer :: status
character(len=ESMF_MAXSTR) :: buffer
module function new_GriddedComponentDriver(gridcomp, clock, states) result(child)
type(GriddedComponentDriver) :: child
type(ESMF_GridComp), intent(in) :: gridcomp
type(ESMF_Clock), intent(in) :: clock
type(MultiState), intent(in) :: states
end function new_GriddedComponentDriver

call ESMF_GridCompGet(this%gridcomp, name=buffer, _RC)
name = trim(buffer)
module function get_gridcomp(this) result(gridcomp)
use esmf, only: ESMF_GridComp
type(ESMF_GridComp) :: gridcomp
class(GriddedComponentDriver), intent(in) :: this
end function get_gridcomp

_RETURN(ESMF_SUCCESS)
end function get_name
module function get_name(this, rc) result(name)
character(:), allocatable :: name
class(GriddedComponentDriver), intent(in) :: this
integer, optional, intent(out) :: rc
end function get_name

subroutine add_export_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
call this%export_couplers%push_back(driver)
end subroutine add_export_coupler
module subroutine add_export_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
end subroutine add_export_coupler

subroutine add_import_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
call this%import_couplers%push_back(driver)
end subroutine add_import_coupler
module subroutine add_import_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
end subroutine add_import_coupler

end interface

end module mapl3g_GriddedComponentDriver
5 changes: 5 additions & 0 deletions generic3g/GriddedComponentDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ target_sources(MAPL.generic3g PRIVATE
run_export_couplers.F90
run_import_couplers.F90
clock_advance.F90
new_GriddedComponentDriver.F90
get_gridcomp.F90
get_name.F90
add_export_coupler.F90
add_import_coupler.F90

)
14 changes: 14 additions & 0 deletions generic3g/GriddedComponentDriver/add_export_coupler.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "MAPL_Generic.h"

submodule (mapl3g_GriddedComponentDriver) add_export_coupler_smod
implicit none

contains

module subroutine add_export_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
call this%export_couplers%push_back(driver)
end subroutine add_export_coupler

end submodule add_export_coupler_smod
15 changes: 15 additions & 0 deletions generic3g/GriddedComponentDriver/add_import_coupler.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "MAPL_Generic.h"

submodule (mapl3g_GriddedComponentDriver) add_import_coupler_smod
implicit none

contains

module subroutine add_import_coupler(this, driver)
class(GriddedComponentDriver), intent(inout) :: this
type(GriddedComponentDriver), intent(in) :: driver
call this%import_couplers%push_back(driver)
end subroutine add_import_coupler


end submodule add_import_coupler_smod
15 changes: 15 additions & 0 deletions generic3g/GriddedComponentDriver/get_gridcomp.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "MAPL_Generic.h"

submodule (mapl3g_GriddedComponentDriver) get_gridcomp_smod
implicit none

contains

module function get_gridcomp(this) result(gridcomp)
use esmf, only: ESMF_GridComp
type(ESMF_GridComp) :: gridcomp
class(GriddedComponentDriver), intent(in) :: this
gridcomp = this%gridcomp
end function get_gridcomp

end submodule get_gridcomp_smod
22 changes: 22 additions & 0 deletions generic3g/GriddedComponentDriver/get_name.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "MAPL_Generic.h"

submodule (mapl3g_GriddedComponentDriver) get_name_smod
implicit none

contains

module function get_name(this, rc) result(name)
character(:), allocatable :: name
class(GriddedComponentDriver), intent(in) :: this
integer, optional, intent(out) :: rc

integer :: status
character(len=ESMF_MAXSTR) :: buffer

call ESMF_GridCompGet(this%gridcomp, name=buffer, _RC)
name = trim(buffer)

_RETURN(ESMF_SUCCESS)
end function get_name

end submodule get_name_smod
20 changes: 20 additions & 0 deletions generic3g/GriddedComponentDriver/new_GriddedComponentDriver.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "MAPL_Generic.h"

submodule (mapl3g_GriddedComponentDriver) new_GriddedComponentDriver_smod
implicit none

contains

module function new_GriddedComponentDriver(gridcomp, clock, states) result(child)
type(GriddedComponentDriver) :: child
type(ESMF_GridComp), intent(in) :: gridcomp
type(ESMF_Clock), intent(in) :: clock
type(MultiState), intent(in) :: states

child%gridcomp = gridcomp
child%clock = clock
child%states = states

end function new_GriddedComponentDriver

end submodule new_GriddedComponentDriver_smod

0 comments on commit 9f92718

Please sign in to comment.