Skip to content

Commit 7398ec6

Browse files
fix(Error Message): add component name in error message
1 parent d3c4a08 commit 7398ec6

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

src/geode/mesh/core/solid_mesh.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ namespace
193193
} while( facet.polyhedron_id != first_polyhedron
194194
&& safety_count < MAX_SAFETY_COUNT );
195195
OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT,
196-
"[SolidMesh::propagate_around_edge] Too many polyhedra "
196+
"[SolidMesh::propagate_around_edge] Solid: ", solid.name(),
197+
" - Too many polyhedra "
197198
"around edge ",
198199
edge_vertices[0], " ", edge_vertices[1], " (",
199200
solid.point( edge_vertices[0] ).string(), " ",
@@ -298,7 +299,9 @@ namespace
298299
}
299300
}
300301
OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT,
301-
"[SolidMesh::compute_polyhedra_around_vertex] Too many polyhedra "
302+
"[SolidMesh::compute_polyhedra_around_vertex] Solid: ",
303+
solid.name(),
304+
" Too many polyhedra "
302305
"around vertex ",
303306
vertex_id, " (", solid.point( vertex_id ).string(),
304307
"). This is probably related to a bug in the polyhedra "
@@ -424,12 +427,14 @@ namespace geode
424427

425428
public:
426429
explicit Impl( SolidMesh& solid )
427-
: polyhedron_around_vertex_( solid.vertex_attribute_manager()
430+
: polyhedron_around_vertex_(
431+
solid.vertex_attribute_manager()
428432
.template find_or_create_attribute< VariableAttribute,
429433
PolyhedronVertex >( "polyhedron_around_vertex",
430434
PolyhedronVertex{},
431435
{ false, false, false } ) ),
432-
polyhedra_around_vertex_( solid.vertex_attribute_manager()
436+
polyhedra_around_vertex_(
437+
solid.vertex_attribute_manager()
433438
.template find_or_create_attribute< VariableAttribute,
434439
CachedPolyhedra >( POLYHEDRA_AROUND_VERTEX_NAME,
435440
CachedPolyhedra{},
@@ -1335,7 +1340,7 @@ namespace geode
13351340
{
13361341
facet_vertices.push_back(
13371342
vertices[polyhedron_facet_vertex_id( { facet, v } )
1338-
.vertex_id] );
1343+
.vertex_id] );
13391344
}
13401345
}
13411346
return facets_vertices;

src/geode/mesh/core/surface_mesh.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ namespace
181181
}
182182
}
183183
OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT,
184-
"[SurfaceMesh::polygons_around_vertex] Too many polygons "
184+
"[SurfaceMesh::polygons_around_vertex] Surface: ", mesh.name(),
185+
" Too many polygons "
185186
"around vertex ",
186187
vertex_id, " (", mesh.point( vertex_id ).string(),
187188
"). This is probably related to a bug in the polygon "
@@ -249,12 +250,14 @@ namespace geode
249250

250251
public:
251252
Impl( SurfaceMesh& surface )
252-
: polygon_around_vertex_( surface.vertex_attribute_manager()
253+
: polygon_around_vertex_(
254+
surface.vertex_attribute_manager()
253255
.template find_or_create_attribute< VariableAttribute,
254256
PolygonVertex >( "polygon_around_vertex",
255257
PolygonVertex{},
256258
{ false, false, false } ) ),
257-
polygons_around_vertex_( surface.vertex_attribute_manager()
259+
polygons_around_vertex_(
260+
surface.vertex_attribute_manager()
258261
.template find_or_create_attribute< VariableAttribute,
259262
CachedPolygons >( POLYGONS_AROUND_VERTEX_NAME,
260263
CachedPolygons{},

src/geode/mesh/helpers/repair_polygon_orientations.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,29 @@ namespace
5151

5252
absl::FixedArray< geode::index_t > compute_bad_oriented_polygons()
5353
{
54-
absl::FixedArray< bool > visited( mesh_.nb_polygons(), false );
55-
for( const auto p : geode::Range{ mesh_.nb_polygons() } )
54+
try
5655
{
57-
if( visited[p] )
56+
absl::FixedArray< bool > visited( mesh_.nb_polygons(), false );
57+
for( const auto p : geode::Range{ mesh_.nb_polygons() } )
5858
{
59-
continue;
59+
if( visited[p] )
60+
{
61+
continue;
62+
}
63+
queue_.emplace( p );
64+
visited[p] = true;
65+
process_polygon_queue( visited );
6066
}
61-
queue_.emplace( p );
62-
visited[p] = true;
63-
process_polygon_queue( visited );
67+
}
68+
catch( geode::OpenGeodeException& e )
69+
{
70+
const auto msg =
71+
absl::StrCat( "Surface ", mesh_.name(), " - ", e.what() );
72+
throw( geode::OpenGeodeException( msg ) );
73+
}
74+
catch( ... )
75+
{
76+
throw;
6477
}
6578
return get_bad_oriented_polygons();
6679
}

0 commit comments

Comments
 (0)