Skip to content

Commit 51edfe3

Browse files
committed
feat(Topology): Added checks to see if unique vertices are linked to existing cmvs, and if these links are bijective.
1 parent 2c8f0a8 commit 51edfe3

22 files changed

+509
-273
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ namespace geode
155155
.def( pybind11::init< const BRep& >() )
156156
.def( "brep_topology_is_valid",
157157
&BRepTopologyInspector::brep_topology_is_valid )
158-
.def( "brep_meshed_components_are_linked_to_unique_vertices",
158+
.def( "brep_unique_vertices_are_bijectively_linked_to_an_existing_"
159+
"component_vertex",
159160
&BRepTopologyInspector::
160-
brep_meshed_components_are_linked_to_unique_vertices )
161-
.def( "brep_unique_vertices_are_linked_to_a_component_vertex",
162-
&BRepTopologyInspector::
163-
brep_unique_vertices_are_linked_to_a_component_vertex )
161+
brep_unique_vertices_are_bijectively_linked_to_an_existing_component_vertex )
164162
.def( "inspect_brep_topology",
165163
&BRepTopologyInspector::inspect_brep_topology );
166164
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ namespace geode
124124
.def( pybind11::init< const Section& >() )
125125
.def( "section_topology_is_valid",
126126
&SectionTopologyInspector::section_topology_is_valid )
127-
.def( "section_meshed_components_are_linked_to_unique_vertices",
127+
.def( "section_unique_vertices_are_bijectively_linked_to_an_"
128+
"existing_component_vertex",
128129
&SectionTopologyInspector::
129-
section_meshed_components_are_linked_to_unique_vertices )
130-
.def( "section_unique_vertices_are_linked_to_a_component_vertex",
131-
&SectionTopologyInspector::
132-
section_unique_vertices_are_linked_to_a_component_vertex )
130+
section_unique_vertices_are_bijectively_linked_to_an_existing_component_vertex )
133131
.def( "inspect_section_topology",
134132
&SectionTopologyInspector::inspect_section_topology );
135133
}

include/geode/inspector/topology/brep_blocks_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
namespace geode
3737
{
38+
FORWARD_DECLARATION_DIMENSION_CLASS( Block );
39+
ALIAS_3D( Block );
3840
struct ComponentMeshVertex;
3941
class BRep;
4042
} // namespace geode
@@ -82,6 +84,11 @@ namespace geode
8284
[[nodiscard]] bool brep_blocks_topology_is_valid(
8385
index_t unique_vertex_index ) const;
8486

87+
[[nodiscard]] bool block_is_meshed( const Block3D& block ) const;
88+
89+
[[nodiscard]] bool block_vertices_are_associated_to_unique_vertices(
90+
const Block3D& block ) const;
91+
8592
[[nodiscard]] std::optional< std::string >
8693
unique_vertex_is_part_of_two_blocks_and_no_boundary_surface(
8794
index_t unique_vertex_index ) const;

include/geode/inspector/topology/brep_corners_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
namespace geode
3535
{
36+
FORWARD_DECLARATION_DIMENSION_CLASS( Corner );
37+
ALIAS_3D( Corner );
3638
class BRep;
3739
} // namespace geode
3840

@@ -88,6 +90,11 @@ namespace geode
8890
[[nodiscard]] bool brep_corner_topology_is_valid(
8991
index_t unique_vertex_index ) const;
9092

93+
[[nodiscard]] bool corner_is_meshed( const Corner3D& corner ) const;
94+
95+
[[nodiscard]] bool corner_vertices_are_associated_to_unique_vertices(
96+
const Corner3D& corner ) const;
97+
9198
[[nodiscard]] std::optional< std::string >
9299
unique_vertex_has_multiple_corners(
93100
index_t unique_vertex_index ) const;

include/geode/inspector/topology/brep_lines_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
namespace geode
3434
{
35+
FORWARD_DECLARATION_DIMENSION_CLASS( Line );
36+
ALIAS_3D( Line );
3537
struct ComponentMeshVertex;
3638
class BRep;
3739
} // namespace geode
@@ -95,6 +97,11 @@ namespace geode
9597
[[nodiscard]] bool brep_lines_topology_is_valid(
9698
index_t unique_vertex_index ) const;
9799

100+
[[nodiscard]] bool line_is_meshed( const Line3D& line ) const;
101+
102+
[[nodiscard]] bool line_vertices_are_associated_to_unique_vertices(
103+
const Line3D& line ) const;
104+
98105
[[nodiscard]] std::optional< std::string >
99106
vertex_is_part_of_not_internal_nor_boundary_line(
100107
index_t unique_vertex_index ) const;

include/geode/inspector/topology/brep_surfaces_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
namespace geode
3333
{
34+
FORWARD_DECLARATION_DIMENSION_CLASS( Surface );
35+
ALIAS_3D( Surface );
3436
class BRep;
3537
} // namespace geode
3638

@@ -105,6 +107,11 @@ namespace geode
105107
[[nodiscard]] bool brep_surfaces_topology_is_valid(
106108
index_t unique_vertex_index ) const;
107109

110+
[[nodiscard]] bool surface_is_meshed( const Surface3D& surface ) const;
111+
112+
[[nodiscard]] bool surface_vertices_are_associated_to_unique_vertices(
113+
const Surface3D& surface ) const;
114+
108115
[[nodiscard]] std::optional< std::string >
109116
vertex_is_part_of_not_internal_nor_boundary_surface(
110117
index_t unique_vertex_index ) const;

