diff --git a/src/mesh/boundary_info.C b/src/mesh/boundary_info.C index 085a1f46bc..9b6b09a2f8 100644 --- a/src/mesh/boundary_info.C +++ b/src/mesh/boundary_info.C @@ -2144,6 +2144,8 @@ void BoundaryInfo::renumber_id (boundary_id_type old_id, { _boundary_ids.erase(old_id); _boundary_ids.insert(new_id); + _global_boundary_ids.erase(old_id); + _global_boundary_ids.insert(new_id); } renumber_name(_ss_id_to_name, old_id, new_id); @@ -2183,8 +2185,10 @@ void BoundaryInfo::renumber_side_id (boundary_id_type old_id, !_node_boundary_ids.count(old_id)) { _boundary_ids.erase(old_id); + _global_boundary_ids.erase(old_id); } _boundary_ids.insert(new_id); + _global_boundary_ids.insert(new_id); } renumber_name(_ss_id_to_name, old_id, new_id); @@ -2222,8 +2226,10 @@ void BoundaryInfo::renumber_edge_id (boundary_id_type old_id, !_node_boundary_ids.count(old_id)) { _boundary_ids.erase(old_id); + _global_boundary_ids.erase(old_id); } _boundary_ids.insert(new_id); + _global_boundary_ids.insert(new_id); } renumber_name(_es_id_to_name, old_id, new_id); @@ -2261,8 +2267,10 @@ void BoundaryInfo::renumber_shellface_id (boundary_id_type old_id, !_node_boundary_ids.count(old_id)) { _boundary_ids.erase(old_id); + _global_boundary_ids.erase(old_id); } _boundary_ids.insert(new_id); + _global_boundary_ids.insert(new_id); } this->libmesh_assert_valid_multimaps(); @@ -2298,8 +2306,10 @@ void BoundaryInfo::renumber_node_id (boundary_id_type old_id, !_edge_boundary_ids.count(old_id)) { _boundary_ids.erase(old_id); + _global_boundary_ids.erase(old_id); } _boundary_ids.insert(new_id); + _global_boundary_ids.insert(new_id); } renumber_name(_ns_id_to_name, old_id, new_id); diff --git a/src/mesh/mesh_base.C b/src/mesh/mesh_base.C index 7dc7a6f31c..c6188b6e79 100644 --- a/src/mesh/mesh_base.C +++ b/src/mesh/mesh_base.C @@ -1965,19 +1965,31 @@ void MeshBase::detect_interior_parents() // This requires an inspection on every processor parallel_object_only(); - // This requires up-to-date mesh dimensions in cache - libmesh_assert(_preparation.has_cached_elem_data); + // This requires up-to-date mesh dimensions, but if we don't have + // them cached then we can't update them without changing the mesh + // in unexpected ways that interfere with our tests of + // partially-prepared meshes in MeshTools::*valid_is_prepared + std::set elem_dims_copy; + if (_preparation.has_cached_elem_data) + elem_dims_copy = this->elem_dimensions(); + else + { + for (const auto & elem : this->active_element_ptr_range()) + elem_dims_copy.insert(cast_int(elem->dim())); + if (!this->is_serial()) + this->comm().set_union(elem_dims_copy); + } // Early return if the mesh is empty or has elements of a single spatial dimension. - if (this->elem_dimensions().size() <= 1) + if (elem_dims_copy.size() <= 1) { _preparation.has_interior_parent_ptrs = true; return; } // Convenient elem_dimensions iterators - const auto dim_start = this->elem_dimensions().begin(); - const auto dim_end = this->elem_dimensions().end(); + const auto dim_start = elem_dims_copy.begin(); + const auto dim_end = elem_dims_copy.end(); // In this function we find only +1 dimensional interior parents, // (so, for a given element el, the interior parent p must satisfy p.dim() == el.dim() + 1). diff --git a/src/mesh/mesh_modification.C b/src/mesh/mesh_modification.C index 5c27728245..2f11e52162 100644 --- a/src/mesh/mesh_modification.C +++ b/src/mesh/mesh_modification.C @@ -307,6 +307,10 @@ void MeshTools::Modification::redistribute (MeshBase & mesh, #endif } + // If we just moved a mesh in or out out of the X axis or XY plane + // then we might have changed its spatial_dimension() + mesh.unset_has_cached_elem_data(); + // We haven't changed any topology, but just changing geometry could // have invalidated a point locator. mesh.clear_point_locator(); @@ -324,6 +328,10 @@ void MeshTools::Modification::translate (MeshBase & mesh, for (auto & node : mesh.node_ptr_range()) *node += p; + // If we just moved a mesh in or out out of the X axis or XY plane + // then we might have changed its spatial_dimension() + mesh.unset_has_cached_elem_data(); + // We haven't changed any topology, but just changing geometry could // have invalidated a point locator. mesh.clear_point_locator(); @@ -365,15 +373,16 @@ MeshTools::Modification::rotate (MeshBase & mesh, #if LIBMESH_DIM == 3 const auto R = RealTensorValue::intrinsic_rotation_matrix(phi, theta, psi); - if (theta) - mesh.set_spatial_dimension(3); - for (auto & node : mesh.node_ptr_range()) { Point & pt = *node; pt = R * pt; } + // If we just moved a mesh in or out out of the X axis or XY plane + // then we might have changed its spatial_dimension() + mesh.unset_has_cached_elem_data(); + return R; #else @@ -419,6 +428,10 @@ void MeshTools::Modification::scale (MeshBase & mesh, for (auto & node : mesh.node_ptr_range()) (*node)(2) *= z_scale; + // If we just collapsed a manifold onto the X axis or XY plane + // then we might have changed its spatial_dimension() + mesh.unset_has_cached_elem_data(); + // We haven't changed any topology, but just changing geometry could // have invalidated a point locator. mesh.clear_point_locator();