Rodin::Geometry::Polytope class

Base class for all geometric elements in finite element meshes.

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;
}

Derived classes

class Cell
Represents a cell (highest-dimensional element) in a mesh.
class Face
Represents a face (codimension-1 element) in a mesh.
class Vertex
Represents a vertex (0-dimensional element) in a mesh.

Public types

struct Project
Projection operations for polytope sub-entities.
struct Traits
Geometric traits for polytope types.
enum class Type { Point, Segment, Triangle, Quadrilateral, Tetrahedron, Wedge }
Enumeration of supported polytope geometries.

Public static variables

static std::array<Type, 6> 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 -> Attribute
Gets the attribute (marker) of this polytope.
auto getMeasure() const -> Real
Gets the geometric measure of this polytope.
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 Array<Index>&
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.

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

Wedge

3D prismatic element (triangular prism)

Function documentation

Rodin::Geometry::Polytope::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

Index Rodin::Geometry::Polytope::getIndex() const

Gets the polytope's index within its dimension.

Returns Index $ i $ of this polytope

size_t Rodin::Geometry::Polytope::getDimension() const

Gets the topological dimension.

Returns Dimension $ d $ of this polytope

const MeshBase& Rodin::Geometry::Polytope::getMesh() const

Gets the containing mesh.

Returns Reference to the mesh this polytope belongs to

Attribute Rodin::Geometry::Polytope::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 Rodin::Geometry::Polytope::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 0
1Length
2Area
3Volume

const PolytopeTransformation& Rodin::Geometry::Polytope::getTransformation() const

Gets the geometric transformation for this polytope.

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

VertexIterator Rodin::Geometry::Polytope::getVertex() const

Gets an iterator over the vertices of this polytope.

Returns Iterator over all vertices

const Array<Index>& Rodin::Geometry::Polytope::getVertices() const

Gets the vertex indices defining this polytope.

Returns Array of vertex indices

PolytopeIterator Rodin::Geometry::Polytope::getAdjacent() const

Gets an iterator over polytopes adjacent to this one.

Returns Iterator over adjacent polytopes

Type Rodin::Geometry::Polytope::getGeometry() const

Gets the geometry type of this polytope.

Returns Geometry type (Triangle, Tetrahedron, etc.)

bool Rodin::Geometry::Polytope::isCell() const

Checks if this is a cell (maximal dimension).

Returns True if this polytope is a cell, false otherwise

bool Rodin::Geometry::Polytope::isFace() const

Checks if this is a face (codimension 1).

Returns True if this polytope is a face, false otherwise

bool Rodin::Geometry::Polytope::isVertex() const

Checks if this is a vertex (dimension 0).

Returns True if this polytope is a vertex, false otherwise

Polytope& Rodin::Geometry::Polytope::setAttribute()

Sets the attribute for this polytope.

Returns Reference to this polytope for method chaining

Variable documentation

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

Array of all supported polytope types.

Useful for iterating over all geometry types at compile time.