Skip to content

Commit 73164d4

Browse files
committed
fix tests and comments pierre
1 parent 9e277a8 commit 73164d4

3 files changed

Lines changed: 91 additions & 76 deletions

File tree

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def lines_topological_validity(result, verbose):
6262
nb_issues += (
6363
result.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner.nb_issues()
6464
)
65+
nb_issues+=result.line_edges_with_wrong_component_edges_around.nb_issues()
6566
print("BRep Lines Topology check: ", nb_issues, " issues.")
6667
if verbose:
6768
print(result.string(), "\n")
@@ -79,6 +80,8 @@ def surfaces_topological_validity(result, verbose):
7980
nb_issues += (
8081
result.unique_vertices_linked_to_several_and_invalid_surfaces.nb_issues()
8182
)
83+
nb_issues+=result.unique_vertices_linked_to_a_surface_with_invalid_embbedings.nb_issues()
84+
nb_issues +=result.surface_polygons_with_wrong_component_facets_around.nb_issues()
8285
print("BRep Surfaces Topology check: ", nb_issues, " issues.")
8386
if verbose:
8487
print(result.string(), "\n")
@@ -90,13 +93,15 @@ def blocks_topological_validity(result, verbose):
9093
for issue in result.blocks_not_linked_to_a_unique_vertex.issues_map():
9194
nb_issues += issue[1].nb_issues()
9295
nb_issues += result.some_blocks_not_meshed.nb_issues()
96+
nb_issues += result.wrong_block_boundary_surface.nb_issues()
9397
nb_issues += (
9498
result.unique_vertices_part_of_two_blocks_and_no_boundary_surface.nb_issues()
9599
)
96100
nb_issues += result.unique_vertices_with_incorrect_block_cmvs_count.nb_issues()
97101
nb_issues += (
98102
result.unique_vertices_linked_to_a_single_and_invalid_surface.nb_issues()
99103
)
104+
nb_issues += result.blocks_with_not_closed_boundary_surfaces.nb_issues()
100105
nb_issues += (
101106
result.unique_vertices_linked_to_surface_with_wrong_relationship_to_blocks.nb_issues()
102107
)
@@ -212,9 +217,9 @@ def check_a1(verbose):
212217
else:
213218
print("model_A1 topology is invalid.")
214219
nb_model_issues = launch_topological_validity_checks(result.topology, verbose)
215-
if nb_model_issues != 5165:
220+
if nb_model_issues != 5201:
216221
raise ValueError(
217-
"[Test] model model_A1 should have 5615 unique vertices with topological problems."
222+
"[Test] model model_A1 should have 5201 unique vertices with topological problems."
218223
)
219224
nb_component_meshes_issues = launch_component_meshes_validity_checks(
220225
result.meshes, verbose
@@ -232,9 +237,9 @@ def inspect_model_A1(model_brep,verbose):
232237
else:
233238
print("model_A1_valid topology is invalid.")
234239
nb_model_issues = launch_topological_validity_checks(result.topology, verbose)
235-
if nb_model_issues != 5165:
240+
if nb_model_issues != 5201:
236241
raise ValueError(
237-
"[Test] model model_A1_valid should have 5165 topological problems."
242+
"[Test] model model_A1_valid should have 5201 topological problems."
238243
)
239244
nb_component_meshes_issues = launch_component_meshes_validity_checks(
240245
result.meshes, verbose
@@ -258,9 +263,9 @@ def inspect_model_mss(model_brep,verbose):
258263
else:
259264
print("model mss topology is invalid.")
260265
nb_model_issues = launch_topological_validity_checks(result.topology, verbose)
261-
if nb_model_issues != 36:
266+
if nb_model_issues != 37:
262267
raise ValueError(
263-
"[Test] model mss.og_strm should have 36 topological problems."
268+
"[Test] model mss.og_strm should have 37 topological problems."
264269
)
265270
nb_component_meshes_issues = launch_component_meshes_validity_checks(
266271
result.meshes, verbose

src/geode/inspector/topology/internal/expected_nb_cmvs.cpp

Lines changed: 61 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -169,72 +169,57 @@ namespace
169169
nb_block_cmvs, " Block mesh vertices (should be ",
170170
predicted_nb_block_cmvs, ")." ) ) );
171171
}
172-
// const auto nb_free_line_cmvs = count_cmvs(
173-
// unique_vertex_cmvs.line_cmvs, [&brep]( const auto& cmv ) {
174-
// return brep.nb_incidences( cmv.component_id.id() ) == 1
175-
// && brep.nb_embedding_surfaces(
176-
// brep.line( cmv.component_id.id() ) )
177-
// == 0;
172+
// const auto nb_internal_surface_cmvs = count_cmvs(
173+
// unique_vertex_cmvs.surface_cmvs,
174+
// [&block_uuid, &brep]( const auto& cmv ) {
175+
// return brep.is_internal( brep.surface( cmv.component_id.id()
176+
// ),
177+
// brep.block( block_uuid ) );
178178
// } );
179-
// auto predicted_nb_block_cmvs =
180-
// nb_internal_surface_cmvs < nb_free_line_cmvs + 1
181-
// ? static_cast< geode::index_t >( 1 )
182-
// : nb_internal_surface_cmvs - nb_free_line_cmvs;
183-
// if( nb_internal_surface_cmvs - nb_free_line_cmvs == 1 )
184-
// {
185-
// predicted_nb_block_cmvs++;
186-
// }
187-
// if( nb_boundary_surface_cmvs > 1
188-
// && unique_vertex_cmvs.corner_cmvs.empty() )
189-
// {
190-
// predicted_nb_block_cmvs += ( nb_boundary_surface_cmvs - 2 ) / 2;
191-
// }
192-
/// predicted_nb_block_cmvs = 1 + nb_internal_surfaces - nb_free_lines -
193-
/// nb_lines_boundary_to_strictly_2_internal_surfaces
194-
absl::flat_hash_set< geode::uuid > uuids_used;
195-
const auto nb_internal_surfaces = count_cmvs(
196-
unique_vertex_cmvs.surface_cmvs,
197-
[&block_uuid, &brep, &uuids_used]( const auto& cmv ) {
198-
if( !uuids_used.emplace( cmv.component_id.id() ).second )
199-
{
200-
return false;
201-
}
202-
return brep.is_internal( brep.surface( cmv.component_id.id() ),
203-
brep.block( block_uuid ) );
204-
} );
205-
uuids_used.clear();
179+
const auto nb_line_internal_to_internal_surface_cmvs =
180+
count_cmvs( unique_vertex_cmvs.line_cmvs,
181+
[&block_uuid, &brep]( const auto& cmv ) {
182+
const auto& cmv_line = brep.line( cmv.component_id.id() );
183+
if( brep.nb_embedding_surfaces( cmv_line ) != 1 )
184+
{
185+
return false;
186+
}
187+
for( const auto& incident_surface :
188+
brep.embedding_surfaces( cmv_line ) )
189+
{
190+
if( !brep.is_internal(
191+
incident_surface, brep.block( block_uuid ) ) )
192+
{
193+
return false;
194+
}
195+
}
196+
return true;
197+
} );
198+
// absl::flat_hash_set< geode::uuid > uuids_used;
206199
/// Lines that are free but incident to the same surface are counted
207200
/// only once
208-
const auto nb_free_lines = count_cmvs( unique_vertex_cmvs.line_cmvs,
209-
[&brep, &uuids_used]( const auto& cmv ) {
210-
if( !uuids_used.emplace( cmv.component_id.id() ).second )
211-
{
212-
return false;
213-
}
201+
const auto nb_free_line_cmvs = count_cmvs(
202+
unique_vertex_cmvs.line_cmvs, [&brep]( const auto& cmv ) {
214203
if( brep.nb_incidences( cmv.component_id.id() ) != 1 )
215204
{
216205
return false;
217206
}
218-
for( const auto& incident_surface :
219-
brep.incidences( brep.line( cmv.component_id.id() ) ) )
220-
{
221-
if( !uuids_used.emplace( incident_surface.id() ).second )
222-
{
223-
return false;
224-
}
225-
}
207+
// for( const auto& incident_surface :
208+
// brep.incidences( brep.line( cmv.component_id.id() ) ) )
209+
// {
210+
// if( !uuids_used.emplace( incident_surface.id() ).second )
211+
// {
212+
// return false;
213+
// }
214+
// }
226215
return brep.nb_embedding_surfaces(
227216
brep.line( cmv.component_id.id() ) )
228217
== 0;
229218
} );
230-
uuids_used.clear();
231-
const auto nb_lines_boundary_to_two_internal_lines =
219+
// uuids_used.clear();
220+
const auto nb_lines_boundary_to_two_internal_surfaces_cmvs =
232221
count_cmvs( unique_vertex_cmvs.line_cmvs,
233-
[&block_uuid, &brep, &uuids_used]( const auto& cmv ) {
234-
if( !uuids_used.emplace( cmv.component_id.id() ).second )
235-
{
236-
return false;
237-
}
222+
[&block_uuid, &brep]( const auto& cmv ) {
238223
if( brep.nb_incidences( cmv.component_id.id() ) != 2 )
239224
{
240225
return false;
@@ -250,10 +235,19 @@ namespace
250235
}
251236
return true;
252237
} );
253-
geode::index_t predicted_nb_block_cmvs{
254-
1 + nb_internal_surfaces - nb_free_lines
255-
- nb_lines_boundary_to_two_internal_lines
238+
geode::index_t predicted_nb_block_cmvs{ 1 + nb_internal_surface_cmvs };
239+
const geode::index_t nb_line_cmvs_to_remove{
240+
nb_line_internal_to_internal_surface_cmvs + nb_free_line_cmvs
241+
+ nb_lines_boundary_to_two_internal_surfaces_cmvs
256242
};
243+
if( predicted_nb_block_cmvs > nb_line_cmvs_to_remove )
244+
{
245+
predicted_nb_block_cmvs -= nb_line_cmvs_to_remove;
246+
}
247+
else
248+
{
249+
predicted_nb_block_cmvs = 1;
250+
}
257251
return std::make_pair( predicted_nb_block_cmvs,
258252
nb_block_cmvs == predicted_nb_block_cmvs
259253
? std::nullopt
@@ -265,12 +259,16 @@ namespace
265259
.point( unique_vertex_cmvs.block_cmvs[0].vertex )
266260
.string(),
267261
"] is part of Block ", brep.block( block_uuid ).name(),
268-
" (", block_uuid.string(), "), and part of ",
269-
nb_internal_surfaces,
270-
" surfaces internal to that block, ", nb_free_lines,
271-
" free lines on different surfaces, and ",
272-
nb_lines_boundary_to_two_internal_lines,
273-
" lines boundary to strictly two internal lines, with ",
262+
" (", block_uuid.string(), "), and has ",
263+
nb_internal_surface_cmvs,
264+
" cmvs of surfaces internal to that block, ",
265+
nb_line_internal_to_internal_surface_cmvs,
266+
" cmvs of lines internal to one surface internal to that "
267+
"block, ",
268+
nb_free_line_cmvs, " cmvs of free lines, and ",
269+
nb_lines_boundary_to_two_internal_surfaces_cmvs,
270+
" cmvs of lines boundary to strictly two internal lines, "
271+
"with ",
274272
nb_block_cmvs, " Block CMVs (should be ",
275273
predicted_nb_block_cmvs, ")." ) ) );
276274
}

tests/inspector/test-brep.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ geode::index_t lines_topological_validity(
7979
result
8080
.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner
8181
.nb_issues();
82+
nb_issues +=
83+
result.line_edges_with_wrong_component_edges_around.nb_issues();
8284
geode::Logger::info( "BRep Lines Topology check: ", nb_issues, " issues." );
8385
if( string )
8486
{
@@ -102,6 +104,11 @@ geode::index_t surfaces_topological_validity(
102104
.nb_issues();
103105
nb_issues += result.unique_vertices_linked_to_several_and_invalid_surfaces
104106
.nb_issues();
107+
nb_issues +=
108+
result.unique_vertices_linked_to_a_surface_with_invalid_embbedings
109+
.nb_issues();
110+
nb_issues +=
111+
result.surface_polygons_with_wrong_component_facets_around.nb_issues();
105112
geode::Logger::info(
106113
"BRep Surfaces Topology check: ", nb_issues, " issues." );
107114
if( string )
@@ -121,13 +128,18 @@ geode::index_t blocks_topological_validity(
121128
nb_issues += issue.second.nb_issues();
122129
}
123130
nb_issues += result.some_blocks_not_meshed.nb_issues();
131+
nb_issues += result.wrong_block_boundary_surface.nb_issues();
124132
nb_issues +=
125133
result.unique_vertices_part_of_two_blocks_and_no_boundary_surface
126134
.nb_issues();
127135
nb_issues +=
128136
result.unique_vertices_with_incorrect_block_cmvs_count.nb_issues();
129137
nb_issues += result.unique_vertices_linked_to_a_single_and_invalid_surface
130138
.nb_issues();
139+
nb_issues += result.blocks_with_not_closed_boundary_surfaces.nb_issues();
140+
nb_issues += result.model_boundaries_dont_form_a_closed_surface.nb_issues();
141+
nb_issues +=
142+
result.unique_vertex_linked_to_multiple_invalid_surfaces.nb_issues();
131143
nb_issues +=
132144
result
133145
.unique_vertices_linked_to_surface_with_wrong_relationship_to_blocks
@@ -312,8 +324,8 @@ void check_model_a1( bool string )
312324

313325
const auto nb_topological_issues =
314326
launch_topological_validity_checks( result.topology, string );
315-
OPENGEODE_EXCEPTION( nb_topological_issues == 5164, "[Test] model_A1 has ",
316-
nb_topological_issues, " topological problems instead of 5164." );
327+
OPENGEODE_EXCEPTION( nb_topological_issues == 5201, "[Test] model_A1 has ",
328+
nb_topological_issues, " topological problems instead of 5201." );
317329

318330
const auto nb_component_meshes_issues =
319331
launch_component_meshes_validity_checks( result.meshes, string );
@@ -334,9 +346,9 @@ void check_model_a1_valid( bool string )
334346

335347
const auto nb_topological_issues =
336348
launch_topological_validity_checks( result.topology, string );
337-
OPENGEODE_EXCEPTION( nb_topological_issues == 5164,
349+
OPENGEODE_EXCEPTION( nb_topological_issues == 5201,
338350
"[Test] model_A1_valid has ", nb_topological_issues,
339-
" topological problems instead of 5164." );
351+
" topological problems instead of 5201." );
340352

341353
const auto nb_component_meshes_issues =
342354
launch_component_meshes_validity_checks( result.meshes, string );
@@ -357,8 +369,8 @@ void check_model_mss( bool string )
357369

358370
const auto nb_topological_issues =
359371
launch_topological_validity_checks( result.topology, string );
360-
OPENGEODE_EXCEPTION( nb_topological_issues == 36, "[Test] mss has ",
361-
nb_topological_issues, " topological problems instead of 36." );
372+
OPENGEODE_EXCEPTION( nb_topological_issues == 37, "[Test] mss has ",
373+
nb_topological_issues, " topological problems instead of 37." );
362374

363375
const auto nb_component_meshes_issues =
364376
launch_component_meshes_validity_checks( result.meshes, string );
@@ -435,7 +447,7 @@ int main()
435447
geode::Logger::set_level( geode::Logger::LEVEL::debug );
436448
check_model_a1( false );
437449
check_model_a1_valid( false );
438-
check_model_mss( true );
450+
check_model_mss( false );
439451
check_model_D( false );
440452
check_wrong_bsurfaces_model();
441453
check_segmented_cube();

0 commit comments

Comments
 (0)