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..d0e35cf27b 100644 --- a/src/mesh/mesh_base.C +++ b/src/mesh/mesh_base.C @@ -1894,7 +1894,14 @@ 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(); + _block_id_to_name[id] = name; +} subdomain_id_type MeshBase::get_id_by_name(std::string_view name) const