Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
ee621c9 to
35bdf09
Compare
Replace monolithic merged file with clean module hierarchy: - libneo_coordinates_base.f90: abstract coordinate_system_t type - libneo_coordinates_vmec.f90: VMEC coordinate system implementation - libneo_coordinates_geoflux.f90: Geoflux coordinate system implementation - libneo_coordinates_chartmap.f90: Chartmap coordinate system implementation - libneo_coordinates_validator.f90: Chartmap file validation - libneo_coordinates_file_detection.f90: Reference coordinate file detection - libneo_coordinates.f90: Facade module re-exporting all public API Also: - Fix fpm.toml invalid dependency syntax (system libs via external-modules) - Add bind.toml for fpm-bind Python binding generation - Update CMakeSources.in for new modular structure All 70 tests pass with both CMake and FPM builds.
Add tests to ensure refactoring doesn't change behavior: - test_vector_conversion: Tests base class cov_to_cart/ctr_to_cart - Unit vector to basis vector mapping - Linearity verification - Norm preservation - cart->ctr->cart and cart->cov->cart roundtrips - test_geoflux_coordinate_system: Tests geoflux OOP wrapper - evaluate_cyl matches underlying module - evaluate_cart consistency with cyl_to_cart - Coordinate roundtrip u->cyl->u->cyl - Covariant basis finite difference verification - Metric tensor properties (symmetry, g*ginv=I, positive sqrtg) - Enhanced test_vmec_coordinate_system: - evaluate_cart consistency check - Covariant basis finite difference verification - Full metric tensor property checks All 76 tests pass.
When using gfortran with -fcheck=all (which includes -fcheck=recursion), calling non-recursive procedures from multiple OpenMP threads triggers "Recursive call to nonrecursive procedure" errors. This occurs because gfortran may allocate automatic arrays in static memory for non-recursive procedures, causing race conditions when called concurrently. Mark all procedures in the following modules as recursive: - spl_three_to_five: spline computation routines - biotsavart: magnetic field from coils - batch_interpolate_1d/2d/3d: batch spline interpolation - interpolate: general spline interpolation The recursive keyword ensures each thread gets its own stack-allocated copies of local arrays.
35bdf09 to
828680d
Compare
PR Type
Enhancement, Tests, Bug fix
Description
Refactor libneo_coordinates into modular OOP architecture with separate base, VMEC, geoflux, chartmap, validator, and file detection modules
Add comprehensive regression tests for vector conversion, geoflux, and VMEC coordinate systems with 76 passing tests
Mark spline subroutines as recursive for OpenMP thread safety with gfortran -fcheck=all
Fix fpm.toml dependency syntax and add bind.toml for Python binding generation
Diagram Walkthrough
File Walkthrough
7 files
New abstract base module with coordinate system typeStandalone VMEC coordinate system implementation moduleStandalone geoflux coordinate system implementation moduleStandalone chartmap coordinate system implementation moduleExtracted chartmap file validation into separate moduleExtracted reference coordinate file type detection moduleFacade module re-exporting public API from submodules4 files
New comprehensive vector conversion regression testsNew geoflux coordinate system regression test suiteEnhanced VMEC tests with consistency and property checksAdd new coordinate system test executables and targets1 files
Mark spline subroutines as recursive for thread safety3 files
Update build sources for modular coordinate system filesFix dependency syntax and add external modules listNew fpm-bind configuration for Python binding generation1 files