Skip to content

Commit 888b673

Browse files
committed
Add Elem::n_vertices_per_side()
1 parent e61fa8e commit 888b673

File tree

13 files changed

+69
-0
lines changed

13 files changed

+69
-0
lines changed

include/geom/cell_hex.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ class Hex : public Cell
7777
*/
7878
virtual unsigned int n_vertices() const override final { return 8; }
7979

80+
/**
81+
* \returns 4. Every side has four vertices.
82+
*/
83+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 4; }
84+
8085
/**
8186
* \returns 12. All hexahedra have 12 edges.
8287
*/

include/geom/cell_inf_hex.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class InfHex : public InfCell
9090
*/
9191
virtual unsigned int n_vertices() const override final { return 8; }
9292

93+
/**
94+
* \returns 4. Every side has four vertices.
95+
*/
96+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 4; }
97+
9398
/**
9499
* \returns \p true if the specified (local) node number is a
95100
* "mid-edge" node on an infinite element edge.

include/geom/cell_inf_prism.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ class InfPrism : public InfCell
8686
*/
8787
virtual unsigned int n_vertices() const override final { return 6; }
8888

89+
virtual unsigned int n_vertices_on_side(const unsigned int side) const override final
90+
{ return 4 - (side == 0 || side == 4); }
91+
8992
/**
9093
* \returns 6. All infinite prisms have 6 edges,
9194
* 3 lying in the base, and 3 perpendicular to the base.

include/geom/cell_prism.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class Prism : public Cell
8383
*/
8484
virtual unsigned int n_vertices() const override final { return 6; }
8585

86+
virtual unsigned int n_vertices_on_side(const unsigned int side) const override final
87+
{ return 4 - (side == 0 || side == 4); }
88+
8689
/**
8790
* \returns 9. All prisms have 9 edges.
8891
*/

include/geom/cell_pyramid.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class Pyramid : public Cell
8787
*/
8888
virtual unsigned int n_vertices() const override { return 5; }
8989

90+
virtual unsigned int n_vertices_on_side(const unsigned int side) const override final
91+
{ return 4 - (side != 4); }
92+
9093
/**
9194
* \returns 8. All pyramids have 8 edges.
9295
*/

include/geom/cell_tet.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class Tet : public Cell
7878
*/
7979
virtual unsigned int n_vertices() const override final { return 4; }
8080

81+
/**
82+
* \returns 3. Every side has three vertices.
83+
*/
84+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 3; }
85+
8186
/**
8287
* \returns 6. All tetrahedra have 6 edges.
8388
*/

include/geom/edge.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class Edge : public Elem
7878
*/
7979
virtual unsigned int n_vertices() const override final { return 2; }
8080

81+
/**
82+
* \returns 1. Every side has one vertex.
83+
*/
84+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 1; }
85+
8186
/**
8287
* \returns 0. All 1D elements have no edges.
8388
*/

include/geom/elem.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@ class Elem : public ReferenceCountedObject<Elem>,
659659
*/
660660
virtual unsigned int n_vertices () const = 0;
661661

662+
/**
663+
* \returns The number of verticies on the side with index \p s.
664+
*/
665+
virtual unsigned int n_vertices_on_side (const unsigned int s) const = 0;
666+
662667
/**
663668
* \returns The number of edges the element that has been derived
664669
* from this class has.

include/geom/face.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class Face : public Elem
6666
*/
6767
virtual unsigned int n_faces() const override final { return 0; }
6868

69+
/**
70+
* \returns 2. Every side has two vertices.
71+
*/
72+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 2; }
73+
6974
/**
7075
* build_side and build_edge are identical for faces.
7176
*/

include/geom/face_inf_quad.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ class InfQuad : public Elem
106106
*/
107107
virtual unsigned int n_vertices() const override final { return 4; }
108108

109+
/**
110+
* \returns 2. Every side has two vertices.
111+
*/
112+
virtual unsigned int n_vertices_on_side(const unsigned int) const override final { return 2; }
113+
109114
/**
110115
* \returns 3. All infinite quads have 1 edge in the
111116
* base, and 2 perpendicular to the base.

0 commit comments

Comments
 (0)