Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/mesh/boundary_info.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
22 changes: 17 additions & 5 deletions src/mesh/mesh_base.C
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned char> 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<unsigned char>(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).
Expand Down
19 changes: 16 additions & 3 deletions src/mesh/mesh_modification.C
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down