Skip to content

Commit

Permalink
fix(ModelTopology): Changed test to verify if all components meshes v…
Browse files Browse the repository at this point in the history
…ertices are linked to a unique vertex.

BREAKING CHANGE: inspector functions *linked_to_a_unique_vertex replaced by *linked_to_unique_vertices
  • Loading branch information
MelchiorSchuh committed Sep 26, 2023
1 parent 94d1a8e commit 2c84f5d
Show file tree
Hide file tree
Showing 14 changed files with 398 additions and 191 deletions.
16 changes: 8 additions & 8 deletions bindings/python/src/inspector/topology/brep_topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@
.def( pybind11::init< const BRep&, bool >() ) \
.def( "brep_topology_is_valid", \
&BRepTopologyInspector::brep_topology_is_valid ) \
.def( "brep_meshed_components_are_linked_to_a_unique_vertex", \
.def( "brep_meshed_components_are_linked_to_unique_vertices", \
&BRepTopologyInspector:: \
brep_meshed_components_are_linked_to_a_unique_vertex ) \
brep_meshed_components_are_linked_to_unique_vertices ) \
.def( "brep_unique_vertices_are_linked_to_a_component_vertex", \
&BRepTopologyInspector:: \
brep_unique_vertices_are_linked_to_a_component_vertex ) \
.def( "nb_corners_not_linked_to_a_unique_vertex", \
&BRepTopologyInspector::nb_corners_not_linked_to_a_unique_vertex ) \
.def( "nb_lines_meshed_but_not_linked_to_a_unique_vertex", \
.def( "nb_lines_meshed_but_not_linked_to_unique_vertices", \
&BRepTopologyInspector:: \
nb_lines_meshed_but_not_linked_to_a_unique_vertex ) \
.def( "nb_surfaces_meshed_but_not_linked_to_a_unique_vertex", \
nb_lines_meshed_but_not_linked_to_unique_vertices ) \
.def( "nb_surfaces_meshed_but_not_linked_to_unique_vertices", \
&BRepTopologyInspector:: \
nb_surfaces_meshed_but_not_linked_to_a_unique_vertex ) \
.def( "nb_blocks_meshed_but_not_linked_to_a_unique_vertex", \
nb_surfaces_meshed_but_not_linked_to_unique_vertices ) \
.def( "nb_blocks_meshed_but_not_linked_to_unique_vertices", \
&BRepTopologyInspector:: \
nb_blocks_meshed_but_not_linked_to_a_unique_vertex ) \
nb_blocks_meshed_but_not_linked_to_unique_vertices ) \
.def( "nb_unique_vertices_not_linked_to_a_component_vertex", \
&BRepTopologyInspector:: \
nb_unique_vertices_not_linked_to_a_component_vertex ) \
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/src/inspector/topology/section_topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
.def( pybind11::init< const Section&, bool >() ) \
.def( "section_topology_is_valid", \
&SectionTopologyInspector::section_topology_is_valid ) \
.def( "section_meshed_components_are_linked_to_a_unique_vertex", \
.def( "section_meshed_components_are_linked_to_unique_vertices", \
&SectionTopologyInspector:: \
section_meshed_components_are_linked_to_a_unique_vertex ) \
section_meshed_components_are_linked_to_unique_vertices ) \
.def( "section_unique_vertices_are_linked_to_a_component_vertex", \
&SectionTopologyInspector:: \
section_unique_vertices_are_linked_to_a_component_vertex ) \
.def( "nb_corners_not_linked_to_a_unique_vertex", \
&SectionTopologyInspector:: \
nb_corners_not_linked_to_a_unique_vertex ) \
.def( "nb_lines_meshed_but_not_linked_to_a_unique_vertex", \
.def( "nb_lines_meshed_but_not_linked_to_unique_vertices", \
&SectionTopologyInspector:: \
nb_lines_meshed_but_not_linked_to_a_unique_vertex ) \
.def( "nb_surfaces_meshed_but_not_linked_to_a_unique_vertex", \
nb_lines_meshed_but_not_linked_to_unique_vertices ) \
.def( "nb_surfaces_meshed_but_not_linked_to_unique_vertices", \
&SectionTopologyInspector:: \
nb_surfaces_meshed_but_not_linked_to_a_unique_vertex ) \
nb_surfaces_meshed_but_not_linked_to_unique_vertices ) \
.def( "nb_unique_vertices_not_linked_to_a_component_vertex", \
&SectionTopologyInspector:: \
nb_unique_vertices_not_linked_to_a_component_vertex ) \
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/tests/test-py-brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def check_components_linking(brep_inspector):
nb_unlinked_corners = brep_inspector.nb_corners_not_linked_to_a_unique_vertex()
print("There are ", nb_unlinked_corners,
" corners not linked to a unique vertex.")
nb_unlinked_lines = brep_inspector.nb_lines_meshed_but_not_linked_to_a_unique_vertex()
nb_unlinked_lines = brep_inspector.nb_lines_meshed_but_not_linked_to_unique_vertices()
print("There are ", nb_unlinked_lines,
" lines meshed but not linked to a unique vertex.")
nb_unlinked_surfaces = brep_inspector.nb_surfaces_meshed_but_not_linked_to_a_unique_vertex()
" lines meshed but not linked to unique vertices.")
nb_unlinked_surfaces = brep_inspector.nb_surfaces_meshed_but_not_linked_to_unique_vertices()
print("There are ", nb_unlinked_surfaces,
" surfaces meshed but not linked to a unique vertex.")
nb_unlinked_blocks = brep_inspector.nb_blocks_meshed_but_not_linked_to_a_unique_vertex()
" surfaces meshed but not linked to unique vertices.")
nb_unlinked_blocks = brep_inspector.nb_blocks_meshed_but_not_linked_to_unique_vertices()
print("There are ", nb_unlinked_blocks,
" blocks meshed but not linked to a unique vertex.")
" blocks meshed but not linked to unique vertices.")
nb_unlinked_uv = brep_inspector.nb_unique_vertices_not_linked_to_a_component_vertex()
print("There are ", nb_unlinked_uv,
" unique vertices not linked to a component mesh vertex.")
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/tests/test-py-section.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def check_components_linking(section_inspector):
nb_unlinked_corners = section_inspector.nb_corners_not_linked_to_a_unique_vertex()
print("There are ", nb_unlinked_corners,
" corners not linked to a unique vertex.")
nb_unlinked_lines = section_inspector.nb_lines_meshed_but_not_linked_to_a_unique_vertex()
nb_unlinked_lines = section_inspector.nb_lines_meshed_but_not_linked_to_unique_vertices()
print("There are ", nb_unlinked_lines,
" lines meshed but not linked to a unique vertex.")
nb_unlinked_surfaces = section_inspector.nb_surfaces_meshed_but_not_linked_to_a_unique_vertex()
" lines meshed but not linked to unique vertices.")
nb_unlinked_surfaces = section_inspector.nb_surfaces_meshed_but_not_linked_to_unique_vertices()
print("There are ", nb_unlinked_surfaces,
" surfaces meshed but not linked to a unique vertex.")
" surfaces meshed but not linked to unique vertices.")
nb_unlinked_uv = section_inspector.nb_unique_vertices_not_linked_to_a_component_vertex()
print("There are ", nb_unlinked_uv,
" unique vertices not linked to a component mesh vertex.")
Expand Down
12 changes: 8 additions & 4 deletions include/geode/inspector/topology/brep_topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace geode
{
struct ComponentMeshVertex;
class BRep;
} // namespace geode

