Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::ParticleHeader Struct Reference

Metadata prefix of an AMReX particle "Header" file. More...

#include <AMReX_ParticleHeader.H>

Public Member Functions

void parse (std::istream &is)
 Parse the metadata prefix from an input stream.
 

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
 

Detailed Description

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.

Member Function Documentation

◆ parse()

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. This lets ParticleContainer::Restart continue reading the grid offsets from the same stream.

Parameters
isinput stream positioned at the start of a particle Header

◆ read()

ParticleHeader amrex::ParticleHeader::read ( const std::string &  dir,
const std::string &  file 
)
static

Read and parse the "Header" file of a particle plotfile/checkpoint.

Collective: the file is read on the I/O process and broadcast.

Parameters
dirplotfile/checkpoint directory
fileparticle sub-directory name (e.g. "particle0")
Returns
the parsed header metadata

Member Data Documentation

◆ convert_ids

bool amrex::ParticleHeader::convert_ids = false

whether particle ids need to be converted (Version_Two_Dot_One and later)

◆ dim

int amrex::ParticleHeader::dim = 0

AMREX_SPACEDIM the file was written with.

◆ finest_level

int amrex::ParticleHeader::finest_level = 0

finest level present in the file

◆ how

std::string amrex::ParticleHeader::how

precision the particle data was written in: "single" or "double"

◆ int_comp_names

Vector<std::string> amrex::ParticleHeader::int_comp_names

names of the integer components, size() == num_int

◆ is_checkpoint

bool amrex::ParticleHeader::is_checkpoint = false

true if the file is a checkpoint (full restart), false for a plotfile

◆ next_id

Long amrex::ParticleHeader::next_id = 0

the next particle id to hand out (maxnextid)

◆ num_int

int amrex::ParticleHeader::num_int = 0

number of integer components

◆ num_particles

Long amrex::ParticleHeader::num_particles = 0

total number of particles in the file

◆ num_real

int amrex::ParticleHeader::num_real = 0

number of real components (pure SoA: excludes the AMREX_SPACEDIM positions)

◆ real_comp_names

Vector<std::string> amrex::ParticleHeader::real_comp_names

names of the real components, size() == num_real

◆ version

std::string amrex::ParticleHeader::version

raw version string, e.g. "Version_Two_Dot_One_double"


The documentation for this struct was generated from the following files: