Skip to content

Commit 74c13d2

Browse files
committed
wip
1 parent c6b67dd commit 74c13d2

File tree

10 files changed

+161
-342
lines changed

10 files changed

+161
-342
lines changed

bindings/python/src/inspector/topology/brep_topology.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ namespace geode
9292
.def_readwrite( "surfaces_not_linked_to_a_unique_vertex",
9393
&BRepSurfacesTopologyInspectionResult::
9494
surfaces_not_linked_to_a_unique_vertex )
95-
.def_readwrite(
96-
"unique_vertices_linked_to_not_internal_nor_boundary_surface",
95+
.def_readwrite( "unique_vertices_linked_to_surface_with_wrong_"
96+
"relationship_with_blocks",
9797
&BRepSurfacesTopologyInspectionResult::
98-
unique_vertices_linked_to_not_internal_nor_boundary_surface )
98+
unique_vertices_linked_to_surface_with_wrong_relationship_with_blocks )
9999
.def_readwrite(
100100
"unique_vertices_linked_to_a_surface_with_invalid_embbedings",
101101
&BRepSurfacesTopologyInspectionResult::

bindings/python/tests/test-py-brep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def surfaces_topological_validity(result, verbose):
8181
result.unique_vertices_linked_to_a_single_and_invalid_surface.nb_issues()
8282
)
8383
nb_issues += (
84-
result.unique_vertices_linked_to_not_internal_nor_boundary_surface.nb_issues()
84+
result.unique_vertices_linked_to_surface_with_wrong_relationship_with_blocks.nb_issues()
8585
)
8686
nb_issues += (
8787
result.unique_vertices_linked_to_several_and_invalid_surfaces.nb_issues()

include/geode/inspector/topology/brep_lines_topology.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,11 @@ namespace geode
4848
InspectionIssuesMap< index_t > lines_not_linked_to_a_unique_vertex{
4949
"Lines with mesh vertices not linked to a unique vertex"
5050
};
51-
InspectionIssues< index_t >
52-
unique_vertices_linked_to_not_internal_nor_boundary_line{
53-
"Indices of unique vertices linked to a Line without boundary "
54-
"nor internal status."
55-
};
5651
InspectionIssues< index_t >
5752
unique_vertices_linked_to_a_line_with_invalid_embeddings{
5853
"Indices of unique vertices linked to a Line with invalid "
5954
"internal topology."
6055
};
61-
InspectionIssues< index_t >
62-
unique_vertices_linked_to_a_single_and_invalid_line{
63-
"Indices of unique vertices linked to only one Line and this "
64-
"single Line is invalid."
65-
};
6656
InspectionIssues< index_t >
6757
unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner{
6858
"Indices of unique vertices linked to several Lines but not "
@@ -102,18 +92,10 @@ namespace geode
10292
[[nodiscard]] bool line_vertices_are_associated_to_unique_vertices(
10393
const Line3D& line ) const;
10494

105-
[[nodiscard]] std::optional< std::string >
106-
vertex_is_part_of_not_internal_nor_boundary_line(
107-
index_t unique_vertex_index ) const;
108-
10995
[[nodiscard]] std::optional< std::string >
11096
vertex_is_part_of_invalid_embedded_line(
11197
index_t unique_vertex_index ) const;
11298

113-
[[nodiscard]] std::optional< std::string >
114-
vertex_is_part_of_invalid_single_line(
115-
index_t unique_vertex_index ) const;
116-
11799
[[nodiscard]] std::optional< std::string >
118100
vertex_has_lines_but_is_not_a_corner(
119101
index_t unique_vertex_index ) const;

include/geode/inspector/topology/brep_surfaces_topology.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@ namespace geode
4747
InspectionIssuesMap< index_t > surfaces_not_linked_to_a_unique_vertex{
4848
"Surfaces with mesh vertices not linked to a unique vertex"
4949
};
50-
InspectionIssues< index_t >
51-
unique_vertices_linked_to_not_internal_nor_boundary_surface{
52-
"Indices of unique vertices linked to Surface without boundary "
53-
"nor internal status."
54-
};
5550
InspectionIssues< index_t >
5651
unique_vertices_linked_to_a_surface_with_invalid_embbedings{
5752
"Indices of unique vertices linked to a Surface with invalid "
5853
"internal topology."
5954
};
60-
InspectionIssues< index_t >
61-
unique_vertices_linked_to_a_single_and_invalid_surface{
62-
"Indices of unique vertices linked to only one Surface and "
63-
"this single surface is invalid."
64-
};
6555
InspectionIssues< index_t >
6656
unique_vertices_linked_to_several_and_invalid_surfaces{
6757
"Indices of unique vertices linked to several Surfaces in an "
@@ -112,18 +102,10 @@ namespace geode
112102
[[nodiscard]] bool surface_vertices_are_associated_to_unique_vertices(
113103
const Surface3D& surface ) const;
114104

115-
[[nodiscard]] std::optional< std::string >
116-
vertex_is_part_of_not_internal_nor_boundary_surface(
117-
index_t unique_vertex_index ) const;
118-
119105
[[nodiscard]] std::optional< std::string >
120106
vertex_is_part_of_invalid_embedded_surface(
121107
index_t unique_vertex_index ) const;
122108

123-
[[nodiscard]] std::optional< std::string >
124-
vertex_is_part_of_invalid_single_surface(
125-
index_t unique_vertex_index ) const;
126-
127109
[[nodiscard]] std::optional< std::string >
128110
vertex_is_part_of_invalid_multiple_surfaces(
129111
index_t unique_vertex_index ) const;

include/geode/inspector/topology/section_lines_topology.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace geode
103103
const Line2D& line ) const;
104104

105105
[[nodiscard]] std::optional< std::string >
106-
vertex_is_part_of_not_internal_nor_boundary_line(
106+
vertex_is_part_of_line_with_wrong_relationships_to_surface(
107107
const index_t unique_vertex_index ) const;
108108

109109
[[nodiscard]] std::optional< std::string >

src/geode/inspector/topology/brep_blocks_topology.cpp

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace
257257
std::vector< geode::uuid > not_boundaries;
258258
auto graph = geode::Graph::create();
259259
auto graph_builder = geode::GraphBuilder::create( *graph );
260-
geode::BijectiveMapping< geode::uuid, geode::index_t >
260+
geode::GenericMapping< geode::uuid, geode::index_t >
261261
line_uuids_to_graph_edges;
262262
geode::BijectiveMapping< geode::uuid, geode::index_t >
263263
corner_uuids_to_graph_vertices;
@@ -275,18 +275,29 @@ namespace
275275
for( const auto& boundary_corner :
276276
brep.boundaries( incident_line ) )
277277
{
278-
if( boundary_corner.id() == corner.id() )
279-
{
280-
continue;
281-
}
278+
// if( boundary_corner.id() == corner.id() )
279+
// {
280+
// continue;
281+
// }
282282
SDEBUG( boundary_corner.id() );
283283
const auto boundary_corner_vertex =
284284
corner_uuids_to_graph_vertices.in2out(
285285
boundary_corner.id() );
286-
if( line_uuids_to_graph_edges.has_mapping_input(
287-
incident_line.id() ) )
286+
// if( line_uuids_to_graph_edges.has_mapping_input(
287+
// incident_line.id() ) )
288+
// {
289+
// continue;
290+
// }
291+
if( const auto existing_edge = graph->edge_from_vertices(
292+
boundary_corner_vertex, corner_vertex ) )
288293
{
289-
continue;
294+
if( line_uuids_to_graph_edges
295+
.out2in( existing_edge.value() )
296+
.at( 0 )
297+
== incident_line.id() )
298+
{
299+
continue;
300+
}
290301
}
291302
line_uuids_to_graph_edges.map( incident_line.id(),
292303
graph_builder->create_edge(
@@ -298,51 +309,65 @@ namespace
298309
geode::save_graph( *graph, "graph.og_grp" );
299310
while( found_not_boundary_line )
300311
{
301-
DEBUG( "found_not_boundary_lines" );
302312
std::vector< bool > to_delete( graph->nb_edges(), false );
303313
for( const auto graph_vertex :
304314
geode::Range{ graph->nb_vertices() } )
305315
{
306-
DEBUG( graph->edges_around_vertex( graph_vertex ).size() );
307-
SDEBUG(
308-
brep.corner( corner_uuids_to_graph_vertices.out2in(
309-
graph_vertex ) )
310-
.mesh()
311-
.point( 0 ) );
312-
if( graph->edges_around_vertex( graph_vertex ).size() != 1 )
316+
if( graph->edges_around_vertex( graph_vertex ).empty() )
313317
{
314318
continue;
315319
}
316-
const auto line_id = line_uuids_to_graph_edges.out2in(
317-
graph->edges_around_vertex( graph_vertex )
318-
.at( 0 )
319-
.edge_id );
320-
DEBUG( to_delete.size() );
321-
DEBUG( graph->edges_around_vertex( graph_vertex ).size() );
322-
DEBUG( graph->edges_around_vertex( graph_vertex )
323-
.at( 0 )
324-
.edge_id );
320+
const auto line_id =
321+
line_uuids_to_graph_edges
322+
.out2in( graph->edges_around_vertex( graph_vertex )
323+
.at( 0 )
324+
.edge_id )
325+
.at( 0 );
326+
bool should_delete{ true };
327+
for( const auto& edge_around :
328+
graph->edges_around_vertex( graph_vertex ) )
329+
{
330+
if( line_uuids_to_graph_edges.out2in( edge_around.edge_id )
331+
.at( 0 )
332+
!= line_id )
333+
{
334+
should_delete = false;
335+
break;
336+
}
337+
}
338+
if( !should_delete )
339+
{
340+
continue;
341+
}
342+
if( absl::c_contains( not_boundaries, line_id ) )
343+
{
344+
continue;
345+
}
346+
for( const auto& edge :
347+
line_uuids_to_graph_edges.in2out( line_id ) )
348+
{
349+
to_delete[edge] = true;
350+
}
325351
not_boundaries.push_back( line_id );
326-
SDEBUG( line_id );
327-
to_delete[graph->edges_around_vertex( graph_vertex )
328-
.at( 0 )
329-
.edge_id] = true;
330352
}
331353
if( !absl::c_contains( to_delete, true ) )
332354
{
333355
found_not_boundary_line = false;
334356
continue;
335357
}
336358
const auto old2new = graph_builder->delete_edges( to_delete );
337-
geode::BijectiveMapping< geode::uuid, geode::index_t >
359+
geode::GenericMapping< geode::uuid, geode::index_t >
338360
new_line_uuids_to_graph_edges;
339-
for( const auto& [line_id, graph_edge] :
361+
for( const auto& [line_id, graph_edges] :
340362
line_uuids_to_graph_edges.in2out_map() )
341363
{
342-
if( old2new.at( graph_edge ) != geode::NO_ID )
364+
for( const auto graph_edge : graph_edges )
343365
{
344-
new_line_uuids_to_graph_edges.map(
345-
line_id, old2new.at( graph_edge ) );
366+
if( old2new.at( graph_edge ) != geode::NO_ID )
367+
{
368+
new_line_uuids_to_graph_edges.map(
369+
line_id, old2new.at( graph_edge ) );
370+
}
346371
}
347372
}
348373
line_uuids_to_graph_edges = new_line_uuids_to_graph_edges;

0 commit comments

Comments
 (0)