Use FastInterpolations Splines with no adaptations#158
Conversation
Add shared (Ref{Int}, Ref{Int}) hints to all hot loops with 2D bicubic
spline evaluations for O(1) interval search optimization:
- Add rzphi_hint field to OdeState for future use in ODE integration
- Free.jl: compute_vacuum_inputs loop
- VacuumFromEquilibrium.jl: extract_plasma_surface_at_psi loop
- SingularCoupling.jl: compute_current_density and compute_surface_area loops
- Equilibrium.jl: flux derivative computation loop and equilibrium_separatrix_find Newton iteration while loops
Implements FastInterpolations v0.2.10 shared hint optimization for 2D splines.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Use FastInterpolations v0.2.9+ PeriodicBC(endpoint=:exclusive) instead of manually appending endpoints with vcat for periodic boundary conditions: - Kernel2D.jl: Remove vcat() endpoint duplication, use period=2π - MathUtils.jl: Infer period from grid and use exclusive endpoint This eliminates redundant endpoint storage and leverages native periodic spline support in FastInterpolations. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ctions Replace custom Spl.cumulative_integral and Spl.total_integral with native FastInterpolations.cumulative_integrate() and FastInterpolations.integrate(): - Equilibrium.jl: flux integral computation - ReadEquilibrium.jl: pressure integral normalization - InverseEquilibrium.jl: periodic spline integration - Mercier.jl: theta-averaged quantities - Bal.jl: ballooning mode integrals Native integration functions provide exact spline integration using cubic spline coefficients without requiring custom wrapper functions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ons directly Remove the Splines module wrapper and use FastInterpolations directly throughout the codebase: - Remove src/Splines/ directory (FastInterpolationsAdaptor.jl, Splines.jl) - Remove import .SplinesMod as Spl from JPEC.jl - Replace all Spl.PeriodicBC() with PeriodicBC() - Replace all Spl.CubicFit() with CubicFit() - Update test/runtests_spline.jl to use native FastInterpolations functions - Remove legacy MultiQuantityProfile and BicubicSpline tests The Splines module was only re-exporting FastInterpolations with thin wrappers, which created unnecessary indirection. Using FastInterpolations directly improves code clarity and leverages all native FastInterpolations v0.2.10 features. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add search=LinearBinary() parameter to all 2D cubic_interp calls for optimal interval search performance in hot loops: - Equilibrium.jl: flux interpolants - DirectEquilibrium.jl: psi_in, rzphi, and eqfun interpolants - InverseEquilibrium.jl: rz, rzphi, and eqfun interpolants - ReadEquilibrium.jl: psi_in and rz interpolants (CHEASE) - AnalyticEquilibrium.jl: rz and psi_in interpolants Setting the search strategy at spline creation time (instead of at each evaluation) follows the same pattern as 1D splines and ensures optimal O(log n) interval search for all 2D evaluations in loops. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add PeriodicBC to FastInterpolations imports in modules that use it: - Equilibrium.jl: Added PeriodicBC to import list - ForceFreeStates.jl: Added explicit imports for cubic_interp, deriv1, PeriodicBC, LinearBinary These imports were missing after removing the Spl module wrapper, causing "PeriodicBC not defined" errors when running examples. Both DIII-D and Solovev examples now run successfully. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…Interpolations_all_in
…module The SplinesMod wrapper has been removed in favor of direct FastInterpolations usage. Remove the now-obsolete splines.md documentation and its reference from the documentation build configuration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
@claude remove all unit testing for the splines |
|
Claude finished @jhalpern30's task in 1m 2s —— View job Removing Spline Unit Tests
Summary: I've successfully deleted The commit command requires approval. Once approved, the commit message will be: The changes are ready to be committed and pushed to the |
Code Review - PR #158: Use FastInterpolations Splines with no adaptationsOverviewThis PR successfully removes the Code QualityStrengths:
Issues identified: 1. Missing newline at EOF (minor)
2. Integration API changes - Potential correctness issueThe migration from
Location: Multiple files including Recommendation: Add a test comparing old vs new integration results on a known case to verify numerical equivalence. 3. PeriodicBC API change in Kernel2D.jlLocation: Changed from: bc=PeriodicBC(; endpoint=:exclusive)to: bc=PeriodicBC(; endpoint=:exclusive, period=2π)Question: Is the explicit 4. Hint initialization patternThe PR adds many
Example location: Performance ConsiderationsPositive:
Potential concern: Test CoverageLocation: The test file was heavily reduced from 151 to 40 lines:
Concern: The remaining test coverage is minimal. Consider adding:
Recommendation: Run the full test suite and compare numerical outputs (integration steps, eigenvalues) against a reference run from the previous commit to verify no regression. DocumentationIssue: The PR removes Recommendation: While the Splines module is gone, users still need to understand how JPEC uses FastInterpolations. Consider adding a brief section to the main documentation explaining:
Alternatively, update SummaryApprove with recommendations:
The performance optimizations (LinearBinary search, shared hints) should improve execution speed in hot paths. |
|
@claude I approve the removing spline unit tests commit, please do it |
|
Claude finished @jhalpern30's task in 1m 11s —— View job Committing Spline Test Removal
StatusI've staged Staged changes: Proposed commit message: Once the commit is approved, it will be automatically pushed to the |
This PR has been made possible by the many great feature adds to FastInterpolations from @mgyoo86!
We no longer need a
src/Splinessubmodule at all. The wholesrccan use FastInterpolations directly, as all our needs are covered by them now. This PR closes #148.