diff --git a/src/geode/mesh/core/solid_mesh.cpp b/src/geode/mesh/core/solid_mesh.cpp index 7a5ec2c99..14af89c88 100644 --- a/src/geode/mesh/core/solid_mesh.cpp +++ b/src/geode/mesh/core/solid_mesh.cpp @@ -193,11 +193,10 @@ namespace } while( facet.polyhedron_id != first_polyhedron && safety_count < MAX_SAFETY_COUNT ); OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SolidMesh::propagate_around_edge] Too many polyhedra " - "around edge ", - edge_vertices[0], " ", edge_vertices[1], " (", - solid.point( edge_vertices[0] ).string(), " ", - solid.point( edge_vertices[1] ).string(), + "[SolidMesh::propagate_around_edge] Solid ", solid.name(), + ": too many polyhedra around edge ", edge_vertices[0], " ", + edge_vertices[1], " (", solid.point( edge_vertices[0] ).string(), + " ", solid.point( edge_vertices[1] ).string(), "). This is probably related to a bug in the polyhedron " "adjacencies." ); return std::make_tuple( std::move( result ), true ); @@ -298,9 +297,9 @@ namespace } } OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SolidMesh::compute_polyhedra_around_vertex] Too many polyhedra " - "around vertex ", - vertex_id, " (", solid.point( vertex_id ).string(), + "[SolidMesh::compute_polyhedra_around_vertex] Solid ", solid.name(), + ": Too many polyhedra around vertex ", vertex_id, " (", + solid.point( vertex_id ).string(), "). This is probably related to a bug in the polyhedra " "adjacencies." ); return result; diff --git a/src/geode/mesh/core/surface_mesh.cpp b/src/geode/mesh/core/surface_mesh.cpp index 9d1f57e71..5e677a68e 100644 --- a/src/geode/mesh/core/surface_mesh.cpp +++ b/src/geode/mesh/core/surface_mesh.cpp @@ -181,9 +181,9 @@ namespace } } OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SurfaceMesh::polygons_around_vertex] Too many polygons " - "around vertex ", - vertex_id, " (", mesh.point( vertex_id ).string(), + "[SurfaceMesh::polygons_around_vertex] Surface ", mesh.name(), + ": Too many polygons around vertex ", vertex_id, " (", + mesh.point( vertex_id ).string(), "). This is probably related to a bug in the polygon " "adjacencies." ); return result; diff --git a/src/geode/mesh/helpers/repair_polygon_orientations.cpp b/src/geode/mesh/helpers/repair_polygon_orientations.cpp index ca1604687..337044168 100644 --- a/src/geode/mesh/helpers/repair_polygon_orientations.cpp +++ b/src/geode/mesh/helpers/repair_polygon_orientations.cpp @@ -51,16 +51,29 @@ namespace absl::FixedArray< geode::index_t > compute_bad_oriented_polygons() { - absl::FixedArray< bool > visited( mesh_.nb_polygons(), false ); - for( const auto p : geode::Range{ mesh_.nb_polygons() } ) + try { - if( visited[p] ) + absl::FixedArray< bool > visited( mesh_.nb_polygons(), false ); + for( const auto p : geode::Range{ mesh_.nb_polygons() } ) { - continue; + if( visited[p] ) + { + continue; + } + queue_.emplace( p ); + visited[p] = true; + process_polygon_queue( visited ); } - queue_.emplace( p ); - visited[p] = true; - process_polygon_queue( visited ); + } + catch( geode::OpenGeodeException& e ) + { + const auto msg = + absl::StrCat( "Surface ", mesh_.name(), ": ", e.what() ); + throw geode::OpenGeodeException( msg ); + } + catch( ... ) + { + throw; } return get_bad_oriented_polygons(); }