General concepts » Polytopes

Understanding the geometric elements in Rodin.

Introduction

In finite element analysis, a polytope is a geometric primitive that forms the building block of a mesh. A mesh is a collection of polytopes of various dimensions that together partition a domain $ \Omega $ .

In Rodin, polytopes are represented by the Polytope class and its associated Polytope::Type enumeration.

Polytope Dimensions

Polytopes exist in different dimensions, each with a specific role in the mesh:

DimensionNameRoleExample
0Vertex (Point)Mesh nodesCorner of a triangle
1Edge (Segment)Connections between verticesSide of a triangle, boundary in 2D
2FaceSurface elementsTriangle, Quadrilateral
3CellVolume elementsTetrahedron, Hexahedron, Wedge

The cells are the highest-dimensional polytopes in a mesh and correspond to the elements over which the finite element approximation is constructed. In a 2D mesh, the cells are faces (triangles or quadrilaterals); in 3D, the cells are volumes.

Available Polytope Types

The Polytope::Type enumeration defines the available element types:

TypeDimensionVerticesSimplicial?Description
Polytope::Type::Point01A single vertex
Polytope::Type::Segment12YesA line segment (edge)
Polytope::Type::Triangle23YesA triangular element
Polytope::Type::Quadrilateral24NoA quadrilateral (tensor-product) element
Polytope::Type::Tetrahedron34YesA tetrahedral element
Polytope::Type::Hexahedron38NoA hexahedral (brick, tensor-product) element
Polytope::Type::Wedge36NoA prismatic (wedge) element

Simplicial vs. tensor-product elements:**

  • Simplicial elements (triangle, tetrahedron) are the simplest shapes in their dimension. They are flexible for meshing complex geometries because any domain can be triangulated.
  • Tensor-product elements (quadrilateral, hexahedron) are formed as Cartesian products of lower-dimensional elements. They often provide higher accuracy per DOF on structured domains but are harder to fit to complex geometries.
  • The wedge (triangular prism) is a hybrid: a tensor product of a triangle and a segment.

Reference Elements

All local computations in the finite element method (basis function evaluation, quadrature, gradient computation) are performed on a reference element** $ \hat{K} $ , then mapped to each physical cell via a geometric transformation $ F_K : \hat{K} \to K $ . The reference element vertices for the standard types are:

TypeReference vertices
Segment $ (0), (1) $
Triangle $ (0,0), (1,0), (0,1) $
Quadrilateral $ (0,0), (1,0), (1,1), (0,1) $
Tetrahedron $ (0,0,0), (1,0,0), (0,1,0), (0,0,1) $

The Jacobian of $ F_K $ and its determinant are available at any quadrature point through the Point class:

// At a quadrature point p on element K:
auto J = p.getJacobian();              // d×d Jacobian matrix
auto detJ = p.getJacobianDeterminant();  // |J|

Using Polytopes for Mesh Generation

The polytope type determines the element shapes when generating uniform meshes via Mesh::UniformGrid():

#include <Rodin/Geometry.h>
using namespace Rodin::Geometry;

Mesh mesh;

// 2D meshes
mesh = mesh.UniformGrid(Polytope::Type::Triangle, {16, 16});
mesh = mesh.UniformGrid(Polytope::Type::Quadrilateral, {16, 16});

// 3D meshes
mesh = mesh.UniformGrid(Polytope::Type::Tetrahedron, {8, 8, 8});
mesh = mesh.UniformGrid(Polytope::Type::Hexahedron, {8, 8, 8});
mesh = mesh.UniformGrid(Polytope::Type::Wedge, {8, 8, 8});

Sub-Entities

Every polytope has sub-entities of lower dimension. For example, a triangle has 3 edges and 3 vertices; a tetrahedron has 4 faces, 6 edges, and 4 vertices. These relationships are captured by the Connectivity class.

To access sub-entity relationships, first compute the connectivity:

mesh.getConnectivity().compute(1, 2); // edges → cells
mesh.getConnectivity().compute(0, 2); // vertices → cells

Iterating Over Polytopes

You can iterate over polytopes of a given dimension using the mesh iterator interface:

// Iterate over cells (highest dimension)
for (auto it = mesh.getCell(); !it.end(); ++it)
{
  auto idx = it->getIndex();
  auto attr = it->getAttribute();
  // ... process cell ...
}

// Iterate over vertices
for (auto it = mesh.getVertex(); !it.end(); ++it)
{
  auto coords = it->getCoordinates();
  // ... process vertex ...
}

Choosing the Right Element Type

ProblemRecommended TypeReason
General 2D PDEsTriangleFlexible, good for complex geometries
Structured 2D gridsQuadrilateralBetter accuracy on rectangular domains
General 3D PDEsTetrahedronHandles complex 3D geometries
Structured 3D gridsHexahedronHigher accuracy per DOF

See Also