|
Mundy: Multibody Nonlocal Dynamics Version of the Day
|
Periodic metric classes and geometric wrapping helpers.
Three concrete metric classes cover the full range of boundary conditions:
FreeSpaceMetric<Scalar> – non-periodic open boundaries OrthorhombicMetric<PeriodicAxes, Scalar> – axis-aligned periodic cell TriclinicMetric<PeriodicAxes, Scalar> – general tilted periodic cell
Both OrthorhombicMetric and TriclinicMetric are parameterised by a compile-time bitmask of periodic axes:
AXIS_X = 0b001, AXIS_Y = 0b010, AXIS_Z = 0b100
Combine with | to select subsets (e.g. AXIS_XY = AXIS_X | AXIS_Y). "Cell shape" (orthorhombic vs triclinic) and "which axes are periodic" are orthogonal concepts; the bitmask captures the latter for both geometries. For TriclinicMetric, AXIS_X/Y/Z refer to the first, second, and third lattice vector directions (fractional axes), not Cartesian x/y/z. All branching on PeriodicAxes is resolved at compile time via if constexpr, so unused axes impose zero runtime cost.
All concrete metrics are zero-overhead and Kokkos device-compatible.
For configuration-file-driven code where the metric type is unknown at compile time, use the runtime metric class (stk::topology-style). Its visit() method dispatches via a plain switch to a concrete metric, so the called code sees a fully concrete type and the compiler inlines it.
Geometric wrapping functions (wrap_rigid, wrap_points, unwrap_points_to_ref) are single function templates driven by the for_each_point_mutable free-function protocol. Each primitive type must provide an explicit overload of for_each_point_mutable alongside its definition. There is no default implementation: a missing overload is a compile error, not silent wrong behavior.