Skip to content

Commit c86caaf

Browse files
author
Geode-solutions robot
committed
Merge remote-tracking branch 'origin/next'
2 parents a320bdf + ead4743 commit c86caaf

File tree

5 files changed

+92
-22
lines changed

5 files changed

+92
-22
lines changed

include/geode/inspector/criterion/adjacency/brep_meshes_adjacency.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ namespace geode
4545
{
4646
InspectionIssuesMap< PolygonEdge >
4747
surfaces_edges_with_wrong_adjacencies{
48-
"BRep Surface mesh with wrong adjacencies on polygon edges"
48+
"BRep Surface mesh with polygon edges adjacencies issues"
4949
};
5050
InspectionIssuesMap< PolyhedronFacet >
5151
blocks_facets_with_wrong_adjacencies{
52-
"BRep Block mesh with wrong adjacencies on polyhedron facets"
52+
"BRep Block mesh with polyhedron facets adjacencies issues"
5353
};
5454

5555
[[nodiscard]] std::string string() const;

include/geode/inspector/criterion/adjacency/section_meshes_adjacency.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace geode
4545
{
4646
InspectionIssuesMap< PolygonEdge >
4747
surfaces_edges_with_wrong_adjacencies{
48-
"Section Surface mesh with wrong adjacencies on polygon edges"
48+
"Section Surface mesh polygon edges adjacencies issues"
4949
};
5050

5151
[[nodiscard]] std::string string() const;

src/geode/inspector/criterion/adjacency/brep_meshes_adjacency.cpp

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#include <geode/basic/logger.hpp>
2929
#include <geode/basic/pimpl_impl.hpp>
3030

31+
#include <geode/mesh/core/solid_mesh.hpp>
32+
33+
#include <geode/model/helpers/component_mesh_polygons.hpp>
3134
#include <geode/model/mixin/core/block.hpp>
3235
#include <geode/model/representation/core/brep.hpp>
3336

@@ -78,11 +81,43 @@ namespace geode
7881
inspector.polyhedron_facets_with_wrong_adjacency();
7982
wrong_adjacencies.set_description(
8083
absl::StrCat( "Block with uuid ", block.id().string(),
81-
" wrong polyhedron facets adjacencies" ) );
84+
" polyhedron facets adjacencies issues" ) );
85+
const auto& mesh = block.mesh();
86+
for( const auto polyhedron_id : Range{ mesh.nb_polyhedra() } )
87+
{
88+
for( const auto facet_id :
89+
LRange{ mesh.nb_polyhedron_facets( polyhedron_id ) } )
90+
{
91+
const PolyhedronFacet polyhedron_facet{ polyhedron_id,
92+
facet_id };
93+
if( mesh.is_polyhedron_facet_on_border(
94+
polyhedron_facet )
95+
&& !polyhedron_facet_is_on_a_surface(
96+
block, polyhedron_facet ) )
97+
{
98+
wrong_adjacencies.add_issue( polyhedron_facet,
99+
absl::StrCat( "Local facet ", facet_id,
100+
" of polyhedron ", polyhedron_id,
101+
" has no adjacencies but is not part of a "
102+
"model Surface." ) );
103+
}
104+
}
105+
}
82106
components_wrong_adjacencies.add_issues_to_map(
83107
block.id(), std::move( wrong_adjacencies ) );
84108
}
85109
}
110+
111+
private:
112+
bool polyhedron_facet_is_on_a_surface( const Block3D& block,
113+
const PolyhedronFacet& polyhedron_facet ) const
114+
{
115+
const auto facet_unique_vertices =
116+
polygon_unique_vertices( model(), block, polyhedron_facet );
117+
return !detail::surface_component_mesh_polygons(
118+
model(), facet_unique_vertices )
119+
.empty();
120+
}
86121
};
87122

