-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
The scalar spline path in src/interpolate/interpolate.f90 wraps periodic coordinates using modulo(x, period) and ignores x_min, effectively enforcing a periodic origin at 0.0.
Example (1D):
src/interpolate/interpolate.f90:108usesxj = modulo(x, spl%h_step*(spl%num_points-1))- The batch spline path (
src/interpolate/batch_interpolate_1d.f90) instead usesmodulo(x - spl%x_min, period) + spl%x_min.
The same scalar pattern appears in the 2D/3D scalar evaluation routines and their derivative variants (multiple sites in src/interpolate/interpolate.f90).
Impact
- Periodic scalar spline evaluation is inconsistent with the batch spline evaluation for nonzero
x_min. - Derivative variants in the scalar path are also inconsistent: some do not apply periodic wrapping at all.
Expected
For periodic splines, scalar spline evaluation should wrap relative to the spline grid origin:
xj = modulo(x - x_min, period) + x_min
and do so consistently across value/derivative routines.
Suggested fix
- Update scalar
evaluate_splines_{1d,2d,3d}*routines to wrap withx - x_min(per-dimension). - Add a targeted unit test that constructs a periodic scalar spline with nonzero
x_minand checks equivalence of values (and derivatives where applicable) under shifts by integer multiples of the period.
Notes
This should be fixed before using scalar spline routines as a behavioral harness for GPU-ready refactors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working