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 and dimension . We write this as the -connectivity.
For a 2D triangular mesh:
- (cells are triangles)
- (edges)
- (vertices)
Common connectivity relations:
| Relation | Meaning | Use Case |
|---|---|---|
| Vertices → Cells | Which cells share a vertex | |
| Edges → Cells | Boundary detection (edges with 1 cell) | |
| Cells → Vertices | Cell vertex lookup | |
| Cells → Edges | Cell 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 connectivity is computed (where 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
- Polytopes — The geometric entities
- Meshes — Working with meshes
- Connectivity class reference