Skip to content

Commit f5c7f9a

Browse files
committed
Double-check that "best" element in boundary prep
NetGen is only happy with oriented manifolds in one orientation
1 parent 55a5fef commit f5c7f9a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/mesh/mesh_tet_interface.C

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::improve_hull_inte
454454
// We'll just implement this in serial for now.
455455
MeshSerializer mesh_serializer(this->_mesh);
456456

457+
// I don't see why we'd need boundary info here, but maybe we'll
458+
// want to preserve edge/node conditions eventually?
459+
BoundaryInfo & bi = this->_mesh.get_boundary_info();
460+
457461
const Node * lowest_point = (*this->_mesh.elements_begin())->node_ptr(0);
458462

459463
// Index by ids, not pointers, for consistency in parallel
@@ -488,6 +492,11 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::improve_hull_inte
488492
{
489493
best_elem = elem;
490494
best_abs_normal_0 = abs_normal_0;
495+
496+
// Make sure that element is actually a good one, by
497+
// flipping it if it's not.
498+
if (abs_normal_0 == normal(0))
499+
elem->flip(&bi);
491500
}
492501
}
493502

@@ -496,8 +505,6 @@ std::set<MeshTetInterface::SurfaceIntegrity> MeshTetInterface::improve_hull_inte
496505
std::unordered_set<dof_id_type> frontier_elements{best_elem->id()},
497506
finished_elements{};
498507

499-
BoundaryInfo & bi = this->_mesh.get_boundary_info();
500-
501508
while (!frontier_elements.empty())
502509
{
503510
const dof_id_type elem_id = *frontier_elements.begin();

0 commit comments

Comments
 (0)