![]() |
Block-Structured AMR Software Framework
|
Metadata prefix of an AMReX particle "Header" file. More...
#include <AMReX_ParticleHeader.H>
Classes | |
| struct | GridEntry |
| One entry of the per-level grid table. More... | |
Public Member Functions | |
| void | parse (std::istream &is) |
| Parse the metadata prefix from an input stream. | |
| void | parse_grid_table (std::istream &is) |
Parse the per-level grid table into grids. | |
Static Public Member Functions | |
| static ParticleHeader | read (const std::string &dir, const std::string &file) |
| Read and parse the "Header" file of a particle plotfile/checkpoint. | |
Public Attributes | |
| std::string | version |
| raw version string, e.g. "Version_Two_Dot_One_double" | |
| std::string | how |
| precision the particle data was written in: "single" or "double" | |
| bool | convert_ids = false |
| whether particle ids need to be converted (Version_Two_Dot_One and later) | |
| int | dim = 0 |
| AMREX_SPACEDIM the file was written with. | |
| int | num_real = 0 |
| number of real components (pure SoA: excludes the AMREX_SPACEDIM positions) | |
| Vector< std::string > | real_comp_names |
| names of the real components, size() == num_real | |
| int | num_int = 0 |
| number of integer components | |
| Vector< std::string > | int_comp_names |
| names of the integer components, size() == num_int | |
| bool | is_checkpoint = false |
| true if the file is a checkpoint (full restart), false for a plotfile | |
| Long | num_particles = 0 |
| total number of particles in the file | |
| Long | next_id = 0 |
| the next particle id to hand out (maxnextid) | |
| int | finest_level = 0 |
| finest level present in the file | |
| Vector< Vector< GridEntry > > | grids |
| Per level and grid: where each grid's particle data is stored. | |
Metadata prefix of an AMReX particle "Header" file.
This is the single source of truth for parsing the leading metadata of a particle plotfile/checkpoint "Header" file, as written by WriteBinaryParticleData. It is used both by ParticleContainer::Restart (to read a file into a container) and standalone (e.g. from language bindings) to discover the on-disk layout - number and names of the real/int components, the precision, and whether the file is a checkpoint - before constructing or configuring a container to read it.
The component counts follow the same convention as the on-disk format: for pure Struct-of-Arrays particles the AMREX_SPACEDIM position components are implicit and num_real counts only the remaining (runtime) real components.
After the metadata prefix, the "Header" file contains a per-level grid table that locates each grid's binary particle data on disk. It can be parsed with parse_grid_table(); read() returns a fully parsed header including the table.
| void amrex::ParticleHeader::parse | ( | std::istream & | is | ) |
Parse the metadata prefix from an input stream.
Consumes exactly the leading metadata block (version through finest level), leaving the stream positioned right after the finest-level entry and before the per-level grid table. The table can then be parsed from the same stream with parse_grid_table().
| is | input stream positioned at the start of a particle Header |
| void amrex::ParticleHeader::parse_grid_table | ( | std::istream & | is | ) |
Parse the per-level grid table into grids.
Must be called on a stream positioned right after the metadata prefix, i.e. directly following a call to parse().
| is | input stream positioned at the start of the grid table |
|
static |
Read and parse the "Header" file of a particle plotfile/checkpoint.
Parses the complete header: the metadata prefix and the per-level grid table. Collective: the file is read on the I/O process and broadcast.
| dir | plotfile/checkpoint directory |
| file | particle sub-directory name (e.g. "particle0") |
| bool amrex::ParticleHeader::convert_ids = false |
whether particle ids need to be converted (Version_Two_Dot_One and later)
| int amrex::ParticleHeader::dim = 0 |
AMREX_SPACEDIM the file was written with.
| int amrex::ParticleHeader::finest_level = 0 |
finest level present in the file
Per level and grid: where each grid's particle data is stored.
Filled by parse_grid_table(); grids.size() == finest_level + 1 and grids[lev].size() is the number of grids of level lev. Grids without particles have a zero count.
| std::string amrex::ParticleHeader::how |
precision the particle data was written in: "single" or "double"
| Vector<std::string> amrex::ParticleHeader::int_comp_names |
names of the integer components, size() == num_int
| bool amrex::ParticleHeader::is_checkpoint = false |
true if the file is a checkpoint (full restart), false for a plotfile
| Long amrex::ParticleHeader::next_id = 0 |
the next particle id to hand out (maxnextid)
| int amrex::ParticleHeader::num_int = 0 |
number of integer components
| Long amrex::ParticleHeader::num_particles = 0 |
total number of particles in the file
| int amrex::ParticleHeader::num_real = 0 |
number of real components (pure SoA: excludes the AMREX_SPACEDIM positions)
| Vector<std::string> amrex::ParticleHeader::real_comp_names |
names of the real components, size() == num_real
| std::string amrex::ParticleHeader::version |
raw version string, e.g. "Version_Two_Dot_One_double"