Expand All @@ -54,20 +55,23 @@ namespace geode
*/
bool brep_topology_is_valid() const;

bool brep_meshed_components_are_linked_to_a_unique_vertex() const;
bool brep_meshed_components_are_linked_to_unique_vertices() const;

bool brep_unique_vertices_are_linked_to_a_component_vertex() const;

index_t nb_corners_not_linked_to_a_unique_vertex() const;

index_t nb_lines_meshed_but_not_linked_to_a_unique_vertex() const;
index_t nb_lines_meshed_but_not_linked_to_unique_vertices() const;

index_t nb_surfaces_meshed_but_not_linked_to_a_unique_vertex() const;
index_t nb_surfaces_meshed_but_not_linked_to_unique_vertices() const;

index_t nb_blocks_meshed_but_not_linked_to_a_unique_vertex() const;
index_t nb_blocks_meshed_but_not_linked_to_unique_vertices() const;

index_t nb_unique_vertices_not_linked_to_a_component_vertex() const;

std::vector< ComponentMeshVertex >
component_vertices_not_linked_to_a_unique_vertex() const;

std::vector< index_t >
unique_vertices_not_linked_to_a_component_vertex() const;

Expand Down
10 changes: 7 additions & 3 deletions include/geode/inspector/topology/section_topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace geode
{
struct ComponentMeshVertex;
class Section;
} // namespace geode

