Polytope

Base class for all geometric elements in finite element meshes.

Defined in Rodin/Geometry/Polytope.h

class Polytope;

A Polytope represents a geometric entity in a finite element mesh, ranging from vertices (0D) to cells (highest dimension). Polytopes are the building blocks of mesh topology and provide the geometric foundation for finite element computations.

Mathematical Foundation

Each polytope $ \tau $ in a mesh $ \mathcal{T}_h $ has:

  • A dimension $ d $ (0 for vertices, 1 for edges, etc.)
  • An index $ i $ unique within its dimension
  • An associated reference element $ K $
  • A transformation $ x: K \rightarrow \tau $ mapping reference to physical coordinates

Hierarchy

The Polytope class serves as the base for specialized classes:

  • Cell: Highest-dimensional elements (e.g., tetrahedra in 3D, triangles in 2D)
  • Face: Codimension-1 elements (e.g., triangles in 3D, edges in 2D)
  • Vertex: 0-dimensional points

Usage

Polytopes are typically obtained through iterators:

for (auto it = mesh.getCell(); it; ++it)
{
  const Cell& cell = *it;
  std::cout << "Cell " << cell.getIndex() 
            << " has measure " << cell.getMeasure() << std::endl;
}

S

Direct inheritance by class family
Polytope
↓

Derived classes

Derived classDescription
Cellpublic
Full type
Cell
Represents a cell (highest-dimensional element) in a mesh.
Facepublic
Full type
Face
Represents a face (codimension-1 element) in a mesh.
Vertexpublic
Full type
Vertex
Represents a vertex (0-dimensional element) in a mesh.

Public types

class Key
Vertex index array identifying a polytope in the mesh.
struct Project
Projection operations for polytope sub-entities.
struct Traits
Geometric traits for polytope types.
enum class Type { Point, Segment, Triangle, Quadrilateral, Tetrahedron, Pyramid, Hexahedron, Wedge }
Enumeration of supported polytope geometries.

Public static variables

static std::array<Type, 8> Types constexpr
Array of all supported polytope types.

Constructors, destructors, conversion operators

Polytope(size_t dimension, Index index, const MeshBase& mesh)
Constructs a polytope with given dimension and index.
Polytope(const Polytope& other)
Copy constructor.
Polytope(Polytope&& other)
Move constructor.
~Polytope() defaulted virtual
Virtual destructor.

Public functions

auto operator=(const Polytope& other) -> Polytope&
Copy assignment operator.
auto operator=(Polytope&& other) -> Polytope&
Move assignment operator.
auto getIndex() const -> Index
Gets the polytope's index within its dimension.
auto getDimension() const -> size_t
Gets the topological dimension.
auto getMesh() const -> const MeshBase&
Gets the containing mesh.
auto getAttribute() const -> Optional<Attribute>
Gets the attribute (marker) of this polytope.
auto getMeasure() const -> Real
Gets the geometric measure of this polytope.
auto getMeasure(size_t order) const -> Real
Integrates geometric measure with an explicitly selected quadrature order.
auto getTransformation() const -> const PolytopeTransformation&
Gets the geometric transformation for this polytope.
auto getVertex() const -> VertexIterator
Gets an iterator over the vertices of this polytope.
auto getVertices() const -> const Key&
Gets the vertex indices defining this polytope.
auto getAdjacent() const -> PolytopeIterator
Gets an iterator over polytopes adjacent to this one.
auto getGeometry() const -> Type
Gets the geometry type of this polytope.
auto isCell() const -> bool
Checks if this is a cell (maximal dimension).
auto isFace() const -> bool
Checks if this is a face (codimension 1).
auto isVertex() const -> bool
Checks if this is a vertex (dimension 0).
auto setAttribute() -> Polytope&
Sets the attribute for this polytope.
auto getQuadrature(const QF::QuadratureFormula& qf) const -> const PolytopeQuadrature&
Gets cached quadrature for this polytope.

Enum documentation

