General concepts » Meshes

Comprehensive guide to working with meshes in Rodin.

Introduction

A mesh is the fundamental data structure in finite element analysis, representing the discretization of a computational domain into simple geometric elements called polytopes.

In Rodin, the Mesh class provides a complete framework for representing, manipulating, and querying finite element meshes.

Key Concepts

Domain Partition

Mathematically, a mesh $ \mathcal{T}_h $ partitions a domain $ \Omega $ :

\[ \Omega = \bigcup_{K \in \mathcal{T}_h} K \]

where each $ K $ is a polytope (e.g., triangle, tetrahedron).

Dimensions

A mesh has two important dimensions:

  • Topological dimension (getDimension()): The dimension of the highest dimensional polytopes (e.g., 2 for triangular meshes, 3 for tetrahedral)
  • Space dimension (getSpaceDimension()): The dimension of the ambient space in which the mesh is embedded

Example: A 2D surface embedded in 3D space has topological dimension 2 and space dimension 3.

Mesh Entities

Meshes consist of entities of different dimensions:

DimensionNameExamples
0VerticesPoints
1EdgesLine segments
2Faces (2D) or Cells (2D meshes)Triangles, Quadrilaterals
3Cells (3D meshes)Tetrahedra, Hexahedra

Basic Usage

Here's a simple example creating and querying a mesh:

#include <Rodin/Geometry.h>

using namespace Rodin;
using namespace Rodin::Geometry;

int main() {
  // Create a 2D triangular mesh
  Mesh mesh;
  mesh = mesh.UniformGrid(Polytope::Type::Triangle, {16, 16});

  // Query mesh properties
  std::cout << "Dimension: " << mesh.getDimension() << std::endl;
  std::cout << "Vertices: " << mesh.getVertexCount() << std::endl;
  std::cout << "Cells: " << mesh.getCellCount() << std::endl;
  std::cout << "Volume: " << mesh.getVolume() << std::endl;

  return 0;
}

Detailed Topics

For detailed information on specific aspects of working with meshes, see:

See Also