Expand All @@ -54,18 +55,21 @@ namespace geode
*/
bool section_topology_is_valid() const;

bool section_meshed_components_are_linked_to_a_unique_vertex() const;
bool section_meshed_components_are_linked_to_unique_vertices() const;

bool section_unique_vertices_are_linked_to_a_component_vertex() const;

index_t nb_corners_not_linked_to_a_unique_vertex() const;

index_t nb_lines_meshed_but_not_linked_to_a_unique_vertex() const;
index_t nb_lines_meshed_but_not_linked_to_unique_vertices() const;

index_t nb_surfaces_meshed_but_not_linked_to_a_unique_vertex() const;
index_t nb_surfaces_meshed_but_not_linked_to_unique_vertices() const;

index_t nb_unique_vertices_not_linked_to_a_component_vertex() const;

std::vector< ComponentMeshVertex >
component_vertices_not_linked_to_a_unique_vertex() const;

std::vector< index_t >
unique_vertices_not_linked_to_a_component_vertex() const;

Expand Down
30 changes: 5 additions & 25 deletions src/bin/geode-inspector-brep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,15 @@ void inspect_brep( const geode::BRep& brep )
{
const auto verbose = absl::GetFlag( FLAGS_verbose );
const geode::BRepInspector brep_inspector{ brep, verbose };
absl::InlinedVector< async::task< void >, 30 > tasks;
absl::InlinedVector< async::task< void >, 27 > tasks;
if( absl::GetFlag( FLAGS_component_linking ) )
{
tasks.emplace_back( async::spawn( [&brep_inspector] {
const auto nb_corners =
brep_inspector.nb_corners_not_linked_to_a_unique_vertex();
geode::Logger::info(
nb_corners, " corners not linked to a unique vertex" );
} ) );
tasks.emplace_back( async::spawn( [&brep_inspector] {
const auto nb_lines =
const auto unlinked_component_vertices =
brep_inspector
.nb_lines_meshed_but_not_linked_to_a_unique_vertex();
geode::Logger::info(
nb_lines, " lines meshed but not linked to a unique vertex" );
} ) );
tasks.emplace_back( async::spawn( [&brep_inspector] {
const auto nb_surfaces =
brep_inspector
.nb_surfaces_meshed_but_not_linked_to_a_unique_vertex();
geode::Logger::info( nb_surfaces,
" surfaces meshed but not linked to a unique vertex" );
} ) );
tasks.emplace_back( async::spawn( [&brep_inspector] {
const auto nb_blocks =
brep_inspector
.nb_blocks_meshed_but_not_linked_to_a_unique_vertex();
geode::Logger::info(
nb_blocks, " blocks meshed but not linked to a unique vertex" );
.component_vertices_not_linked_to_a_unique_vertex();
geode::Logger::info( unlinked_component_vertices.size(),
" component vertices not linked to a unique vertex" );
} ) );
tasks.emplace_back( async::spawn( [&brep_inspector] {
const auto nb_unlinked_uv =
Expand Down
115 changes: 102 additions & 13 deletions src/bin/geode-inspector-cross-section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ ABSL_FLAG( bool,
component_linking,
true,
"Toggle components linking to unique vertices criterion" );
ABSL_FLAG( bool,
unique_vertices_colocation,
true,
"Toggle inspection of unique vertices colocation" );
ABSL_FLAG( bool,
corners,
true,
Expand All @@ -55,6 +59,16 @@ ABSL_FLAG( bool,
surfaces,
true,
"Toggle inspection of surfaces topology through unique vertices" );
ABSL_FLAG( bool, adjacency, true, "Toggle adjacency criterion for components" );
ABSL_FLAG(
bool, colocation, true, "Toggle colocation criterion for components" );
ABSL_FLAG(
bool, degeneration, true, "Toggle degeneration criterion for components" );
ABSL_FLAG( bool, manifold, true, "Toggle manifold criterion for components" );
ABSL_FLAG( bool,
intersection,
true,
"Toggle intersection criterion (only between triangulated surfaces)" );
ABSL_FLAG( bool,
verbose,
false,
Expand All @@ -66,29 +80,39 @@ void inspect_cross_section( const geode::CrossSection& cross_section )
const auto verbose = absl::GetFlag( FLAGS_verbose );
const geode::SectionInspector cross_section_inspector{ cross_section,
verbose };
absl::InlinedVector< async::task< void >, 12 > tasks;
absl::InlinedVector< async::task< void >, 20 > tasks;
if( absl::GetFlag( FLAGS_component_linking ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb_corners =
const auto unlinked_component_vertices =
cross_section_inspector
.nb_corners_not_linked_to_a_unique_vertex();
geode::Logger::info(
nb_corners, " corners not linked to a unique vertex" );
.component_vertices_not_linked_to_a_unique_vertex();
geode::Logger::info( unlinked_component_vertices.size(),
" component vertices not linked to a unique vertex" );
} ) );
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb_lines =
const auto nb_unlinked_uv =
cross_section_inspector
.nb_lines_meshed_but_not_linked_to_a_unique_vertex();
geode::Logger::info(
nb_lines, " lines meshed but not linked to a unique vertex" );
.nb_unique_vertices_not_linked_to_a_component_vertex();
geode::Logger::info( nb_unlinked_uv,
" unique vertices not linked to a component mesh vertex" );
} ) );
}
if( absl::GetFlag( FLAGS_unique_vertices_colocation ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb_surfaces =
const auto nb_unique_vertices =
cross_section_inspector
.nb_surfaces_meshed_but_not_linked_to_a_unique_vertex();
geode::Logger::info( nb_surfaces,
" surfaces meshed but not linked to a unique vertex" );
.nb_unique_vertices_linked_to_different_points();
geode::Logger::info( nb_unique_vertices,
" unique vertices linked to mesh points at "
"different positions" );
} ) );
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb_unique_vertices =
cross_section_inspector.nb_colocated_unique_vertices();
geode::Logger::info(
nb_unique_vertices, " unique vertices which are colocated" );
} ) );
}
if( absl::GetFlag( FLAGS_corners ) )
Expand Down Expand Up @@ -165,6 +189,71 @@ void inspect_cross_section( const geode::CrossSection& cross_section )
geode::Logger::info( nb,
" unique vertices part of surfaces with invalid topology." );
} ) );
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb =
cross_section_inspector
.part_of_line_and_not_on_surface_border_unique_vertices()
.size();
geode::Logger::info( nb,
" unique vertices part of a line and a surface but for "
"which one of the associated vertex on the surface mesh is not "
"on the mesh border." );
} ) );
}
if( absl::GetFlag( FLAGS_adjacency ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb = cross_section_inspector
.surfaces_nb_edges_with_wrong_adjacencies()
.size();
geode::Logger::info(
nb, " surfaces with adjacency problems in their mesh." );
} ) );
}
if( absl::GetFlag( FLAGS_colocation ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb =
cross_section_inspector.components_nb_colocated_points().size();
geode::Logger::info(
nb, " components with colocated points in their mesh." );
} ) );
}
if( absl::GetFlag( FLAGS_degeneration ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb =
cross_section_inspector.components_nb_degenerated_elements()
.size();
geode::Logger::info(
nb, " components with degenerated elements in their mesh." );
} ) );
}
if( absl::GetFlag( FLAGS_manifold ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb = cross_section_inspector
.component_meshes_nb_non_manifold_vertices()
.size();
geode::Logger::info(
nb, " components with non manifold vertices in their mesh." );
} ) );
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb =
cross_section_inspector.component_meshes_non_manifold_edges()
.size();
geode::Logger::info(
nb, " components with non manifold edges in their mesh." );
} ) );
}
if( absl::GetFlag( FLAGS_intersection ) )
{
tasks.emplace_back( async::spawn( [&cross_section_inspector] {
const auto nb = cross_section_inspector
.nb_intersecting_surfaces_elements_pair();
geode::Logger::info(
nb, " pairs of component triangles intersecting each other." );
} ) );
}
for( auto& task : async::when_all( tasks.begin(), tasks.end() ).get() )
{
Expand Down
Loading

0 comments on commit 2c84f5d

Please sign in to comment.