enum class Rodin::Geometry::Polytope::Type

Enumeration of supported polytope geometries.

This enumeration defines the geometric types supported in Rodin's finite element framework, covering both simplicial and tensor-product element families commonly used in numerical analysis.

Enumerators
Point

0D vertex element

Segment

1D line element

Triangle

2D triangular element

Quadrilateral

2D quadrilateral element

Tetrahedron

3D tetrahedral element

Pyramid

3D pyramidal element (quadrilateral base)

Hexahedron

3D hexahedral element

Wedge

3D prismatic element (triangular prism)

Function documentation

Polytope(size_t dimension, Index index, const MeshBase& mesh)

Constructs a polytope with given dimension and index.

Parameters
dimension in Topological dimension $ d $
index in Index $ i $ within the mesh
mesh in Reference to the containing mesh

Polytope(const Polytope& other)

Copy constructor.

Parameters
other Object to copy from.

Polytope(Polytope&& other)

Move constructor.

Parameters
other Object to move from.

Polytope& operator=(const Polytope& other)

Copy assignment operator.

Parameters
other Object to copy from.
Returns Reference to this object after the operation.

Polytope& operator=(Polytope&& other)

Move assignment operator.

Parameters
other Object to move from.
Returns Reference to this object after the operation.

Index getIndex() const

Gets the polytope's index within its dimension.

Returns Index $ i $ of this polytope

size_t getDimension() const

Gets the topological dimension.

Returns Dimension $ d $ of this polytope

const MeshBase& getMesh() const

Gets the containing mesh.

Returns Reference to the mesh this polytope belongs to

Optional<Attribute> getAttribute() const

Gets the attribute (marker) of this polytope.

Returns Attribute value

Attributes are typically used to mark material regions, boundary conditions, or other domain-specific properties.

Real getMeasure() const

Gets the geometric measure of this polytope.

Returns The measure (length/area/volume) of the polytope

Computes the $ d $ -dimensional measure of the polytope:

DimensionMeasure
0Always 1
1Length
2Area
3Volume

Real getMeasure(size_t order) const

Integrates geometric measure with an explicitly selected quadrature order.

Parameters
order Reference polynomial degree requested from the quadrature dispatcher.
Returns The integral of the positive geometric distortion.

The default overload integrates the determinant degree on regular polynomial volume maps. Embedded and rational maps generally have nonpolynomial distortion; their default uses a conservative order policy, while this overload permits explicit accuracy studies.

const PolytopeTransformation& getTransformation() const

Gets the geometric transformation for this polytope.

Returns Reference to the transformation $ x: K \rightarrow \tau $

VertexIterator getVertex() const

Gets an iterator over the vertices of this polytope.

Returns Iterator over all vertices

const Key& getVertices() const

Gets the vertex indices defining this polytope.

Returns Array of vertex indices

PolytopeIterator getAdjacent() const

Gets an iterator over polytopes adjacent to this one.

Returns Iterator over adjacent polytopes

Type getGeometry() const

Gets the geometry type of this polytope.

Returns Geometry type (Triangle, Tetrahedron, etc.)

bool isCell() const

Checks if this is a cell (maximal dimension).

Returns True if this polytope is a cell, false otherwise

bool isFace() const

Checks if this is a face (codimension 1).

Returns True if this polytope is a face, false otherwise

bool isVertex() const

Checks if this is a vertex (dimension 0).

Returns True if this polytope is a vertex, false otherwise

Polytope& setAttribute()

Sets the attribute for this polytope.

Returns Reference to this polytope for method chaining

const PolytopeQuadrature& getQuadrature(const QF::QuadratureFormula& qf) const

Gets cached quadrature for this polytope.

Parameters
qf in Quadrature formula
Returns Cached quadrature for this polytope.

Variable documentation

static std::array<Type, 8> Rodin::Geometry::Polytope::Types constexpr

Array of all supported polytope types.

Useful for iterating over all geometry types at compile time.