88123
BRepComponentMeshesAdjacency::BRepComponentMeshesAdjacency(

src/geode/inspector/criterion/internal/component_meshes_adjacency.cpp

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,28 @@
2727

2828
#include <geode/mesh/core/surface_mesh.hpp>
2929

30+
#include <geode/model/helpers/component_mesh_edges.hpp>
3031
#include <geode/model/mixin/core/surface.hpp>
3132
#include <geode/model/representation/core/brep.hpp>
3233
#include <geode/model/representation/core/section.hpp>
3334

3435
#include <geode/inspector/criterion/adjacency/surface_adjacency.hpp>
3536

37+
namespace
38+
{
39+
template < typename Model >
40+
bool polygon_edge_is_on_a_line( const Model& model,
41+
const geode::Surface< Model::dim >& surface,
42+
const geode::PolygonEdge& polygon_edge )
43+
{
44+
const auto edge_unique_vertices =
45+
geode::edge_unique_vertices( model, surface, polygon_edge );
46+
return !geode::detail::line_component_mesh_edges(
47+
model, edge_unique_vertices )
48+
.empty();
49+
}
50+
} // namespace
51+
3652
namespace geode
3753
{
3854
template < typename Model >
@@ -54,9 +70,27 @@ namespace geode
5470
surface.mesh()
5571
};
5672
auto issues = inspector.polygon_edges_with_wrong_adjacency();
57-
issues.set_description(
58-
absl::StrCat( "Surface ", surface.id().string(),
59-
" polygon edges with wrong adjacencies." ) );
73+
issues.set_description( absl::StrCat( "Surface ",
74+
surface.id().string(), " polygon edges adjacency issues." ) );
75+
const auto& mesh = surface.mesh();
76+
for( const auto polygon_id : Range{ mesh.nb_polygons() } )
77+
{
78+
for( const auto edge_id :
79+
LRange{ mesh.nb_polygon_edges( polygon_id ) } )
80+
{
81+
const PolygonEdge polygon_edge{ polygon_id, edge_id };
82+
if( mesh.is_edge_on_border( polygon_edge )
83+
&& !polygon_edge_is_on_a_line(
84+
model_, surface, polygon_edge ) )
85+
{
86+
issues.add_issue( polygon_edge,
87+
absl::StrCat( "Local edge ", edge_id,
88+
" of polygon ", polygon_id,
89+
" has no adjacencies but is not part of a "
90+
"model Line." ) );
91+
}
92+
}
93+
}
6094
components_wrong_adjacencies.add_issues_to_map(
6195
surface.id(), std::move( issues ) );
6296
}

src/geode/inspector/topology/brep_surfaces_topology.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ namespace
6868

6969
namespace geode
7070
{
71-
7271
std::string BRepSurfacesTopologyInspectionResult::string() const
7372
{
7473
std::string message;
@@ -391,27 +390,29 @@ namespace geode
391390
continue;
392391
}
393392
const auto& surface = brep_.surface( cmv.component_id.id() );
394-
if( !surface.mesh().is_vertex_on_border( cmv.vertex ) )
393+
if( surface.mesh().is_vertex_on_border( cmv.vertex ) )
394+
{
395+
continue;
396+
}
397+
for( const auto& line_id : line_uuids )
395398
{
396-
for( const auto& line_id : line_uuids )
399+
const auto& line = brep_.line( line_id );
400+
if( brep_.is_boundary( line, surface )
401+
|| brep_.is_internal( line, surface ) )
397402
{
398-
const auto& line = brep_.line( line_id );
399-
if( brep_.is_boundary( line, surface )
400-
|| brep_.is_internal( line, surface ) )
401-
{
402-
return absl::StrCat( "Unique vertex with index ",
403-
unique_vertex_index,
404-
" is part of a line and of surface with "
405-
"uuid '",
406-
cmv.component_id.id().string(),
407-
"' but the associated vertex in the "
408-
"surface mesh is not on the mesh border." );
409-
}
403+
return absl::StrCat( "Unique vertex with index ",
404+
unique_vertex_index,
405+
" is part of a line and of surface with "
406+
"uuid '",
407+
cmv.component_id.id().string(),
408+
"' but the associated vertex in the "
409+
"surface mesh is not on the mesh border." );
410410
}
411411
}
412412
}
413413
return std::nullopt;
414414
}
415+
415416
BRepSurfacesTopologyInspectionResult
416417
BRepSurfacesTopology::inspect_surfaces_topology() const
417418
{

0 commit comments

Comments
 (0)