From 848d42e0dd2679cf99fd06d70f208e6378cd458d Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Thu, 19 Feb 2026 18:14:05 -0600 Subject: [PATCH 1/3] Actually *process* the hull integrity result --- src/mesh/mesh_netgen_interface.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/mesh_netgen_interface.C b/src/mesh/mesh_netgen_interface.C index b8f5bb3cda8..742d289c042 100644 --- a/src/mesh/mesh_netgen_interface.C +++ b/src/mesh/mesh_netgen_interface.C @@ -127,7 +127,8 @@ void NetGenMeshInterface::triangulate () return; } - this->check_hull_integrity(); + auto integrity = this->check_hull_integrity(); + this->process_hull_integrity_result(integrity); Ng_Meshing_Parameters params; From a6dc159de0fc0d518bfb2a57b946cfefb58c5f89 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Thu, 19 Feb 2026 18:14:33 -0600 Subject: [PATCH 2/3] Improved messages, all in the error exception --- src/mesh/mesh_tet_interface.C | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mesh/mesh_tet_interface.C b/src/mesh/mesh_tet_interface.C index 84d84bc724f..0d72d8aaa57 100644 --- a/src/mesh/mesh_tet_interface.C +++ b/src/mesh/mesh_tet_interface.C @@ -335,7 +335,7 @@ BoundingBox MeshTetInterface::volume_to_surface_mesh(UnstructuredMesh & mesh) } -unsigned MeshTetInterface::check_hull_integrity() +unsigned int MeshTetInterface::check_hull_integrity() { // Check for easy return: if the Mesh is empty (i.e. if // somebody called triangulate_conformingDelaunayMesh on @@ -371,17 +371,28 @@ unsigned MeshTetInterface::check_hull_integrity() void MeshTetInterface::process_hull_integrity_result(unsigned result) { + std::ostringstream err_msg; + if (result != 0) { - libMesh::err << "Error! Conforming Delaunay mesh tetrahedralization requires a convex hull." << std::endl; + err_msg << "Error! Conforming Delaunay mesh tetrahedralization requires a convex hull." << std::endl; if (result==1) { - libMesh::err << "Non-TRI3 elements were found in the input Mesh. "; - libMesh::err << "A constrained Delaunay triangulation requires a convex hull of TRI3 elements." << std::endl; + err_msg << "Non-TRI3 elements were found in the input Mesh. "; + err_msg << "A constrained Delaunay tetrahedralization requires a convex hull of TRI3 elements." << std::endl; } - libmesh_error_msg("Consider calling TetGenMeshInterface::pointset_convexhull() followed by Mesh::find_neighbors() first."); + if (result==2) + { + err_msg << "At least one triangle without three neighbors was found in the input Mesh. "; + err_msg << "A constrained Delaunay tetrahedralization must be a triangular manifold without boundary." << std::endl; + } + + if (result==3) + err_msg << "The input Mesh was empty!" << std::endl; + + libmesh_error_msg(err_msg.str()); } } From e015092cf8856e4c83c195254e06c3461f0534e5 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Thu, 19 Feb 2026 18:15:03 -0600 Subject: [PATCH 3/3] Improved comments, and [[nodiscard]] on check Hopefully the compiler can tell us in the future if someone *else* is dumb enough to call this function but then just ignore its output. --- include/mesh/mesh_tet_interface.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/include/mesh/mesh_tet_interface.h b/include/mesh/mesh_tet_interface.h index bd68662adb8..013b920c30b 100644 --- a/include/mesh/mesh_tet_interface.h +++ b/include/mesh/mesh_tet_interface.h @@ -105,25 +105,28 @@ class MeshTetInterface /** * This function checks the integrity of the current set of - * elements in the Mesh to see if they comprise a hull, - * that is: + * elements in the Mesh to see if they comprise a topological + * manifold that (if it's also geometrically valid) would define + * valid hull for a tetrahedralized volume. + * That is: * - If they are all TRI3 elements * - They all have non-nullptr neighbors * * \returns - * - 0 if the mesh forms a valid hull + * - 0 if the mesh forms a topologically valid hull * - 1 if a non-TRI3 element is found * - 2 if an element with a nullptr-neighbor is found + * - 3 if the mesh is empty */ - unsigned check_hull_integrity(); + [[nodiscard]] unsigned int check_hull_integrity(); /** - * This function prints an informative message and - * crashes based on the output of the check_hull_integrity() - * function. It is a separate function so that you - * can check hull integrity without crashing if you desire. + * This function prints an informative message and throws an + * exception based on the output of the check_hull_integrity() + * function. It is a separate function so that you can check hull + * integrity without exiting or catching an exception if desired. */ - void process_hull_integrity_result(unsigned result); + void process_hull_integrity_result(unsigned int result); /** * Delete original convex hull elements from the Mesh