Skip to content

Commit f957603

Browse files
committed
Revert "Convert bundling to bool"
This reverts commit 6237c87. Adds back the enum for bundling
1 parent 6bd2c91 commit f957603

File tree

8 files changed

+32
-25
lines changed

8 files changed

+32
-25
lines changed

components/eamxx/src/dynamics/homme/eamxx_homme_process_interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void HommeDynamics::set_grids (const std::shared_ptr<const GridsManager> grids_m
180180
add_field<Computed>("omega", pg_scalar3d_mid, Pa/s, pgn,N);
181181

182182
add_tracer<Updated >("qv", m_phys_grid, kg/kg, N);
183-
add_group<Updated>("tracers",pgn,N, true);
183+
add_group<Updated>("tracers",pgn,N, Bundling::Required);
184184

185185
if (fv_phys_active()) {
186186
// [CGLL ICs in pg2] Read CGLL IC data even though our in/out format is
@@ -196,7 +196,7 @@ void HommeDynamics::set_grids (const std::shared_ptr<const GridsManager> grids_m
196196
add_field<Required>("T_mid", rg_scalar3d_mid,K, rgn,N);
197197
add_field<Required>("ps", rg_scalar2d ,Pa, rgn);
198198
add_field<Required>("phis", rg_scalar2d ,m2/s2, rgn);
199-
add_group<Required>("tracers",rgn,N, true);
199+
add_group<Required>("tracers",rgn,N, Bundling::Required);
200200
fv_phys_rrtmgp_active_gases_init(grids_manager);
201201
// This is needed for the dp_ref init in initialize_homme_state.
202202
add_field<Computed>("pseudo_density",rg_scalar3d_mid,Pa, rgn,N);

components/eamxx/src/physics/iop_forcing/eamxx_iop_forcing_process_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void IOPForcing::set_grids(const std::shared_ptr<const GridsManager> grids_manag
2929
add_field<Updated>("T_mid", scalar3d_mid, K, grid_name, pack_size);
3030

3131
add_tracer<Updated>("qv", m_grid, kg/kg, pack_size);
32-
add_group<Updated>("tracers", grid_name, pack_size, true);
32+
add_group<Updated>("tracers", grid_name, pack_size, Bundling::Required);
3333

3434
// Sanity check that iop data manager is setup by driver
3535
EKAT_REQUIRE_MSG(m_iop_data_manager,

components/eamxx/src/physics/ml_correction/eamxx_ml_correction_process_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void MLCorrection::set_grids(
6767
add_field<Updated>("precip_ice_surf_mass", scalar2d, kg/m2, grid_name);
6868
/* ----------------------- WARNING --------------------------------*/
6969
add_tracer<Updated>("qv", m_grid, kg/kg, ps);
70-
add_group<Updated>("tracers", grid_name, 1, true);
70+
add_group<Updated>("tracers", grid_name, 1, Bundling::Required);
7171
}
7272

7373
// =========================================================================================

components/eamxx/src/physics/shoc/eamxx_shoc_process_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void SHOCMacrophysics::set_grids(const std::shared_ptr<const GridsManager> grids
111111
} // Extra SHOC output diagnostics
112112

113113
// Tracer group
114-
add_group<Updated>("turbulence_advected_tracers", grid_name, ps, true);
114+
add_group<Updated>("turbulence_advected_tracers", grid_name, ps, Bundling::Required);
115115

116116
// Boundary flux fields for energy and mass conservation checks
117117
if (has_column_conservation_check()) {

components/eamxx/src/share/atm_process/atmosphere_process.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,13 @@ class AtmosphereProcess : public ekat::enable_shared_from_this<AtmosphereProcess
369369
// Group requests
370370
template<RequestType RT>
371371
void add_group (const std::string& name, const std::string& grid_name,
372-
const bool bundled = false)
373-
{ add_group<RT> (GroupRequest(name,grid_name,bundled)); }
372+
const Bundling b = Bundling::NotNeeded)
373+
{ add_group<RT> (GroupRequest(name,grid_name,b)); }
374374

375375
template<RequestType RT>
376376
void add_group (const std::string& name, const std::string& grid_name,
377-
const int pack_size, const bool bundled = false)
378-
{ add_group<RT> (GroupRequest(name,grid_name,pack_size,bundled)); }
377+
const int pack_size, const Bundling b = Bundling::NotNeeded)
378+
{ add_group<RT> (GroupRequest(name,grid_name,pack_size,b)); }
379379

380380
template<RequestType RT>
381381
void add_field (const FieldRequest& req)

components/eamxx/src/share/field/field_manager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ void FieldManager::register_group (const GroupRequest& req)
120120
auto& group_info = m_field_group_info[req.name];
121121
if (not group_info) {
122122
group_info = std::make_shared<FieldGroupInfo>(req.name);
123-
group_info->m_bundled = (req.bundled);
123+
group_info->m_bundled = (req.bundling==Bundling::Required);
124124
} else if (not group_info->m_bundled) {
125-
group_info->m_bundled = (req.bundled);
125+
group_info->m_bundled = (req.bundling==Bundling::Required);
126126
}
127127

128128
if (not ekat::contains(group_info->m_requested_grids, req.grid)) {
@@ -409,7 +409,7 @@ void FieldManager::registration_ends ()
409409
for (auto& grid_it : m_grids_mgr->get_repo()) {
410410
for (const auto& greqs : m_group_requests.at(grid_it.second->name())) {
411411
for (const auto& r : greqs.second) {
412-
if (r.bundled) {
412+
if (r.bundling==Bundling::Required) {
413413
// There's at least one request for this group to be bundled.
414414
groups_to_bundle.push_back(greqs.first);
415415
break;

components/eamxx/src/share/field/field_request.hpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ enum RequestType {
1313
Updated // For convenience, triggers Required+Computed
1414
};
1515

16+
// Whether the bundling of a field group (see below) is needed, optional, or not needed.
17+
enum class Bundling : int {
18+
Required,
19+
NotNeeded
20+
};
21+
1622
/*
1723
* A struct used to request a group of fields.
1824
*
@@ -34,26 +40,26 @@ struct GroupRequest {
3440
// - grid: the grid where the group is requested
3541
// - ps: the pack size that the allocation of the fields in the group
3642
// (and the bundled field, if any) should accommodate (see field_alloc_prop.hpp)
37-
// - bundled: whether the group should be bundled (see field_group.hpp)
38-
GroupRequest (const std::string& name_, const std::string& grid_, const int ps, const bool bundled_ = false)
39-
: name(name_), grid(grid_), pack_size(ps), bundled(bundled_)
43+
// - bundling: whether the group should be bundled (see field_group.hpp)
44+
GroupRequest (const std::string& name_, const std::string& grid_, const int ps, const Bundling b = Bundling::NotNeeded)
45+
: name(name_), grid(grid_), pack_size(ps), bundling(b)
4046
{
4147
EKAT_REQUIRE_MSG(pack_size>=1, "Error! Invalid pack size request.\n");
4248
}
4349

4450
GroupRequest (const std::string& name_, const std::string& grid_,
45-
const bool bundled = false)
46-
: GroupRequest(name_,grid_,1,bundled)
51+
const Bundling b = Bundling::NotNeeded)
52+
: GroupRequest(name_,grid_,1,b)
4753
{ /* Nothing to do here */ }
4854

4955
// Default copy ctor is perfectly fine
5056
GroupRequest (const GroupRequest&) = default;
5157

5258
// Main parts of a group request
53-
std::string name; // Group name
54-
std::string grid; // Grid name
55-
int pack_size; // Request an allocation that can accomodate Pack<Real,pack_size>
56-
bool bundled; // Whether the group should be allocated as a single n+1 dimensional field
59+
std::string name; // Group name
60+
std::string grid; // Grid name
61+
int pack_size; // Request an allocation that can accomodate Pack<Real,pack_size>
62+
Bundling bundling; // Whether the group should be allocated as a single n+1 dimensional field
5763
};
5864

5965
// In order to use GroupRequest in std sorted containers (like std::set),
@@ -83,7 +89,7 @@ inline bool operator< (const GroupRequest& lhs,
8389
}
8490

8591
// Same pack size, order by bundling
86-
return lhs.bundled<rhs.bundled;
92+
return etoi(lhs.bundling)<etoi(rhs.bundling);
8793
}
8894

8995
/*

components/eamxx/src/share/tests/field_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,10 @@ TEST_CASE("tracers_bundle", "") {
596596
field_mgr.register_field(FR{b_id,los{"tracers", "subtracers"}});
597597
field_mgr.register_field(FR{c_id,los{"tracers", "subtracers"}});
598598

599-
field_mgr.register_group(GroupRequest("tracers",gn1,true));
600-
field_mgr.register_group(GroupRequest("tracers",gn2,true));
601-
field_mgr.register_group(GroupRequest("subtracers",gn1,true));
599+
field_mgr.register_group(GroupRequest("tracers",gn1,Bundling::Required));
600+
field_mgr.register_group(GroupRequest("tracers",gn2,Bundling::Required));
601+
field_mgr.register_group(GroupRequest("subtracers",gn1,Bundling::Required));
602+
//field_mgr.register_group(GroupRequest("subtracers",gn2,Bundling::Required));
602603

603604
field_mgr.registration_ends();
604605

0 commit comments

Comments
 (0)