include/geode/inspector/topology/brep_topology.hpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,22 @@ namespace geode
4848
InspectionIssues< index_t > unique_vertices_not_linked_to_any_component{
4949
"Unique vertices not linked to any component"
5050
};
51+
InspectionIssues< index_t > unique_vertices_linked_to_inexistant_cmv{
52+
"Unique vertices linked to inexistant ComponentMeshVertex"
53+
};
54+
InspectionIssues< index_t >
55+
unique_vertices_nonbijectively_linked_to_cmv{
56+
"Unique vertices with links to ComponentMeshVertex that are "
57+
"not bijective"
58+
};
5159

5260
[[nodiscard]] index_t nb_issues() const;
5361

5462
[[nodiscard]] std::string string() const;
5563

5664
[[nodiscard]] std::string inspection_type() const;
5765
};
66+
5867
/*!
5968
* Class for inspecting the topology of a BRep model corners
6069
*/
@@ -78,10 +87,8 @@ namespace geode
7887
[[nodiscard]] bool brep_topology_is_valid() const;
7988

8089
[[nodiscard]] bool
81-
brep_meshed_components_are_linked_to_unique_vertices() const;
82-
83-
[[nodiscard]] bool
84-
brep_unique_vertices_are_linked_to_a_component_vertex() const;
90+
brep_unique_vertices_are_bijectively_linked_to_an_existing_component_vertex()
91+
const;
8592

8693
[[nodiscard]] BRepTopologyInspectionResult
8794
inspect_brep_topology() const;

include/geode/inspector/topology/internal/topology_helpers.hpp

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,44 @@ namespace geode
6868
return component_uuids;
6969
}
7070

71+
template < typename Model, typename Mesh >
72+
bool model_component_vertices_are_associated_to_unique_vertices(
73+
const Model& model,
74+
const ComponentID& component_id,
75+
const Mesh& component_mesh )
76+
{
77+
for( const auto component_vertex :
78+
Range{ component_mesh.nb_vertices() } )
79+
{
80+
if( model.unique_vertex( { component_id, component_vertex } )
81+
== NO_ID )
82+
{
83+
return false;
84+
}
85+
}
86+
return true;
87+
}
88+
89+
template < typename Model, typename Mesh >
7190
[[nodiscard]] InspectionIssues< index_t >
72-
brep_component_vertices_not_associated_to_unique_vertices(
73-
const BRep& brep,
74-
const ComponentID& component_id,
75-
const VertexSet& component_mesh );
76-
[[nodiscard]] InspectionIssues< index_t >
77-
section_component_vertices_are_associated_to_unique_vertices(
78-
const Section& section,
91+
model_component_vertices_not_associated_to_unique_vertices(
92+
const Model& model,
7993
const ComponentID& component_id,
80-
const VertexSet& component_mesh );
94+
const Mesh& component_mesh )
95+
{
96+
InspectionIssues< index_t > result;
97+
for( const auto vertex_id : Range{ component_mesh.nb_vertices() } )
98+
{
99+
ComponentMeshVertex component_mesh_vertex{ component_id,
100+
vertex_id };
101+
if( model.unique_vertex( component_mesh_vertex ) == NO_ID )
102+
{
103+
result.add_issue( vertex_id,
104+
absl::StrCat( "Vertex '", vertex_id,
105+
"' is not linked to a unique vertex." ) );
106+
}
107+
}
108+
return result;
109+
}
81110
} // namespace internal
82111
} // namespace geode

include/geode/inspector/topology/section_corners_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
namespace geode
3434
{
35+
FORWARD_DECLARATION_DIMENSION_CLASS( Corner );
36+
ALIAS_2D( Corner );
3537
class Section;
3638
} // namespace geode
3739

@@ -88,6 +90,11 @@ namespace geode
8890
[[nodiscard]] bool section_corner_topology_is_valid(
8991
index_t unique_vertex_index ) const;
9092

93+
[[nodiscard]] bool corner_is_meshed( const Corner2D& corner ) const;
94+
95+
[[nodiscard]] bool corner_vertices_are_associated_to_unique_vertices(
96+
const Corner2D& corner ) const;
97+
9198
[[nodiscard]] std::optional< std::string >
9299
unique_vertex_has_multiple_corners(
93100
index_t unique_vertex_index ) const;

include/geode/inspector/topology/section_lines_topology.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
namespace geode
3232
{
33+
FORWARD_DECLARATION_DIMENSION_CLASS( Line );
34+
ALIAS_2D( Line );
3335
class Section;
3436
} // namespace geode
3537

@@ -95,6 +97,11 @@ namespace geode
9597
[[nodiscard]] bool section_lines_topology_is_valid(
9698
index_t unique_vertex_index ) const;
9799

100+
[[nodiscard]] bool line_is_meshed( const Line2D& line ) const;
101+
102+
[[nodiscard]] bool line_vertices_are_associated_to_unique_vertices(
103+
const Line2D& line ) const;
104+
98105
[[nodiscard]] std::optional< std::string >
99106
vertex_is_part_of_not_internal_nor_boundary_line(
100107
const index_t unique_vertex_index ) const;

0 commit comments

Comments
 (0)