From ea51a6b1a137d5a1a56c8ca66432cbf29e3d496e Mon Sep 17 00:00:00 2001 From: JulesKouatchou Date: Thu, 26 Oct 2023 09:38:11 -0400 Subject: [PATCH 1/6] First attempt to implement the code generator example --- docs/tutorial/grid_comps/CMakeLists.txt | 1 + .../grid_comps/code_generator/CMakeLists.txt | 17 +++ .../code_generator/MyComponent_GridComp.F90 | 113 ++++++++++++++++++ .../code_generator/MyComponent_StateSpecs.rc | 56 +++++++++ 4 files changed, 187 insertions(+) create mode 100644 docs/tutorial/grid_comps/code_generator/CMakeLists.txt create mode 100644 docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 create mode 100644 docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc diff --git a/docs/tutorial/grid_comps/CMakeLists.txt b/docs/tutorial/grid_comps/CMakeLists.txt index 2a006d2e4feb..625e4da64130 100644 --- a/docs/tutorial/grid_comps/CMakeLists.txt +++ b/docs/tutorial/grid_comps/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory (leaf_comp_a) add_subdirectory (leaf_comp_b) add_subdirectory (parent_with_one_child) add_subdirectory (parent_with_two_children) +add_subdirectory (code_generator) diff --git a/docs/tutorial/grid_comps/code_generator/CMakeLists.txt b/docs/tutorial/grid_comps/code_generator/CMakeLists.txt new file mode 100644 index 000000000000..11bebc42f441 --- /dev/null +++ b/docs/tutorial/grid_comps/code_generator/CMakeLists.txt @@ -0,0 +1,17 @@ +esma_set_this (OVERRIDE MAPL.mycomponent) +set (srcs + MyComponent_GridComp.F90 + ) + +esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL.shared MAPL TYPE ${MAPL_LIBRARY_TYPE}) +if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG") + target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran) +endif () +target_link_libraries(${this} PRIVATE esmf) +target_include_directories (${this} PUBLIC $) +set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}}) +#target_compile_definitions(${this} PRIVATE SYSTEM_DSO_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}") + +mapl_acg (${this} MyComponent_StateSpecs.rc + IMPORT_SPECS EXPORT_SPECS + GET_POINTERS DECLARE_POINTERS) diff --git a/docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 b/docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 new file mode 100644 index 000000000000..16474c9f90c2 --- /dev/null +++ b/docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 @@ -0,0 +1,113 @@ +#include "MAPL_Generic.h" +#include "MAPL_Exceptions.h" +!------------------------------------------------------------------------------ +!> +!### MODULE: `MyComponent_GridComp` +! +! This module is created to show how to automatically regenerate code segments +! for the registration and access of ESMF states member variables. +! It is not meant to be executed in an application but only to be compiled. +! +module MyComponent_GridComp + + use ESMF + use MAPL + + implicit none + private + + public SetServices + +!------------------------------------------------------------------------------ + contains +!------------------------------------------------------------------------------ +!> +! `SetServices` uses MAPL_GenericSetServices, which sets +! the Initialize and Finalize services to generic versions. +! It also allocates our instance of a generic state and puts it in the +! gridded component (GC). Here we only set the run method and +! declare the data services. +! + subroutine SetServices(GC,rc) + + type(ESMF_GridComp), intent(inout) :: GC !! gridded component + integer, optional :: rc !! return code + + integer :: status + + call MAPL_GridCompSetEntryPoint ( gc, ESMF_METHOD_INITIALIZE, initialize, _RC) + call MAPL_GridCompSetEntryPoint ( gc, ESMF_METHOD_RUN, run, _RC) + +#include "MyComponent_Export___.h" +#include "MyComponent_Import___.h" + +! Set generic services +! ---------------------------------- + call MAPL_GenericSetServices(GC, _RC) + + _RETURN(_SUCCESS) + + end subroutine SetServices + +!------------------------------------------------------------------------------ +!> +! `initialize` is meant to initialize the `MyComponent` gridded component. +! It primarily creates its exports. +! + subroutine initialize(GC, import, export, clock, rc) + + type (ESMF_GridComp), intent(inout) :: GC !! Gridded component + type (ESMF_State), intent(inout) :: import !! Import state + type (ESMF_State), intent(inout) :: export !! Export state + type (ESMF_Clock), intent(inout) :: clock !! The clock + integer, optional, intent( out) :: RC !! Error code +! +! Locals + integer :: status + + call MAPL_GridCreate(GC, _RC) + +! Call Generic Initialize +! ---------------------------------------- + call MAPL_GenericInitialize(GC, import, export, clock, _RC) + + _RETURN(_SUCCESS) + + end subroutine initialize + +!------------------------------------------------------------------------------ +!> +! `run` is the Run method for `MyComponent`. +! + subroutine run(GC, import, export, clock, rc) + + type (ESMF_GridComp), intent(inout) :: GC !! Gridded component + type (ESMF_State), intent(inout) :: import !! Import state + type (ESMF_State), intent(inout) :: export !! Export state + type (ESMF_Clock), intent(inout) :: clock !! The clock + integer, optional, intent( out) :: RC !! Error code +! +! Locals + type (MAPL_MetaComp), pointer :: MAPL + integer :: status + +#include "MyComponent_DeclarePointer___.h" + +!**************************************************************************** +! Begin... + + ! Get my internal MAPL_Generic state + ! ----------------------------------- + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) + +#include "MyComponent_GetPointer___.h" + + + _RETURN(_SUCCESS) + + _UNUSED_DUMMY(import) + _UNUSED_DUMMY(clock) + + end subroutine run + +end module MyComponent_GridComp diff --git a/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc b/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc new file mode 100644 index 000000000000..7a66a3f3d929 --- /dev/null +++ b/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc @@ -0,0 +1,56 @@ +component: MyComponent + +category: IMPORT +#---------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#---------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | RESTART | LONG NAME +#---------------------------------------------------------------------------- + ZLE | m | xyz | E | | geopotential_height + T | K | xyz | C | OPT | air_temperature + PLE | Pa | xyz | E | OPT | air_pressure + +category: EXPORT +#--------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#--------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | LONG NAME +#--------------------------------------------------------------------------- + ZPBLCN | m | xy | N | boundary_layer_depth + CNV_FRC | | xy | N | convective_fraction + +category: INTERNAL +#--------------------------------------------------------------------------- +# VARIABLE | DIMENSION | Additional Metadata +#--------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | ADD2EXPORT | FRIENDLYTO | LONG NAME +#--------------------------------------------------------------------------- + + +#******************************************************** +# +# Legend +# +#------------------------------------------------------------------ +# Column label | MAPL keyword/interpretation | Default +#--------------|--------------------------------------------------- +# NAME | short_name | +# UNITS | units | +# DIMS | dims | +# VLOC | VLocation | MAPL_VLocationNone +# LONG NAME | long_name | +# COND | if () then | .FALSE. +# NUM_SUBTILES | num_subtiles +# ... +#------------------------------------------------------------------ +# +#-------------------------------------------- +# Entry alias | Column | MAPL keyword/interpretation +#--------------|----------------------------- +# xyz | DIMS | MAPL_HorzVert +# xy | DIMS | MAPL_HorzOnly +# z | DIMS | MAPL_VertOnly (plus ungridded) +# C | VLOC | MAPL_VlocationCenter +# E | VLOC | MAPL_VlocationEdge +# N | VLOC | MAPL_VlocationNone +#-------------------------------------------- From b97dffe49f0b73d95dc3307056085f60855cfad3 Mon Sep 17 00:00:00 2001 From: Jules Kouatchou Date: Thu, 26 Oct 2023 11:59:07 -0400 Subject: [PATCH 2/6] Add include statement for mapl_acg --- .../grid_comps/code_generator/CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/grid_comps/code_generator/CMakeLists.txt b/docs/tutorial/grid_comps/code_generator/CMakeLists.txt index 11bebc42f441..d71c65df8caf 100644 --- a/docs/tutorial/grid_comps/code_generator/CMakeLists.txt +++ b/docs/tutorial/grid_comps/code_generator/CMakeLists.txt @@ -1,17 +1,25 @@ esma_set_this (OVERRIDE MAPL.mycomponent) + set (srcs MyComponent_GridComp.F90 ) esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL.shared MAPL TYPE ${MAPL_LIBRARY_TYPE}) -if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG") - target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran) -endif () + target_link_libraries(${this} PRIVATE esmf) + target_include_directories (${this} PUBLIC $) + set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}}) + #target_compile_definitions(${this} PRIVATE SYSTEM_DSO_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}") +include(mapl_acg) + mapl_acg (${this} MyComponent_StateSpecs.rc IMPORT_SPECS EXPORT_SPECS GET_POINTERS DECLARE_POINTERS) + +if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG") + target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran) +endif () From 6011668f60c3183b98a1edd1d33b2bea8dd1a099 Mon Sep 17 00:00:00 2001 From: Jules Kouatchou Date: Thu, 26 Oct 2023 18:38:39 -0400 Subject: [PATCH 3/6] Edit the code generator sample code (that now works) and update the documentation. --- .../code_generator/MyComponent_StateSpecs.rc | 9 +++++---- docs/user_guide/docs/mapl_code_generator.md | 20 +++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc b/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc index 7a66a3f3d929..7c8ad45207eb 100644 --- a/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc +++ b/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc @@ -1,3 +1,4 @@ +schema_version: 2.0.0 component: MyComponent category: IMPORT @@ -12,12 +13,12 @@ category: IMPORT category: EXPORT #--------------------------------------------------------------------------- -# VARIABLE | DIMENSIONS | Additional Metadata +# VARIABLE | DIMENSIONS | Additional Metadata #--------------------------------------------------------------------------- - NAME | UNITS | DIMS | VLOC | LONG NAME + NAME | UNITS | DIMS | VLOC | LONG NAME #--------------------------------------------------------------------------- - ZPBLCN | m | xy | N | boundary_layer_depth - CNV_FRC | | xy | N | convective_fraction + ZPBLCN | m | xy | N | boundary_layer_depth + CNV_FRC | 1 | xy | N | convective_fraction category: INTERNAL #--------------------------------------------------------------------------- diff --git a/docs/user_guide/docs/mapl_code_generator.md b/docs/user_guide/docs/mapl_code_generator.md index d832986e37c4..c2f7597246cf 100644 --- a/docs/user_guide/docs/mapl_code_generator.md +++ b/docs/user_guide/docs/mapl_code_generator.md @@ -7,7 +7,7 @@ The number of the those variables can be large and make the declaration process MAPL has a utility tool (named [MAPL_GridCompSpecs_ACG.py ](https://github.com/GEOS-ESM/MAPL/blob/main/Apps/MAPL_GridCompSpecs_ACG.py)) that simplifies and facilitates the registration and access of member variables of the various states (Export, Import, and Internal) of gridded components. -The tool relies on a formatted ASCII file (`spec`` file) to autmatically generate, at compilation time, include files that have the necessary code segments for defining and accessing the expected state member variables. +The tool relies on a formatted ASCII file (`spec` file) to autmatically generate, at compilation time, include files that have the necessary code segments for defining and accessing the expected state member variables. In this document, we describe the [steps](https://github.com/GEOS-ESM/MAPL/wiki/Setting-Up-MAPL-Automatic-Code-Generator) to follow to use the tool. To simplify this documents, we use the words _Imports_, _Exports_ and _Internals_ to refer to member variables of the Import, Export and Internal states, respectively. @@ -138,6 +138,7 @@ Assume that we create such a file (that we name `MyComponent_StateSpecs.rc`) and ``` +schema_version: 2.0.0 component: MyComponent category: IMPORT @@ -196,7 +197,12 @@ category: INTERNAL #-------------------------------------------- ``` -Running `MAPL_GridCompSpecs_ACG.py` on the file `MyComponent_StateSpecs.rc` generates at compilation time four (4) includes files: +#### Remark +It is required to have the settings for the two variable `schema_version` (here `2.0.0`) +and `component` (here `MyComponent`) on top of the `spec` file. + + +Running `MAPL_GridCompSpecs_ACG.py` on the file `MyComponent_StateSpecs.rc` generates at compilation time four (4) include files: 1. `MyComponent_Export___.h` for the `MAPL_AddExportSpec` calls in the `SetServices` routine: @@ -307,6 +313,16 @@ mapl_acg (${this} MyComponent_StateSpecs.rc Note, if in your case, there is no Internal state, `INTERNAL_SPECS` needs not to be added in the above command. But there is no harm including it. +### Sample code +We provide a sample code (gridded component module, `spec` and `CMakeLists.txt` files) that shows +how the automatic code generator is used. The code is available at: + +``` + docs/tutorial/grid_comps/code_generator +``` + +The code is provided for illustration only and compiled with the entire MAPL package. + ### Future Work A future version of the tool will support a YAML specification file. From f3fe7dc23f1534d3616cb9d8f9f8f77393611f30 Mon Sep 17 00:00:00 2001 From: Jules Kouatchou Date: Fri, 27 Oct 2023 11:19:09 -0400 Subject: [PATCH 4/6] Change directory and file names --- CHANGELOG.md | 6 ++++++ docs/tutorial/grid_comps/CMakeLists.txt | 2 +- .../ACG_GridComp.F90} | 18 +++++++++--------- .../ACG_StateSpecs.rc} | 2 +- .../CMakeLists.txt | 6 +++--- docs/user_guide/docs/mapl_code_generator.md | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) rename docs/tutorial/grid_comps/{code_generator/MyComponent_GridComp.F90 => automatic_code_generator/ACG_GridComp.F90} (89%) rename docs/tutorial/grid_comps/{code_generator/MyComponent_StateSpecs.rc => automatic_code_generator/ACG_StateSpecs.rc} (99%) rename docs/tutorial/grid_comps/{code_generator => automatic_code_generator}/CMakeLists.txt (84%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d6acaf84bf..f63b86bde598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +## 2023-10-27 + +### Added + +- New directory (`docs/tutorial/grid_comps/automatic_code_generator`) containing an example showing how to automatically generate the source code using the `MAPL_GridCompSpecs_ACG.py` tool. + ## [2.41.1] - 2023-10-04 ### Fixed diff --git a/docs/tutorial/grid_comps/CMakeLists.txt b/docs/tutorial/grid_comps/CMakeLists.txt index 625e4da64130..5b924389c697 100644 --- a/docs/tutorial/grid_comps/CMakeLists.txt +++ b/docs/tutorial/grid_comps/CMakeLists.txt @@ -4,4 +4,4 @@ add_subdirectory (leaf_comp_a) add_subdirectory (leaf_comp_b) add_subdirectory (parent_with_one_child) add_subdirectory (parent_with_two_children) -add_subdirectory (code_generator) +add_subdirectory (automatic_code_generator) diff --git a/docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 b/docs/tutorial/grid_comps/automatic_code_generator/ACG_GridComp.F90 similarity index 89% rename from docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 rename to docs/tutorial/grid_comps/automatic_code_generator/ACG_GridComp.F90 index 16474c9f90c2..c3eed7ab9585 100644 --- a/docs/tutorial/grid_comps/code_generator/MyComponent_GridComp.F90 +++ b/docs/tutorial/grid_comps/automatic_code_generator/ACG_GridComp.F90 @@ -2,13 +2,13 @@ #include "MAPL_Exceptions.h" !------------------------------------------------------------------------------ !> -!### MODULE: `MyComponent_GridComp` +!### MODULE: `ACG_GridComp` ! ! This module is created to show how to automatically regenerate code segments ! for the registration and access of ESMF states member variables. ! It is not meant to be executed in an application but only to be compiled. ! -module MyComponent_GridComp +module ACG_GridComp use ESMF use MAPL @@ -38,8 +38,8 @@ subroutine SetServices(GC,rc) call MAPL_GridCompSetEntryPoint ( gc, ESMF_METHOD_INITIALIZE, initialize, _RC) call MAPL_GridCompSetEntryPoint ( gc, ESMF_METHOD_RUN, run, _RC) -#include "MyComponent_Export___.h" -#include "MyComponent_Import___.h" +#include "ACG_Export___.h" +#include "ACG_Import___.h" ! Set generic services ! ---------------------------------- @@ -51,7 +51,7 @@ end subroutine SetServices !------------------------------------------------------------------------------ !> -! `initialize` is meant to initialize the `MyComponent` gridded component. +! `initialize` is meant to initialize the `ACG` gridded component. ! It primarily creates its exports. ! subroutine initialize(GC, import, export, clock, rc) @@ -77,7 +77,7 @@ end subroutine initialize !------------------------------------------------------------------------------ !> -! `run` is the Run method for `MyComponent`. +! `run` is the Run method for `ACG`. ! subroutine run(GC, import, export, clock, rc) @@ -91,7 +91,7 @@ subroutine run(GC, import, export, clock, rc) type (MAPL_MetaComp), pointer :: MAPL integer :: status -#include "MyComponent_DeclarePointer___.h" +#include "ACG_DeclarePointer___.h" !**************************************************************************** ! Begin... @@ -100,7 +100,7 @@ subroutine run(GC, import, export, clock, rc) ! ----------------------------------- call MAPL_GetObjectFromGC ( GC, MAPL, _RC) -#include "MyComponent_GetPointer___.h" +#include "ACG_GetPointer___.h" _RETURN(_SUCCESS) @@ -110,4 +110,4 @@ subroutine run(GC, import, export, clock, rc) end subroutine run -end module MyComponent_GridComp +end module ACG_GridComp diff --git a/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc b/docs/tutorial/grid_comps/automatic_code_generator/ACG_StateSpecs.rc similarity index 99% rename from docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc rename to docs/tutorial/grid_comps/automatic_code_generator/ACG_StateSpecs.rc index 7c8ad45207eb..386d1f122034 100644 --- a/docs/tutorial/grid_comps/code_generator/MyComponent_StateSpecs.rc +++ b/docs/tutorial/grid_comps/automatic_code_generator/ACG_StateSpecs.rc @@ -1,5 +1,5 @@ schema_version: 2.0.0 -component: MyComponent +component: ACG category: IMPORT #---------------------------------------------------------------------------- diff --git a/docs/tutorial/grid_comps/code_generator/CMakeLists.txt b/docs/tutorial/grid_comps/automatic_code_generator/CMakeLists.txt similarity index 84% rename from docs/tutorial/grid_comps/code_generator/CMakeLists.txt rename to docs/tutorial/grid_comps/automatic_code_generator/CMakeLists.txt index d71c65df8caf..7f34d0752d6d 100644 --- a/docs/tutorial/grid_comps/code_generator/CMakeLists.txt +++ b/docs/tutorial/grid_comps/automatic_code_generator/CMakeLists.txt @@ -1,7 +1,7 @@ -esma_set_this (OVERRIDE MAPL.mycomponent) +esma_set_this (OVERRIDE MAPL.acg) set (srcs - MyComponent_GridComp.F90 + ACG_GridComp.F90 ) esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL.shared MAPL TYPE ${MAPL_LIBRARY_TYPE}) @@ -16,7 +16,7 @@ set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${t include(mapl_acg) -mapl_acg (${this} MyComponent_StateSpecs.rc +mapl_acg (${this} ACG_StateSpecs.rc IMPORT_SPECS EXPORT_SPECS GET_POINTERS DECLARE_POINTERS) diff --git a/docs/user_guide/docs/mapl_code_generator.md b/docs/user_guide/docs/mapl_code_generator.md index c2f7597246cf..ad8f63a9f334 100644 --- a/docs/user_guide/docs/mapl_code_generator.md +++ b/docs/user_guide/docs/mapl_code_generator.md @@ -318,7 +318,7 @@ We provide a sample code (gridded component module, `spec` and `CMakeLists.txt` how the automatic code generator is used. The code is available at: ``` - docs/tutorial/grid_comps/code_generator + docs/tutorial/grid_comps/automatic_code_generator ``` The code is provided for illustration only and compiled with the entire MAPL package. From 81b2cb6d95016122a3383266988e44f02d6c4c42 Mon Sep 17 00:00:00 2001 From: Jules Kouatchou Date: Fri, 27 Oct 2023 13:06:36 -0400 Subject: [PATCH 5/6] New directory name --- docs/tutorial/grid_comps/CMakeLists.txt | 2 +- .../ACG_GridComp.F90 | 0 .../ACG_StateSpecs.rc | 0 .../CMakeLists.txt | 0 docs/user_guide/docs/mapl_code_generator.md | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename docs/tutorial/grid_comps/{automatic_code_generator => automatic_code_generator_example}/ACG_GridComp.F90 (100%) rename docs/tutorial/grid_comps/{automatic_code_generator => automatic_code_generator_example}/ACG_StateSpecs.rc (100%) rename docs/tutorial/grid_comps/{automatic_code_generator => automatic_code_generator_example}/CMakeLists.txt (100%) diff --git a/docs/tutorial/grid_comps/CMakeLists.txt b/docs/tutorial/grid_comps/CMakeLists.txt index 5b924389c697..9cdb243357f7 100644 --- a/docs/tutorial/grid_comps/CMakeLists.txt +++ b/docs/tutorial/grid_comps/CMakeLists.txt @@ -4,4 +4,4 @@ add_subdirectory (leaf_comp_a) add_subdirectory (leaf_comp_b) add_subdirectory (parent_with_one_child) add_subdirectory (parent_with_two_children) -add_subdirectory (automatic_code_generator) +add_subdirectory (automatic_code_generator_example) diff --git a/docs/tutorial/grid_comps/automatic_code_generator/ACG_GridComp.F90 b/docs/tutorial/grid_comps/automatic_code_generator_example/ACG_GridComp.F90 similarity index 100% rename from docs/tutorial/grid_comps/automatic_code_generator/ACG_GridComp.F90 rename to docs/tutorial/grid_comps/automatic_code_generator_example/ACG_GridComp.F90 diff --git a/docs/tutorial/grid_comps/automatic_code_generator/ACG_StateSpecs.rc b/docs/tutorial/grid_comps/automatic_code_generator_example/ACG_StateSpecs.rc similarity index 100% rename from docs/tutorial/grid_comps/automatic_code_generator/ACG_StateSpecs.rc rename to docs/tutorial/grid_comps/automatic_code_generator_example/ACG_StateSpecs.rc diff --git a/docs/tutorial/grid_comps/automatic_code_generator/CMakeLists.txt b/docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt similarity index 100% rename from docs/tutorial/grid_comps/automatic_code_generator/CMakeLists.txt rename to docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt diff --git a/docs/user_guide/docs/mapl_code_generator.md b/docs/user_guide/docs/mapl_code_generator.md index ad8f63a9f334..fd3766fb614a 100644 --- a/docs/user_guide/docs/mapl_code_generator.md +++ b/docs/user_guide/docs/mapl_code_generator.md @@ -318,7 +318,7 @@ We provide a sample code (gridded component module, `spec` and `CMakeLists.txt` how the automatic code generator is used. The code is available at: ``` - docs/tutorial/grid_comps/automatic_code_generator + docs/tutorial/grid_comps/automatic_code_generator_example ``` The code is provided for illustration only and compiled with the entire MAPL package. From b0d4acab3063fb320cf7c73691170d52de3fa824 Mon Sep 17 00:00:00 2001 From: Jules Kouatchou Date: Mon, 30 Oct 2023 11:32:47 -0400 Subject: [PATCH 6/6] Reorganize sections of the root CMakeLists.txt to faciliate the use of the automatic code generator tool --- CMakeLists.txt | 10 +++++----- .../automatic_code_generator_example/CMakeLists.txt | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6d540e9b33e..ea3eb9110d46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,11 @@ endif () add_definitions(-Dsys${CMAKE_SYSTEM_NAME}) +# Support for automated code generation +include(mapl_acg) +include(mapl_create_stub_component) +add_subdirectory (Apps) + # Special case - MAPL_cfio is built twice with two different precisions. add_subdirectory (MAPL_cfio MAPL_cfio_r4) add_subdirectory (MAPL_cfio MAPL_cfio_r8) @@ -232,11 +237,6 @@ if (PFUNIT_FOUND) add_subdirectory (pfunit EXCLUDE_FROM_ALL) endif () -# Support for automated code generation -include(mapl_acg) -include(mapl_create_stub_component) -add_subdirectory (Apps) - add_subdirectory (Tests) # @env will exist here if MAPL is built as itself but not as part of, say, GEOSgcm diff --git a/docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt b/docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt index 7f34d0752d6d..4ae20760f332 100644 --- a/docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt +++ b/docs/tutorial/grid_comps/automatic_code_generator_example/CMakeLists.txt @@ -12,10 +12,6 @@ target_include_directories (${this} PUBLIC $