From cf60fdb73003ec6ca0f842207e595c3b13e9c3a2 Mon Sep 17 00:00:00 2001 From: Weiyuan Jiang Date: Wed, 13 Nov 2024 15:07:54 -0500 Subject: [PATCH 1/3] check tableEnd efficiently --- CHANGELOG.md | 1 + gridcomps/Cap/MAPL_CapGridComp.F90 | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e9ee90c14f0..dd4571e4279e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- refactored tableEnd check - Added commandline options to `checkpoint_benchmark.x` and `restart_benchmark.x` to allow for easier testing of different configurations. Note that the old configuration file style of input is allowed via the `--config_file` option (which overrides any other command line options) - Update ESMF version for Baselibs to match that of Spack for consistency - Update `components.yaml` diff --git a/gridcomps/Cap/MAPL_CapGridComp.F90 b/gridcomps/Cap/MAPL_CapGridComp.F90 index 2ee0e4dca2fd..5b26d34718b5 100644 --- a/gridcomps/Cap/MAPL_CapGridComp.F90 +++ b/gridcomps/Cap/MAPL_CapGridComp.F90 @@ -979,12 +979,11 @@ function get_vec_from_config(config, key, rc) result(vec) cap_import = "" if (present) then - - do while(trim(cap_import) /= "::") + do while( .true.) call ESMF_ConfigNextLine(config, tableEnd=tableEnd, _RC) if (tableEnd) exit call ESMF_ConfigGetAttribute(config, cap_import, _RC) - if (trim(cap_import) /= "::") call vec%push_back(trim(cap_import)) + call vec%push_back(trim(cap_import)) end do end if _RETURN(_SUCCESS) From 84c6832a5117a1f342f41270825762c486110e91 Mon Sep 17 00:00:00 2001 From: Weiyuan Jiang Date: Thu, 14 Nov 2024 09:34:33 -0500 Subject: [PATCH 2/3] rename cap_import to more generic name --- gridcomps/Cap/MAPL_CapGridComp.F90 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gridcomps/Cap/MAPL_CapGridComp.F90 b/gridcomps/Cap/MAPL_CapGridComp.F90 index 5b26d34718b5..a8bf1f967b62 100644 --- a/gridcomps/Cap/MAPL_CapGridComp.F90 +++ b/gridcomps/Cap/MAPL_CapGridComp.F90 @@ -967,23 +967,22 @@ end function get_CapGridComp_from_gc function get_vec_from_config(config, key, rc) result(vec) + type(StringVector) :: vec type(ESMF_Config), intent(inout) :: config character(len=*), intent(in) :: key integer, intent(out), optional :: rc logical :: present, tableEnd integer :: status - character(len=ESMF_MAXSTR) :: cap_import - type(StringVector) :: vec + character(len=ESMF_MAXSTR) :: value call ESMF_ConfigFindLabel(config, key//":", isPresent = present, _RC) - cap_import = "" if (present) then - do while( .true.) + do while(.true.) call ESMF_ConfigNextLine(config, tableEnd=tableEnd, _RC) if (tableEnd) exit - call ESMF_ConfigGetAttribute(config, cap_import, _RC) - call vec%push_back(trim(cap_import)) + call ESMF_ConfigGetAttribute(config, value, _RC) + call vec%push_back(trim(value)) end do end if _RETURN(_SUCCESS) From ce10328e6f9986c08ba4451b3480f84f712909cd Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Thu, 14 Nov 2024 10:55:23 -0500 Subject: [PATCH 3/3] Update gridcomps/Cap/MAPL_CapGridComp.F90 --- gridcomps/Cap/MAPL_CapGridComp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gridcomps/Cap/MAPL_CapGridComp.F90 b/gridcomps/Cap/MAPL_CapGridComp.F90 index a8bf1f967b62..a868c8bd3914 100644 --- a/gridcomps/Cap/MAPL_CapGridComp.F90 +++ b/gridcomps/Cap/MAPL_CapGridComp.F90 @@ -978,7 +978,7 @@ function get_vec_from_config(config, key, rc) result(vec) call ESMF_ConfigFindLabel(config, key//":", isPresent = present, _RC) if (present) then - do while(.true.) + do call ESMF_ConfigNextLine(config, tableEnd=tableEnd, _RC) if (tableEnd) exit call ESMF_ConfigGetAttribute(config, value, _RC)