@@ -274,10 +274,10 @@ namespace geode
274274 public:
275275 Impl ( SurfaceMesh& surface )
276276 : polygon_around_vertex_(
277- surface.vertex_attribute_manager()
278- .template find_or_create_attribute< VariableAttribute,
279- PolygonVertex >(
280- " polygon_around_vertex" , PolygonVertex{} ) ),
277+ surface.vertex_attribute_manager()
278+ .template find_or_create_attribute< VariableAttribute,
279+ PolygonVertex >(
280+ " polygon_around_vertex" , PolygonVertex{} ) ),
281281 polygons_around_vertex_ (
282282 surface.vertex_attribute_manager()
283283 .template find_or_create_attribute< VariableAttribute,
@@ -675,26 +675,23 @@ namespace geode
675675 const auto v1 = polygon_edge_vertex ( polygon_edge, 1 );
676676 const auto adj_vertices = polygon_vertices ( polygon_adj_id );
677677 const auto nb_edges = adj_vertices.size ();
678+ std::vector< PolygonEdge > failed_edges;
678679 for ( const auto e : LRange{ nb_edges } )
679680 {
681+ const PolygonEdge polygon_adj_edge{ polygon_adj_id, e };
680682 if ( v0 == adj_vertices[e] )
681683 {
682684 const auto enext = e == nb_edges - 1
683685 ? 0u
684686 : static_cast < local_index_t >( e + 1 );
685687 if ( v1 == adj_vertices[enext] )
686688 {
687- OPENGEODE_EXCEPTION (
688- polygon_adjacent ( { polygon_adj_id, e } )
689- == polygon_edge.polygon_id ,
690- absl::StrCat ( " [SurfaceMesh::polygon_adjacent_"
691- " edge] Wrong adjacency with polygons "
692- " (bijectivity): " ,
693- polygon_edge.polygon_id , " and " , polygon_adj_id,
694- " (v0 = " , this ->point ( v0 ).string (),
695- " , v1 = " , this ->point ( v1 ).string (), " )" ) );
696- return std::optional< PolygonEdge >{ std::in_place,
697- polygon_adj_id, e };
689+ if ( polygon_adjacent ( polygon_adj_edge )
690+ == polygon_edge.polygon_id )
691+ {
692+ return polygon_adj_edge;
693+ }
694+ failed_edges.emplace_back ( polygon_adj_edge );
698695 }
699696 }
700697 else if ( v1 == adj_vertices[e] )
@@ -704,28 +701,34 @@ namespace geode
704701 : static_cast < local_index_t >( e + 1 );
705702 if ( v0 == adj_vertices[enext] )
706703 {
707- OPENGEODE_EXCEPTION (
708- polygon_adjacent ( { polygon_adj_id, e } )
709- == polygon_edge.polygon_id ,
710- absl::StrCat ( " [SurfaceMesh::polygon_adjacent_"
711- " edge] Wrong adjacency with polygons "
712- " (bijectivity): " ,
713- polygon_edge.polygon_id , " and " , polygon_adj_id,
714- " (v0 = " , this ->point ( v0 ).string (),
715- " , v1 = " , this ->point ( v1 ).string (), " )" ) );
716- return std::optional< PolygonEdge >{ std::in_place,
717- polygon_adj_id, e };
704+ if ( polygon_adjacent ( polygon_adj_edge )
705+ == polygon_edge.polygon_id )
706+ {
707+ return polygon_adj_edge;
708+ }
709+ failed_edges.emplace_back ( polygon_adj_edge );
718710 }
719711 }
720712 }
721- throw OpenGeodeException{
722- " [SurfaceMesh::polygon_adjacent_edge] Wrong "
723- " adjacency with polygons (different vertices): " ,
724- polygon_edge.polygon_id , " and " , polygon_adj_id,
725- " (v0 = " , this ->point ( v0 ).string (),
726- " , v1 = " , this ->point ( v1 ).string (), " )"
727- };
728- return std::nullopt ;
713+ if ( failed_edges.empty () )
714+ {
715+ throw OpenGeodeException{
716+ " [SurfaceMesh::polygon_adjacent_edge] Wrong "
717+ " adjacency with polygons (different vertices): " ,
718+ polygon_edge.string (), " and " , polygon_adj_id,
719+ " (v0 = " , this ->point ( v0 ).string (),
720+ " , v1 = " , this ->point ( v1 ).string (), " )"
721+ };
722+ }
723+ auto message = absl::StrCat ( " [SurfaceMesh::polygon_adjacent_"
724+ " edge] Wrong adjacency with polygons "
725+ " (bijectivity): " ,
726+ polygon_edge.string () );
727+ for ( const auto & edge : failed_edges )
728+ {
729+ absl::StrAppend ( &message, " and " , edge.string () );
730+ }
731+ throw OpenGeodeException{ message };
729732 }
730733
731734 template < index_t dimension >
0 commit comments