Permalink
Browse files

fixed bug in SerialMesh::stitching_helper related to incorrect bounda…

…ry IDs when two surfaces within the same mesh.
  • Loading branch information...
1 parent e33b68a commit bec6e6dabd7c3b0464a1b72f6bdae735728a2eb3 David Knezevic committed Feb 25, 2014
Showing with 15 additions and 6 deletions.
  1. +15 −6 src/mesh/serial_mesh.C
@@ -871,6 +871,7 @@ void SerialMesh::stitching_helper (SerialMesh* other_mesh,
// of all faces on both boundaries. This will later be used in relative
// distance checks when stitching nodes.
Real h_min = std::numeric_limits<Real>::max();
+ bool h_min_updated = false;
// Loop below fills in these sets for the two meshes.
std::set<dof_id_type> this_boundary_node_ids, other_boundary_node_ids;
@@ -902,9 +903,10 @@ void SerialMesh::stitching_helper (SerialMesh* other_mesh,
set_array[i]->insert( side->node(node_id) );
h_min = std::min(h_min, side->hmin());
+ h_min_updated = true;
// This side is on the boundary, add its information to side_to_elem
- if(skip_find_neighbors)
+ if(skip_find_neighbors && (i==0))
{
key_type key = el->key(side_id);
val_type val;
@@ -924,9 +926,16 @@ void SerialMesh::stitching_helper (SerialMesh* other_mesh,
<< "This mesh has " << this_boundary_node_ids.size()
<< " nodes on boundary " << this_mesh_boundary_id << ".\n"
<< "Other mesh has " << other_boundary_node_ids.size()
- << " nodes on boundary " << other_mesh_boundary_id << ".\n"
- << "Minimum edge length on both surfaces is " << h_min << ".\n"
- << std::endl;
+ << " nodes on boundary " << other_mesh_boundary_id << ".\n";
+
+ if(h_min_updated)
+ {
+ libMesh::out << "Minimum edge length on both surfaces is " << h_min << ".\n";
+ }
+ else
+ {
+ libMesh::out << "No elements on specified surfaces." << std::endl;
+ }
}
@@ -1254,8 +1263,6 @@ void SerialMesh::stitching_helper (SerialMesh* other_mesh,
this->delete_node( this->node_ptr(node_id) );
}
- this->prepare_for_use( /*skip_renumber_nodes_and_elements= */ false, skip_find_neighbors);
-
// If find_neighbors() wasn't called in prepare_for_use(), we need to
// manually loop once more over all elements adjacent to the stitched boundary
// and fix their lists of neighbors.
@@ -1300,6 +1307,8 @@ void SerialMesh::stitching_helper (SerialMesh* other_mesh,
}
}
+ this->prepare_for_use( /*skip_renumber_nodes_and_elements= */ false, skip_find_neighbors);
+
// After the stitching, we may want to clear boundary IDs from element
// faces that are now internal to the mesh
if(clear_stitched_boundary_ids)

0 comments on commit bec6e6d

Please sign in to comment.