Skip to content

Commit 513a98c

Browse files
committed
Arnaud's comments
1 parent fbadc4c commit 513a98c

File tree

2 files changed

+32
-66
lines changed

2 files changed

+32
-66
lines changed

include/geode/mesh/helpers/generic_solid_accessor.hpp

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,9 @@ namespace geode
4545
public:
4646
using ElementVertex = PolyhedronVertex;
4747
using ElementVertices = PolyhedronVertices;
48+
using ElementFacet = PolyhedronFacet;
4849
using ElementFacetVertices = PolyhedronFacetVertices;
4950

50-
struct ElementFacet
51-
{
52-
ElementFacet( index_t element, local_index_t facet )
53-
: element_id( element ), facet_id( facet )
54-
{
55-
}
56-
ElementFacet( PolyhedronFacet polyhedron_facet )
57-
: element_id( polyhedron_facet.polyhedron_id ),
58-
facet_id( polyhedron_facet.facet_id )
59-
{
60-
}
61-
62-
bool operator==( const ElementFacet& other ) const
63-
{
64-
return element_id == other.element_id
65-
&& facet_id == other.facet_id;
66-
}
67-
68-
index_t element_id;
69-
local_index_t facet_id;
70-
};
71-
7251
explicit GenericMeshAccessor( const SolidMesh< dimension >& mesh )
7352
: mesh_( mesh )
7453
{
@@ -94,6 +73,18 @@ namespace geode
9473
return mesh_.nb_polyhedron_facets( polyhedron_id );
9574
}
9675

76+
[[nodiscard]] index_t element_index(
77+
const ElementFacet& polyhedron_facet ) const
78+
{
79+
return polyhedron_facet.polyhedron_id;
80+
}
81+
82+
[[nodiscard]] index_t facet_index(
83+
const ElementFacet& polyhedron_facet ) const
84+
{
85+
return polyhedron_facet.facet_id;
86+
}
87+
9788
[[nodiscard]] index_t element_vertex(
9889
const ElementVertex& polyhedron_vertex ) const
9990
{
@@ -115,27 +106,19 @@ namespace geode
115106
[[nodiscard]] ElementFacetVertices element_facet_vertices(
116107
const ElementFacet& element_facet ) const
117108
{
118-
return mesh_.polyhedron_facet_vertices(
119-
{ element_facet.element_id, element_facet.facet_id } );
109+
return mesh_.polyhedron_facet_vertices( element_facet );
120110
}
121111

122112
[[nodiscard]] std::optional< index_t > element_adjacent(
123113
const ElementFacet& element_facet ) const
124114
{
125-
return mesh_.polyhedron_adjacent(
126-
{ element_facet.element_id, element_facet.facet_id } );
115+
return mesh_.polyhedron_adjacent( element_facet );
127116
}
128117

129118
[[nodiscard]] std::optional< ElementFacet > element_adjacent_facet(
130119
ElementFacet element_facet ) const
131120
{
132-
const auto adj = mesh_.polyhedron_adjacent_facet(
133-
{ element_facet.element_id, element_facet.facet_id } );
134-
if( adj )
135-
{
136-
return adj.value();
137-
}
138-
return std::nullopt;
121+
return mesh_.polyhedron_adjacent_facet( element_facet );
139122
}
140123

141124
[[nodiscard]] const uuid& id() const

include/geode/mesh/helpers/generic_surface_accessor.hpp

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,9 @@ namespace geode
4545
public:
4646
using ElementVertex = PolygonVertex;
4747
using ElementVertices = PolygonVertices;
48+
using ElementFacet = PolygonEdge;
4849
using ElementFacetVertices = std::array< index_t, 2 >;
4950

50-
struct ElementFacet
51-
{
52-
ElementFacet( index_t element, local_index_t facet )
53-
: element_id( element ), facet_id( facet )
54-
{
55-
}
56-
ElementFacet( PolygonEdge polygon_edge )
57-
: element_id( polygon_edge.polygon_id ),
58-
facet_id( polygon_edge.edge_id )
59-
{
60-
}
61-
62-
bool operator==( const ElementFacet& other ) const
63-
{
64-
return element_id == other.element_id
65-
&& facet_id == other.facet_id;
66-
}
67-
68-
index_t element_id;
69-
local_index_t facet_id;
70-
};
71-
7251
explicit GenericMeshAccessor( const SurfaceMesh< dimension >& mesh )
7352
: mesh_( mesh )
7453
{
@@ -94,6 +73,18 @@ namespace geode
9473
return mesh_.nb_polygon_edges( polygon_id );
9574
}
9675

76+
[[nodiscard]] index_t element_index(
77+
const ElementFacet& polygon_edge ) const
78+
{
79+
return polygon_edge.polygon_id;
80+
}
81+
82+
[[nodiscard]] index_t facet_index(
83+
const ElementFacet& polygon_edge ) const
84+
{
85+
return polygon_edge.edge_id;
86+
}
87+
9788
[[nodiscard]] index_t element_vertex(
9889
const ElementVertex& polygon_vertex ) const
9990
{
@@ -115,27 +106,19 @@ namespace geode
115106
[[nodiscard]] ElementFacetVertices element_facet_vertices(
116107
const ElementFacet& element_facet ) const
117108
{
118-
return mesh_.polygon_edge_vertices(
119-
{ element_facet.element_id, element_facet.facet_id } );
109+
return mesh_.polygon_edge_vertices( element_facet );
120110
}
121111

122112
[[nodiscard]] std::optional< index_t > element_adjacent(
123113
const ElementFacet& element_facet ) const
124114
{
125-
return mesh_.polygon_adjacent(
126-
{ element_facet.element_id, element_facet.facet_id } );
115+
return mesh_.polygon_adjacent( element_facet );
127116
}
128117

129118
[[nodiscard]] std::optional< ElementFacet > element_adjacent_facet(
130119
const ElementFacet& element_facet ) const
131120
{
132-
const auto adj = mesh_.polygon_adjacent_edge(
133-
{ element_facet.element_id, element_facet.facet_id } );
134-
if( adj )
135-
{
136-
return adj.value();
137-
}
138-
return std::nullopt;
121+
return mesh_.polygon_adjacent_edge( element_facet );
139122
}
140123

141124
[[nodiscard]] const uuid& id() const

0 commit comments

Comments
 (0)