Skip to content

boozer_sub: split chartmap file I/O into its own module#338

Merged
krystophny merged 1 commit into
mainfrom
boozer_sub/split-chartmap-module
Jun 23, 2026
Merged

boozer_sub: split chartmap file I/O into its own module#338
krystophny merged 1 commit into
mainfrom
boozer_sub/split-chartmap-module

Conversation

@krystophny

Copy link
Copy Markdown
Member

Follow-up to #337. With the field-object graft gone, the only remaining non-converter dependency boozer_sub carried was the chartmap file I/O: export/load_boozer_from_chartmap pulled boozer_chartmap_io (the NetCDF reader) and netcdf into the module, so a VMEC→Boozer-only consumer had to compile them too.

What

Separate file-I/O from state-access (no submodule — plain modules, compiler-portable):

  • boozer_chartmap_types (new): the boozer_chartmap_data_t record alone — no I/O, no deps beyond iso_fortran_env.
  • boozer_sub keeps build_boozer_from_chartmap(d) — the spline-building half, which needs the private batch-spline state. Its only chartmap reference is now the trivial types module; it no longer uses boozer_chartmap_io or netcdf.
  • boozer_chartmap (new) owns the file entry points: load_boozer_from_chartmap parses via boozer_chartmap_io then calls build_boozer_from_chartmap; export_boozer_chartmap gathers through the public splint_boozer_coord/boozer_to_vmec and writes NetCDF.

boozer_chartmap_io re-exports boozer_chartmap_data_t from the types module, so existing use boozer_chartmap_io, only: boozer_chartmap_data_t imports are unaffected. The only API change: callers of load/export_boozer_chartmap switch use boozer_subuse boozer_chartmap (only test_boozer_chartmap_roundtrip in-tree; updated here).

Verification

test_boozer_chartmap_roundtrip   exit 0   (export+load via the new boozer_chartmap module)
test_boozer_converter_vs_simple  exit 0
RABE quick+slow:                 100% tests passed, 0 failed out of 32

Converter-only consumers (e.g. RABE's curated build) now compile boozer_converter with just boozer_chartmap_types — no boozer_chartmap_io, no boozer_chartmap, no NetCDF-via-chartmap.

export/load_boozer_from_chartmap pulled the NetCDF chartmap reader
(boozer_chartmap_io) and netcdf into boozer_sub, so converter-only consumers
carried them too. Lift the file I/O out:

- boozer_chartmap_types: the boozer_chartmap_data_t record alone (no I/O).
- boozer_sub keeps build_boozer_from_chartmap(d), which populates the batch
  splines from an already-parsed record; its only chartmap reference is now
  the trivial types module.
- new boozer_chartmap module owns load/export_boozer_chartmap: load parses
  via boozer_chartmap_io then calls build; export gathers through the public
  splint entry points and writes NetCDF.

boozer_sub no longer uses boozer_chartmap_io or netcdf. Callers of
load/export_boozer_chartmap switch to `use boozer_chartmap`.
@krystophny krystophny merged commit 34b1b33 into main Jun 23, 2026
2 checks passed
@krystophny krystophny deleted the boozer_sub/split-chartmap-module branch June 23, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant