General concepts » Connectivity

Understanding mesh connectivity in Rodin.

Introduction

Connectivity** (or incidence) information describes how the polytopes (vertices, edges, faces, cells) in a mesh relate to each other. In Rodin, this is managed by the Connectivity class, which is accessed through Mesh::getConnectivity().

Connectivity is essential for:

  • Identifying boundary entities for imposing boundary conditions
  • Traversing mesh topology during assembly
  • Finding neighbors and adjacencies

Notation

Connectivity is described as a relation between polytopes of dimension $ d_1 $ and dimension $ d_2 $ . We write this as the $ (d_1, d_2) $ -connectivity.

For a 2D triangular mesh:

  • $ d = 2 $ (cells are triangles)
  • $ d = 1 $ (edges)
  • $ d = 0 $ (vertices)

Common connectivity relations:

RelationMeaningUse Case
$ (0, 2) $ Vertices → CellsWhich cells share a vertex
$ (1, 2) $ Edges → CellsBoundary detection (edges with 1 cell)
$ (2, 0) $ Cells → VerticesCell vertex lookup
$ (2, 1) $ Cells → EdgesCell edge lookup

Computing Connectivity

Connectivity relations are computed on demand using the compute() method:

Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, {16, 16});

// Compute edge-to-cell connectivity (required for boundary detection)
mesh.getConnectivity().compute(1, 2);

Boundary Detection

Once the $ (d-1, d) $ connectivity is computed (where $ d $ is the mesh dimension), Rodin can identify boundary entities — those that are incident to exactly one cell. This is how DirichletBC finds the boundary DOFs automatically.

Mesh mesh;
mesh = mesh.UniformGrid(Polytope::Type::Triangle, {16, 16});
mesh.getConnectivity().compute(1, 2);  // Required for boundary detection

P1 Vh(mesh);
TrialFunction u(Vh);
TestFunction  v(Vh);

Problem poisson(u, v);
poisson = Integral(Grad(u), Grad(v))
        - Integral(f, v)
        + DirichletBC(u, Zero());  // Automatically detects boundary

Boundary Attributes

Different parts of the boundary can be distinguished by attributes (integer labels). This is useful when different boundary conditions are applied to different segments:

Attribute GammaD = 2, GammaN = 3;

// Apply Dirichlet BC only on boundary with attribute GammaD
DirichletBC(u, Zero()).on(GammaD)

// Apply Neumann BC only on boundary with attribute GammaN
BoundaryIntegral(g, v).over(GammaN)

Boundary attributes are typically set when loading a mesh from a file or when building a mesh programmatically.

See Also