From 457bc7830905260310f416e19894f40af5d5bfa7 Mon Sep 17 00:00:00 2001 From: tcclevenger Date: Fri, 15 Nov 2024 08:26:07 -0700 Subject: [PATCH] Use calling_process in the FieldRequest::operator< Increases the number of entries in the AtmosphereProcess set m_*_field_requests, but not the number of allocations. Allows us to output all instances of field requests of the same name. --- .../eamxx/src/control/atmosphere_driver.cpp | 22 ++++++++----------- .../eamxx/src/share/field/field_request.hpp | 6 ++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/eamxx/src/control/atmosphere_driver.cpp b/components/eamxx/src/control/atmosphere_driver.cpp index 970cc0be3985..b58839e766fa 100644 --- a/components/eamxx/src/control/atmosphere_driver.cpp +++ b/components/eamxx/src/control/atmosphere_driver.cpp @@ -537,15 +537,15 @@ void AtmosphereDriver::create_fields() // Before registering fields, check that Field Requests for tracers are compatible { // Create map from tracer name to a vector which contains the field requests for that tracer. - std::map> tracer_requests; + std::map> tracer_requests; auto gather_tracer_requests = [&] (FieldRequest req) { if (not ekat::contains(req.groups, "tracers")) return; std::string fname = req.fid.name(); if (tracer_requests.find(fname) == tracer_requests.end()) { - tracer_requests[fname] = std::vector(1, req); + tracer_requests[fname] = {req}; } else { - tracer_requests[fname].push_back(req); + tracer_requests[fname].emplace(req); } }; for (const auto& req : m_atm_process_group->get_required_field_requests()){ @@ -558,18 +558,14 @@ void AtmosphereDriver::create_fields() // Go through the map entry for each tracer and check that every one // has the same request for turbulence advection. for (auto fr : tracer_requests) { - bool mismatch_found = false; - const auto reqs = fr.second; - const bool is_first_turb_advect = ekat::contains(reqs.front().groups, "turbulence_advected_tracers"); - for (size_t i=1; i turb_advect_types; + for (auto req : reqs) { + turb_advect_types.emplace(ekat::contains(req.groups, "turbulence_advected_tracers")); } - if (mismatch_found) { + + if (turb_advect_types.size()!=1) { std::ostringstream ss; ss << "Error! Incompatible tracer request. Turbulence advection requests not consistent among processes.\n" " - Tracer name: " + fr.first + "\n" diff --git a/components/eamxx/src/share/field/field_request.hpp b/components/eamxx/src/share/field/field_request.hpp index dd8fdb3902f8..8962ec2b4e1f 100644 --- a/components/eamxx/src/share/field/field_request.hpp +++ b/components/eamxx/src/share/field/field_request.hpp @@ -285,7 +285,11 @@ inline bool operator< (const FieldRequest& lhs, if (lhs.pack_size