ParticleHeader: Grid Table, Species Discovery - #596
Open
ax3l wants to merge 2 commits into
Open
Conversation
This was referenced Jul 23, 2026
ax3l
added a commit
to AMReX-Codes/amrex
that referenced
this pull request
Jul 29, 2026
## Summary Extract the parsing of the per-level grid table (data file index, particle count and byte offset for each grid) from `ParticleContainer::Restart` into the shared `ParticleHeader` (follow-up to #5476), so standalone consumers - e.g. language bindings and format converters - can locate each grid's binary particle data without duplicating the on-disk format logic. - `ParticleHeader` gains a nested `GridEntry {which, count, where}` and `Vector<Vector<GridEntry>> grids`, filled by the new `parse_grid_table()`. - `ParticleHeader::read()` now returns a fully parsed header including the table; `parse()` still consumes exactly the metadata prefix, keeping the existing stream contract. - `Restart` consumes the shared parser instead of inline `HdrFile >>` reads - one source of truth for the Header format. Motivation: pyAMReX tools (runtime-SoA plotfile reading AMReX-Codes/pyamrex#596, AMReX-Codes/pyamrex#581, and a plotfile-to-openPMD converter AMReX-Codes/pyamrex#597) need the grid table for per-grid particle counts and parallel-read planning. ## Testing ``` cmake -S . -B build -DAMReX_ENABLE_TESTS=ON -DAMReX_TEST_TYPE=All -DAMReX_PARTICLES=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build -j6 ctest --test-dir build -R 'CheckpointRestart' -E 'HDF5|AsyncIO' --output-on-failure ``` All pass: `Particles_CheckpointRestart_3d`, `Particles_CheckpointRestartDualGrid_3d`, `Particles_CheckpointRestartDualGridSOA_3d`, `Particles_CheckpointRestartSOA_3d` (plus `Particles_Redistribute_3d` from the Small set). ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [x] include documentation in the code and/or rst files, if appropriate 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
ax3l
added a commit
that referenced
this pull request
Jul 29, 2026
Update to latest commit in AMReX `development`. Needed for #596 --------- Signed-off-by: Axel Huebl <axel.huebl@plasma.ninja>
Expose ParticleHeader::GridEntry and the per-level grid table parsed by AMReX (AMReX-Codes/amrex PR: ParticleHeader grid table), which locates each grid's binary particle data: data file index, particle count and byte offset. Useful for standalone tools, e.g. format converters and parallel readers, without duplicating AMReX's format logic. Requires an AMReX version that includes the grid-table refactor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ax3l
force-pushed
the
topic-read-particles-gridtable
branch
from
July 29, 2026 18:35
0b75091 to
65edd68
Compare
ax3l
marked this pull request as ready for review
July 29, 2026 18:35
Add list_particle_species(plotfile) to discover the particle sub-directories of a plotfile/checkpoint by their particle Header files, re-export it from each dimension module, and document species discovery and the grid table in the read-back workflow page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ax3l
force-pushed
the
topic-read-particles-gridtable
branch
from
July 29, 2026 18:35
65edd68 to
69c7694
Compare
atmyers
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #581 (stacked on its branch; the first commits shown here belong to #581).
Depends on:
ParticleHeadergrid table) - the binding needs an AMReX pin that includes itSummary
amrex.ParticleHeader.gridsexposes AMReX's per-level table locating each grid's binary particle data (GridEntry: data file indexwhich, particlecount, byte offsetwhere) - same C++ parser asParticleContainer::Restart, no duplicated format logic. Useful for standalone tools, e.g. format converters and parallel readers.amrex.space3d.list_particle_species(plotfile)lists the particle sub-directories of a plotfile/checkpoint by their particleHeaderfiles.Redistributefor AMReX development (newIntVect nGrowoverload).Testing
Built against AMReX
development+ AMReX-Codes/amrex#5577 + AMReX-Codes/amrex#5578 (-DpyAMReX_amrex_src=...):10 passed - including new
test_read_particles_grid_table(table totals matchnum_particles) andtest_list_particle_species, and per-level grid-table count assertions intest_read_particles_multilevel.🤖 Generated with Claude Code