Unit namespace
Unitary tests.
Classes
- class FlowTest
- Unit tests for Flow class basic functionality.
- class FMMTest
- Basic unit tests for Fast Marching Method (FMM)
- class LagrangianTest
- Unit tests for Lagrangian class basic functionality.
Functions
-
static auto makeMixed2DMesh() -> Mesh<Context::
Local> - Helper to build a mixed 2D mesh with triangles and quadrilaterals.
-
static auto makeMixed3DMesh() -> Mesh<Context::
Local> - Helper to build a mixed 3D mesh with tetrahedra and wedges.
-
static auto makeLargerMixed2DMesh() -> Mesh<Context::
Local> - Builds a larger mixed 2D mesh: 4 triangles + 2 quadrilaterals.
- TEST(Rodin_Geometry_Shard, Builder_ParentMode_AllOwned)
- Builds a shard from a parent mesh containing two triangles forming a unit square and includes all entities as owned.
- TEST(Rodin_Geometry_Shard, Builder_ParentMode_MixedStates)
- Builds two shards from a 4-triangle mesh and verifies ownership, shared, and ghost state for vertices and cells.
- TEST(Rodin_Geometry_Shard, Builder_DirectMode_SingleTriangle)
- Tests direct construction of a shard with explicit vertex and polytope insertion.
- TEST(Rodin_Geometry_Shard, Builder_DirectMode_VertexIdempotent)
- Verifies that inserting the same global vertex twice in direct mode is idempotent and returns the same local index.
- TEST(Rodin_Geometry_Shard, PolytopeMap_ParentMode)
- Verifies the bidirectional polytope map after building a shard from a parent mesh.
- TEST(Rodin_Geometry_Shard, PolytopeMap_DirectMode)
- Verifies the bidirectional polytope map after building a shard in direct mode.
- TEST(Rodin_Geometry_Shard, GetState)
- Verifies getState() returns the correct per-entity state vectors.
- TEST(Rodin_Geometry_Shard, Builder_ParentMode_AttributePreservation)
- Tests that Builder::include() preserves entity attributes from the parent mesh after shard finalization.
- TEST(Rodin_Geometry_Shard, Builder_ParentMode_ConnectivityPreservation)
- Tests that shard-local cell-to-vertex connectivity matches the parent mesh connectivity when mapped through the PolytopeMap.
- TEST(Rodin_Geometry_Shard, Builder_DirectMode_Mixed3D)
- Tests direct-mode construction of a mixed 3D shard containing one tetrahedron and one wedge that share a triangular face.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree1_Scalar)
- Test saving and loading H1 GridFunction with degree 1 (scalar)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Scalar)
- Test saving and loading H1 GridFunction with degree 2 (scalar)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree3_Scalar)
- Test saving and loading H1 GridFunction with degree 3 (scalar)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadFile_H1_Degree2_Scalar)
- Test saving H1 GridFunction to file and loading it back.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree4_Triangle)
- Test H1 degree 4 on triangle mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree5_Triangle)
- Test H1 degree 5 on triangle mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree6_Triangle)
- Test H1 degree 6 on triangle mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree4_Quadrilateral)
- Test H1 degree 4 on quadrilateral mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree5_Quadrilateral)
- Test H1 degree 5 on quadrilateral mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree6_Quadrilateral)
- Test H1 degree 6 on quadrilateral mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree4_Tetrahedron)
- Test H1 degree 4 on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree5_Tetrahedron)
- Test H1 degree 5 on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree6_Tetrahedron)
- Test H1 degree 6 on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree4_Mixed2D)
- Test H1 degree 4 on mixed 2D mesh (triangles and quads)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree5_Mixed2D)
- Test H1 degree 5 on mixed 2D mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree6_Mixed2D)
- Test H1 degree 6 on mixed 2D mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree1_Quadrilateral)
- Test H1 degree 1 on quadrilateral mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Quadrilateral)
- Test H1 degree 2 on quadrilateral mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree1_Tetrahedron)
- Test H1 degree 1 on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Tetrahedron)
- Test H1 degree 2 on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Triangle_Large)
- Test H1 degree 2 on triangle mesh with >= 16 elements.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree1_Mixed2D)
- Test H1 degree 1 on mixed 2D mesh (triangles and quads)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Mixed2D)
- Test H1 degree 2 on mixed 2D mesh.
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree1_Segment)
- Test H1 degree 1 on segment mesh (1D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree2_Segment)
- Test H1 degree 2 on segment mesh (1D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree3_Segment)
- Test H1 degree 3 on segment mesh (1D)
- TEST(Rodin_IO_MFEM_H1_GridFunction, SaveLoadRoundTrip_H1_Degree4_Segment)
- Test H1 degree 4 on segment mesh (1D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Triangle)
- Test saving and loading P1 GridFunction on triangle mesh (2D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Quadrilateral)
- Test saving and loading P1 GridFunction on quadrilateral mesh (2D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Tetrahedron)
- Test saving and loading P1 GridFunction on tetrahedron mesh (3D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Wedge)
- Test saving and loading P1 GridFunction on wedge mesh (3D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Segment)
- Test saving and loading P1 GridFunction on segment mesh (1D)
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadRoundTrip_Mixed2D)
- Test saving and loading P1 GridFunction on mixed 2D mesh.
- TEST(Rodin_IO_MFEM_P1_GridFunction, SaveLoadFile)
- Test file-based I/O for P1 GridFunction.
- TEST_P(LagrangianTest, BasicConstruction)
- Test basic Lagrangian class construction.
- TEST_P(LagrangianTest, DifferentVelocityFields)
- Test Lagrangian with different velocity field types.
- TEST_P(LagrangianTest, StepFunction)
- Test Lagrangian step function basic functionality.
- TEST_P(LagrangianTest, DifferentInitialConditions)
- Test with different initial conditions.
- TEST(Rodin_MPI_Geometry_Mesh, GetPolytopeCount_Cells)
- Verifies that MPIMesh::getPolytopeCount(D) for cells equals the parent mesh cell count (using the MPIMesh API directly, not manual shard iteration).
- TEST(Rodin_MPI_Geometry_Mesh, GetPolytopeCount_Vertices)
- Verifies that MPIMesh::getPolytopeCount(0) for vertices equals the parent mesh vertex count.
- TEST(Rodin_MPI_Geometry_Mesh, GetPolytopeCount_ByType)
- Verifies that MPIMesh::getPolytopeCount(Polytope::Type) correctly counts cells by geometry type.
- TEST(Rodin_MPI_Geometry_Mesh, IndexMapping_RoundTrip)
- Verifies that getLocalIndex and getGlobalIndex are inverses of each other for all local polytopes.
- TEST(Rodin_MPI_Geometry_Mesh, IndexMapping_MissingReturnsNullopt)
- Verifies that getLocalIndex returns nullopt for a global index that is not present in the local shard.
- TEST(Rodin_MPI_Geometry_Mesh, GetContext)
- Verifies that MPIMesh::
getContext() returns the construction context. - TEST(Rodin_MPI_Geometry_Mesh, LocalIterators)
- Verifies that local cell and vertex iterators on MPIMesh work correctly and iterate over the expected number of entities.
- TEST(Rodin_MPI_Geometry_Mesh, GetGeometry_Cells)
- Verifies that MPIMesh::
getGeometry() returns correct geometry types for local cells. - TEST(Rodin_MPI_Geometry_Mesh, GetVertexCoordinates)
- Verifies that MPIMesh::
getVertexCoordinates() returns valid coordinates for all local vertices. - TEST(Rodin_MPI_Geometry_Mesh, Tetrahedron3D_GlobalCellCount)
- Verifies that a 3D Tetrahedron mesh distributes correctly via MPIMesh and getPolytopeCount returns the correct global count.
- TEST(Rodin_MPI_Geometry_Mesh, Scale)
- Verifies that MPIMesh::
scale() modifies vertex coordinates by the given factor on each rank. - TEST(Rodin_MPI_Geometry_Mesh, Flush)
- Verifies that MPIMesh::
flush() does not crash and the mesh remains valid afterward. - TEST(Rodin_MPI_Geometry_Mesh, IsSubMesh)
- Verifies that MPIMesh::
isSubMesh() returns false. - TEST(Rodin_MPI_Geometry_Mesh, GetConnectivity)
- Verifies that MPIMesh::
getConnectivity() returns the shard's connectivity and that cell-to-vertex incidence is valid. - TEST(Rodin_MPI_Geometry_Mesh, GetSetAttribute)
- Verifies that getAttribute returns valid attributes and setAttribute modifies them.
- TEST(Rodin_MPI_Geometry_Mesh, SetVertexCoordinates)
- Verifies that setVertexCoordinates modifies vertex coordinates and the change is reflected in getVertexCoordinates.
- TEST(Rodin_MPI_Geometry_Mesh, GetArea_Triangle2D)
- Verifies that MPIMesh::
getArea() returns the correct total area for a distributed 2D triangle mesh, matching the parent mesh area. - TEST(Rodin_MPI_Geometry_Mesh, GetVolume_Tetrahedron3D)
- Verifies that MPIMesh::
getVolume() returns the correct total volume for a distributed 3D tetrahedron mesh. - TEST(Rodin_MPI_Geometry_Mesh, GetPolytopeTransformation)
- Verifies that MPIMesh::
getPolytopeTransformation() returns valid transformations for all local cells. - TEST(Rodin_MPI_Geometry_Mesh, GetCellByIndex)
- Verifies that MPIMesh::getCell(localIdx) returns a valid polytope for each local cell index.
- TEST(Rodin_MPI_Geometry_Mesh, GetVertexByIndex)
- Verifies that MPIMesh::getVertex(localIdx) returns a valid polytope for each local vertex index.
- TEST(Rodin_MPI_Geometry_Mesh, GetMeasure_MatchesGetArea)
- Verifies that MPIMesh::getMeasure(D) returns the same value as getArea() for a 2D mesh.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_GlobalOwnershipCount)
- Verifies that after reconcile(1) on a 2D triangle mesh, the global sum of owned edges equals the total edge count in the parent mesh.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_PolytopeMapBidirectional)
- Verifies that after reconcile(1), the edge polytope map is bidirectional (left and right are inverses).
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_StateExclusivity)
- Verifies that after reconcile(1), each edge has exactly one state (Owned, Shared, or Ghost) — states are mutually exclusive.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_OwnerMapConsistency)
- Verifies that after reconcile(1), the owner map for edges is consistent: ghost edges point to valid non-self ranks.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_NoDuplicateOwnership)
- Verifies that after reconcile(1), no distributed edge ID is owned by multiple ranks — each edge has a unique global owner.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_HaloMapConsistency)
- Verifies that after reconcile(1), the halo map for edges is consistent: halo entries reference owned entities and valid remote ranks.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_SingleRank_AllOwned)
- Verifies that with a single MPI rank, reconcile(1) marks all edges as Owned (no ghosts since there are no neighbors).
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Faces3D_GlobalOwnershipCount)
- Verifies that reconcile(2) on a 3D tetrahedron mesh produces correct global face ownership count.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Quad2D_GlobalEdgeCount)
- Verifies that reconcile(1) works for a 2D quadrilateral mesh, producing the correct global edge ownership count.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Faces3D_StateExclusivity)
- Verifies that reconcile(2) on a 3D tetrahedron mesh produces mutually exclusive states for every face entity (exactly one of Owned, Shared, or Ghost).
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Faces3D_PolytopeMapBidirectional)
- Verifies that reconcile(2) on a 3D mesh produces a bidirectional polytope map for faces.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_Idempotent)
- Verifies that calling reconcile(1) twice is idempotent: the distributed IDs and ownership state do not change on a second call.
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_StrictRoundCapThrows)
- Verifies that strict round caps are enforced for reconcile().
- TEST(Rodin_MPI_Geometry_Mesh, Reconcile_Edges2D_GlobalCheckPeriodPreservesState)
- Verifies that throttled global checks preserve reconcile correctness.
- TEST_P(FlowTest, BasicConstruction)
- Test basic Flow class construction and coordinate handling.
- TEST_P(FlowTest, VelocityFieldEvaluation)
- Test different velocity field types and their evaluation.
- TEST_P(FlowTest, MeshAccess)
- Test mesh polytope access and validation.
- auto computeTriangleFaceBarycentric(Real px, Real py, Real pz, Real x0, Real y0, Real z0, Real x1, Real y1, Real z1, Real x2, Real y2, Real z2) -> std::tuple<Real, Real, Real>
- Checks if a 3D point lies on a triangular face and computes its barycentric coordinates.
- auto computeQuadFaceParametric(Real px, Real py, Real pz, Real x0, Real y0, Real z0, Real x1, Real y1, Real z1, Real x2, Real y2, Real z2, Real x3, Real y3, Real z3) -> std::pair<Real, Real>
- Checks if a 3D point lies on a planar quadrilateral face and computes parametric coords.
-
auto findInteriorFacePoint(Geometry::
Mesh<Context:: Local>& mesh) -> std::pair<bool, Geometry:: Point> - Finds an interior face in the mesh and returns a point at its midpoint.
Function documentation
static Mesh<Context:: Local> Rodin:: Tests:: Unit:: makeMixed2DMesh()
Helper to build a mixed 2D mesh with triangles and quadrilaterals.
Layout (6 vertices, 3 cells): 2—3—4 |\ | Q | | \ | | 0–1-—5
T0: (0,1,2), T1: (1,3,2), Q0: (1,5,4,3)
static Mesh<Context:: Local> Rodin:: Tests:: Unit:: makeMixed3DMesh()
Helper to build a mixed 3D mesh with tetrahedra and wedges.
Tet: (0,1,2,6) Wedge: (0,1,2,3,4,5) — prism extruding the base triangle upward
static Mesh<Context:: Local> Rodin:: Tests:: Unit:: makeLargerMixed2DMesh()
Builds a larger mixed 2D mesh: 4 triangles + 2 quadrilaterals.
Layout (8 vertices): 5—6—7 | Q1| Q0| 2—3—4 |\ T1 /| |T0\ /T3| 0—1 |\ T2 (uses vertex 4 from above)
Actually, simpler to just build a strip: 4—5—6—7 |T1/| Q1 | | / | Q0| | 0—1—2—3
Rodin:: Tests:: Unit:: TEST_P(LagrangianTest,
BasicConstruction)
Test basic Lagrangian class construction.
This test verifies that Lagrangian objects can be constructed with proper trial/test functions, initial conditions, and velocity fields.
Rodin:: Tests:: Unit:: TEST_P(LagrangianTest,
DifferentVelocityFields)
Test Lagrangian with different velocity field types.
This test verifies that Lagrangian can work with various velocity fields.
Rodin:: Tests:: Unit:: TEST_P(LagrangianTest,
StepFunction)
Test Lagrangian step function basic functionality.
This test verifies that the step function can be called without errors. Note: The current implementation may have template deduction issues, so this test focuses on basic construction.
Rodin:: Tests:: Unit:: TEST_P(LagrangianTest,
DifferentInitialConditions)
Test with different initial conditions.
This test verifies that Lagrangian works with various initial conditions.
Rodin:: Tests:: Unit:: TEST(Rodin_MPI_Geometry_Mesh,
Reconcile_Faces3D_GlobalOwnershipCount)
Verifies that reconcile(2) on a 3D tetrahedron mesh produces correct global face ownership count.
Uses distributeFromRoot because the MPI UniformGrid for 3D types may produce degenerate partitions with small grids.
std::tuple<Real, Real, Real> Rodin:: Tests:: Unit:: computeTriangleFaceBarycentric(Real px,
Real py,
Real pz,
Real x0,
Real y0,
Real z0,
Real x1,
Real y1,
Real z1,
Real x2,
Real y2,
Real z2)
Checks if a 3D point lies on a triangular face and computes its barycentric coordinates.
| Parameters | |
|---|---|
| px | The query point coordinates |
| py | The query point coordinates |
| pz | The query point coordinates |
| x0 | First vertex of the triangle (corresponds to barycentric u=1) |
| y0 | First vertex of the triangle (corresponds to barycentric u=1) |
| z0 | First vertex of the triangle (corresponds to barycentric u=1) |
| x1 | Second vertex of the triangle (corresponds to barycentric v=1) |
| y1 | Second vertex of the triangle (corresponds to barycentric v=1) |
| z1 | Second vertex of the triangle (corresponds to barycentric v=1) |
| x2 | Third vertex of the triangle (corresponds to barycentric w=1) |
| y2 | Third vertex of the triangle (corresponds to barycentric w=1) |
| z2 | Third vertex of the triangle (corresponds to barycentric w=1) |
| Returns | Tuple of (u, v, w) barycentric coordinates if point is on face; (NaN, NaN, NaN) if point is not on the triangular face |
Uses the barycentric coordinate method to determine if point (px, py, pz) lies on the triangle defined by vertices (x0,y0,z0), (x1,y1,z1), (x2,y2,z2).
Algorithm:
- Express the point as P = u*V0 + v*(V1-V0) + w*(V2-V0) where u + v + w = 1
- Solve for v, w using dot products (Cramer's rule)
- Point is on triangle if 0 <= u,v,w <= 1 and point lies on the plane
std::pair<Real, Real> Rodin:: Tests:: Unit:: computeQuadFaceParametric(Real px,
Real py,
Real pz,
Real x0,
Real y0,
Real z0,
Real x1,
Real y1,
Real z1,
Real x2,
Real y2,
Real z2,
Real x3,
Real y3,
Real z3)
Checks if a 3D point lies on a planar quadrilateral face and computes parametric coords.
| Parameters | |
|---|---|
| px | The query point coordinates |
| py | The query point coordinates |
| pz | The query point coordinates |
| x0 | First vertex (maps to parametric (0,0)) |
| y0 | First vertex (maps to parametric (0,0)) |
| z0 | First vertex (maps to parametric (0,0)) |
| x1 | Second vertex (maps to parametric (1,0)) |
| y1 | Second vertex (maps to parametric (1,0)) |
| z1 | Second vertex (maps to parametric (1,0)) |
| x2 | Third vertex (maps to parametric (1,1)) |
| y2 | Third vertex (maps to parametric (1,1)) |
| z2 | Third vertex (maps to parametric (1,1)) |
| x3 | Fourth vertex (maps to parametric (0,1)) |
| y3 | Fourth vertex (maps to parametric (0,1)) |
| z3 | Fourth vertex (maps to parametric (0,1)) |
| Returns | Pair of (s, t) parametric coordinates if point is on face; (NaN, NaN) if point is not on the quadrilateral face |
For a planar quadrilateral with vertices ordered counter-clockwise, determines if point (px, py, pz) lies on the face and computes its parametric coordinates (s, t) in [0,1]x[0,1].
Algorithm:
- Compute the face normal using cross product of edge vectors
- Check if point lies on the plane within tolerance
- Project to 2D by dropping the axis with largest normal component
- Solve for parametric coordinates in the projected space
Note: This simplified algorithm assumes axis-aligned or near-axis-aligned quads, which is appropriate for reference element faces.
std::pair<bool, Geometry:: Point> Rodin:: Tests:: Unit:: findInteriorFacePoint(Geometry:: Mesh<Context:: Local>& mesh)
Finds an interior face in the mesh and returns a point at its midpoint.
| Parameters | |
|---|---|
| mesh in | The mesh (face-to-cell connectivity will be computed) |
| Returns | A pair: (true, Point on interior face) or (false, dummy Point) |