Skip to content

Commit 7c81baa

Browse files
Merge pull request #132 from Geode-solutions/feat/check_existance_and_bijectivity_of_uv_to_cmv
feat(Topology): Added checks to see if unique vertices are linked to …
2 parents 2c8f0a8 + aae4233 commit 7c81baa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+608
-397
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
}

cmake/version.rc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BEGIN
1919
VALUE "InternalName", "@PROJECT_LIB_NAME@\0"
2020
VALUE "ProductName", "@PROJECT_LIB_NAME@\0"
2121
VALUE "CompanyName", "Geode-solutions SAS\0"
22-
VALUE "LegalCopyright", "Copyright 2019 - 2024 Geode-solutions SAS. All rights reserved.\0"
22+
VALUE "LegalCopyright", "Copyright 2019 - 2025 Geode-solutions SAS. All rights reserved.\0"
2323
VALUE "Commentaires", "https://geode-solutions.com\0"
2424
END
2525
END

include/geode/inspector/information.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ namespace geode
7272
{
7373
if( issues_.empty() )
7474
{
75-
return absl::StrCat( description_, " -> No Issues :)" );
75+
return absl::StrCat( description_, " -> No Issues :) \n" );
7676
}
7777
auto message = absl::StrCat( description_ );
7878
for( const auto& issue : messages_ )
7979
{
8080
absl::StrAppend( &message, "\n -> ", issue );
8181
}
82+
absl::StrAppend( &message, "\n" );
8283
return message;
8384
}
8485

@@ -136,13 +137,14 @@ namespace geode
136137
{
137138
if( issues_map_.empty() )
138139
{
139-
return absl::StrCat( description_, " -> No Issues :)" );
140+
return absl::StrCat( description_, " -> No Issues :) \n" );
140141
}
141142
auto message = absl::StrCat( description_ );
142143
for( const auto& issues : issues_map_ )
143144
{
144145
absl::StrAppend( &message, "\n -> ", issues.second.string() );
145146
}
147+
absl::StrAppend( &message, "\n" );
146148
return message;
147149
}
148150

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

0 commit comments

Comments
 (0)