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:

TypeDimensionVerticesDescription
Polytope::Type::Point01A single vertex
Polytope::Type::Segment12A line segment (edge)
Polytope::Type::Triangle23A triangular element
Polytope::Type::Quadrilateral24A quadrilateral element
Polytope::Type::Tetrahedron34A tetrahedral element
Polytope::Type::Hexahedron38A hexahedral (brick) element
Polytope::Type::Wedge36A prismatic (wedge) element

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