Skip to content

Commit 412c777

Browse files
committed
Address comments (#3385)
1 parent a1a7590 commit 412c777

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/mesh/mesh_smoother_laplace.C

+10-2
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,30 @@ void LaplaceMeshSmoother::smooth(unsigned int n_iterations)
137137
return true;
138138
}
139139

140-
// 2D - collinear - check cross product of first edge with all other edges
140+
// 2D - collinear - check cross product of first edge with all other edges.
141+
// curvature is only zero if the second connected edge spans a zero area
142+
// parallelogram with teh first edge. There shouldn't be a third edge, but if there
143+
// ever is, we enforce it to be collinear as well.
141144
if (_mesh.mesh_dimension() == 2)
142145
return (base.cross(vec).norm_sq() < libMesh::TOLERANCE * libMesh::TOLERANCE);
143146

144-
// 3D
147+
// 3D - we compute the cross product of the first and second edge...
145148
if (n_edges == 2)
146149
{
147150
const auto cross = base.cross(vec);
148151
const auto cross_norm_sq = cross.norm_sq();
152+
// if the second edge is collinear to the first we simply drop it. This does not violate
153+
// coplanarity, but it is insufficient to construct a normal for the tangent plane to check the
154+
// remaining edges against.
149155
if (cross_norm_sq < libMesh::TOLERANCE * libMesh::TOLERANCE)
150156
n_edges--;
151157
else
152158
base = cross / std::sqrt(cross_norm_sq);
153159
return true;
154160
}
155161

162+
// edges 3 and up are coplanar if they are orthogonal to the normal vector of the tangent
163+
// plane calculated above.
156164
return (base * vec < libMesh::TOLERANCE);
157165
};
158166

src/mesh/mesh_tools.C

+2-2
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ MeshTools::find_block_boundary_nodes(const MeshBase & mesh)
537537
// mark them as true in on_boundary.
538538
for (const auto & elem : mesh.active_element_ptr_range())
539539
for (auto s : elem->side_index_range())
540-
if (elem->neighbor_ptr(s) && elem->neighbor_ptr(s)->subdomain_id() != elem->subdomain_id())
540+
if (elem->neighbor_ptr(s) && (elem->neighbor_ptr(s)->subdomain_id() != elem->subdomain_id()))
541541
{
542542
auto nodes_on_side = elem->nodes_on_side(s);
543543

@@ -569,7 +569,7 @@ MeshTools::build_subdomain_boundary_node_map(const MeshBase & mesh)
569569
auto nodes_on_side = elem->nodes_on_side(s);
570570

571571
for (auto & local_id : nodes_on_side)
572-
block_boundary_node_map[elem->node_ptr(local_id)->id()].insert(std::make_pair(std::min(id1, id2), std::max(id1, id2)));
572+
block_boundary_node_map[elem->node_ptr(local_id)->id()].insert(std::minmax(id1, id2));
573573
}
574574
}
575575
}

0 commit comments

Comments
 (0)