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
- 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_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.
Function documentation
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.
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.