From e26dc0141ade9e004aa675929eeaa3bfbecdd557 Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Tue, 7 Jul 2026 11:30:35 -0700 Subject: [PATCH 1/2] Add an API for potentially synchronous subdomain name setting This can be used to potentially avoid parallel communication down-the-road to fix the subdomain id to name sync flag --- include/mesh/mesh_base.h | 11 +++++++++++ src/mesh/mesh_base.C | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/mesh/mesh_base.h b/include/mesh/mesh_base.h index e5c4594d6a..50ae9947a0 100644 --- a/include/mesh/mesh_base.h +++ b/include/mesh/mesh_base.h @@ -1694,6 +1694,17 @@ class MeshBase : public ParallelObject std::string & subdomain_name(subdomain_id_type id); const std::string & subdomain_name(subdomain_id_type id) const; + /** + * Sets the \p name for the provided \p id + * @param id The subdomain id to set the name for + * @param name The subdomain name + * @param synchronous Whether this method is being called across all mesh ranks. If this is true, + * then we don't have to register this collective container as being out of sync + */ + void set_subdomain_name(subdomain_id_type id, + const std::string & name, + bool synchronous = false); + /** * \returns The id of the named subdomain if it exists, * \p Elem::invalid_subdomain_id otherwise. diff --git a/src/mesh/mesh_base.C b/src/mesh/mesh_base.C index 83667a9fae..2f4793fab1 100644 --- a/src/mesh/mesh_base.C +++ b/src/mesh/mesh_base.C @@ -1894,7 +1894,16 @@ const std::string & MeshBase::subdomain_name(subdomain_id_type id) const return iter->second; } - +void MeshBase::set_subdomain_name(const subdomain_id_type id, + const std::string & name, + const bool synchronous) +{ + if (synchronous) + parallel_object_only(); + else + this->unset_has_synched_subdomain_name_map(); + _block_id_to_name[id] = name; +} subdomain_id_type MeshBase::get_id_by_name(std::string_view name) const From 295fe3ea50f749f0db9c1e11c109b1e42f8bde83 Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Tue, 7 Jul 2026 11:50:10 -0700 Subject: [PATCH 2/2] Remove method call that's not yet present This method will be added in #4485 --- src/mesh/mesh_base.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesh/mesh_base.C b/src/mesh/mesh_base.C index 2f4793fab1..d0e35cf27b 100644 --- a/src/mesh/mesh_base.C +++ b/src/mesh/mesh_base.C @@ -1900,8 +1900,6 @@ void MeshBase::set_subdomain_name(const subdomain_id_type id, { if (synchronous) parallel_object_only(); - else - this->unset_has_synched_subdomain_name_map(); _block_id_to_name[id] = name; }