Block-Structured AMR Software Framework
AMReX_ParticlesHDF5.H File Reference

Go to the source code of this file.

Functions

void WriteParticleRealDataHDF5 (void *data, size_t size, hid_t fid) const
 Write a contiguous chunk of real particle data to an HDF5 file. More...
 
void ReadParticleRealDataHDF5 (void *data, size_t size, hid_t fid)
 Read a contiguous chunk of real particle data from HDF5 file. More...
 
void CheckpointHDF5 (const std::string &dir, const std::string &name, const std::string &compression="None@0") const
 Writes a particle checkpoint to file, suitable for restarting. More...
 
void CheckpointHDF5 (const std::string &dir, const std::string &name, bool is_checkpoint, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >(), const std::string &compression="None@0") const
 Writes a particle checkpoint to file, suitable for restarting. More...
 
template<class F >
void WriteHDF5ParticleData (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, const std::string &compression, F &&f, bool is_checkpoint=false) const
 Writes particle data to disk in the HDF5 format. More...
 
void CheckpointPreHDF5 ()
 
void CheckpointPostHDF5 ()
 
void RestartHDF5 (const std::string &dir, const std::string &file)
 Restart from checkpoint. More...
 
void RestartHDF5 (const std::string &dir, const std::string &file, bool is_checkpoint)
 Older version, for backwards compatibility. More...
 
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const std::string &compression) const
 This version of WritePlotFile writes all components and assigns component names. More...
 
template<class F , std::enable_if_t<!std::is_same_v< F, Vector< std::string >>> * = nullptr>
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const std::string &compression, F &&f) const
 This version of WritePlotFile writes all components and assigns component names. More...
 
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, const std::string &compression) const
 This version of WritePlotFile writes all components and allows the user to specify the names of the components. More...
 
template<class F >
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, const std::string &compression, F &&f) const
 This version of WritePlotFile writes all components and allows the user to specify the names of the components. More...
 
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const std::string &compression) const
 This version of WritePlotFile writes all components and allows the user to specify the names of the components. More...
 
template<class F , std::enable_if_t<!std::is_same_v< F, Vector< std::string >>> * = nullptr>
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const std::string &compression, F &&f) const
 This version of WritePlotFile writes all components and allows the user to specify the names of the components. More...
 
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const std::string &compression) const
 This version of WritePlotFile assigns component names, but allows the user to pass in a vector of ints that toggle on / off the writing of specific components. More...
 
template<class F >
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const std::string &compression, F &&f) const
 This version of WritePlotFile assigns component names, but allows the user to pass in a vector of ints that toggle on / off the writing of specific components. More...
 
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, const std::string &compression) const
 This is the most general version of WritePlotFile, which takes component names and flags for whether to write each variable as components. Note that the user should pass in vectors containing names of all the components, whether they are written or not. More...
 
template<class F >
void WritePlotFileHDF5 (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, const std::string &compression, F &&f) const
 This is the most general version of WritePlotFile, which takes component names and flags for whether to write each variable as components. Note that the user should pass in vectors containing names of all the components, whether they are written or not. More...
 
void WritePlotFilePreHDF5 ()
 
void WritePlotFilePostHDF5 ()
 
void WriteParticlesHDF5 (int level, hid_t grp, Vector< int > &which, Vector< int > &count, Vector< Long > &where, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const std::string &compression, const Vector< std::map< std::pair< int, int >, IntVector >> &particle_io_flags, bool is_checkpoint) const
 
template<class RTYPE >
void ReadParticlesHDF5 (hsize_t offset, hsize_t count, int grd, int lev, hid_t int_dset, hid_t real_dset, int finest_level_in_file, bool convert_ids)
 

Function Documentation

◆ CheckpointHDF5() [1/2]

void CheckpointHDF5 ( const std::string &  dir,
const std::string &  name,
bool  is_checkpoint,
const Vector< std::string > &  real_comp_names = Vector< std::string >(),
const Vector< std::string > &  int_comp_names = Vector< std::string >(),
const std::string &  compression = "None@0" 
) const

Writes a particle checkpoint to file, suitable for restarting.

◆ CheckpointHDF5() [2/2]

void CheckpointHDF5 ( const std::string &  dir,
const std::string &  name,
const std::string &  compression = "None@0" 
) const

Writes a particle checkpoint to file, suitable for restarting.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
nameThe name of the sub-directory for this particle type (i.e. "Tracer")
fidThe HDF5 file ID
compressioncompression parameter (i.e. "ZFP_ACCURACY@0.001", "SZ@sz.config")

◆ CheckpointPostHDF5()

void CheckpointPostHDF5 ( )

◆ CheckpointPreHDF5()

void CheckpointPreHDF5 ( )

◆ ReadParticleRealDataHDF5()

void ReadParticleRealDataHDF5 ( void *  data,
size_t  size,
hid_t  fid 
)

Read a contiguous chunk of real particle data from HDF5 file.

Parameters
dataA pointer to the start of the buffer into which to read
sizeThe number of elements to read
fidThe istream from which to read the data

◆ ReadParticlesHDF5()

template<class RTYPE >
void ReadParticlesHDF5 ( hsize_t  offset,
hsize_t  count,
int  grd,
int  lev,
hid_t  int_dset,
hid_t  real_dset,
int  finest_level_in_file,
bool  convert_ids 
)
protected

◆ RestartHDF5() [1/2]

void RestartHDF5 ( const std::string &  dir,
const std::string &  file 
)

Restart from checkpoint.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")

◆ RestartHDF5() [2/2]

void RestartHDF5 ( const std::string &  dir,
const std::string &  file,
bool  is_checkpoint 
)

Older version, for backwards compatibility.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
is_checkpointWhether the particle id and cpu are included in the file.

◆ WriteHDF5ParticleData()

template<class F >
void WriteHDF5ParticleData ( const std::string &  dir,
const std::string &  name,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const Vector< std::string > &  real_comp_names,
const Vector< std::string > &  int_comp_names,
const std::string &  compression,
F &&  f,
bool  is_checkpoint = false 
) const

Writes particle data to disk in the HDF5 format.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
nameThe name of the sub-directory for this particle type (i.e. "Tracer")
write_real_compfor each real component, whether or not we include that component in the file
write_int_compfor each integer component, whether or not we include that component in the file
real_comp_namesfor each real component, a name to label the data with
int_comp_namesfor each integer component, a name to label the data with
fcallable that returns whether a given particle should be written or not
is_checkpointWhether the particle id and cpu are included in the file.
compressioncompression parameter (i.e. "ZFP_ACCURACY@0.001", "SZ@sz.config")

◆ WriteParticleRealDataHDF5()

void WriteParticleRealDataHDF5 ( void *  data,
size_t  size,
hid_t  fid 
) const

Write a contiguous chunk of real particle data to an HDF5 file.

Parameters
dataA pointer to the start of the buffer to write
sizeThe number of elements to write
fidThe HDF5 file ID

◆ WriteParticlesHDF5()

void WriteParticlesHDF5 ( int  level,
hid_t  grp,
Vector< int > &  which,
Vector< int > &  count,
Vector< Long > &  where,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const std::string &  compression,
const Vector< std::map< std::pair< int, int >, IntVector >> &  particle_io_flags,
bool  is_checkpoint 
) const

◆ WritePlotFileHDF5() [1/10]

void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const std::string &  compression 
) const

This version of WritePlotFile writes all components and assigns component names.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
nameThe name of the sub-directory for this particle type (i.e. "Tracer")

◆ WritePlotFileHDF5() [2/10]

template<class F , std::enable_if_t<!std::is_same_v< F, Vector< std::string >>> * = nullptr>
void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const std::string &  compression,
F &&  f 
) const

This version of WritePlotFile writes all components and assigns component names.

This version also lets you pass in a functor to toggle whether each particle gets output.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
nameThe name of the sub-directory for this particle type (i.e. "Tracer")
fcallable that returns whether or not to write each particle

◆ WritePlotFileHDF5() [3/10]

void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const std::string &  compression 
) const

This version of WritePlotFile assigns component names, but allows the user to pass in a vector of ints that toggle on / off the writing of specific components.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
write_real_compfor each real component, whether to include that comp in the file
write_int_compfor each integer component, whether to include that comp in the file

◆ WritePlotFileHDF5() [4/10]

template<class F >
void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const std::string &  compression,
F &&  f 
) const

This version of WritePlotFile assigns component names, but allows the user to pass in a vector of ints that toggle on / off the writing of specific components.

This version also lets you pass in a functor to toggle whether each particle gets output.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
write_real_compfor each real component, whether to include that comp in the file
write_int_compfor each integer component, whether to include that comp in the file
fcallable that returns whether or not to write each particle

◆ WritePlotFileHDF5() [5/10]

void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const Vector< std::string > &  real_comp_names,
const Vector< std::string > &  int_comp_names,
const std::string &  compression 
) const

This is the most general version of WritePlotFile, which takes component names and flags for whether to write each variable as components. Note that the user should pass in vectors containing names of all the components, whether they are written or not.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
write_real_compfor each real component, whether to include that comp in the file
write_int_compfor each integer component, whether to include that comp in the file
real_comp_namesfor each real component, a name to label the data with
int_comp_namesfor each integer component, a name to label the data with

◆ WritePlotFileHDF5() [6/10]

template<class F >
void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< int > &  write_real_comp,
const Vector< int > &  write_int_comp,
const Vector< std::string > &  real_comp_names,
const Vector< std::string > &  int_comp_names,
const std::string &  compression,
F &&  f 
) const

This is the most general version of WritePlotFile, which takes component names and flags for whether to write each variable as components. Note that the user should pass in vectors containing names of all the components, whether they are written or not.

This version also lets you pass in a functor to toggle whether each particle gets output.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
write_real_compfor each real component, whether to include that comp in the file
write_int_compfor each integer component, whether to include that comp in the file
real_comp_namesfor each real component, a name to label the data with
int_comp_namesfor each integer component, a name to label the data with
fcallable that returns whether or not to write each particle

◆ WritePlotFileHDF5() [7/10]

void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< std::string > &  real_comp_names,
const std::string &  compression 
) const

This version of WritePlotFile writes all components and allows the user to specify the names of the components.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
real_comp_namesfor each real component, a name to label the data with

◆ WritePlotFileHDF5() [8/10]

template<class F , std::enable_if_t<!std::is_same_v< F, Vector< std::string >>> * = nullptr>
void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< std::string > &  real_comp_names,
const std::string &  compression,
F &&  f 
) const

This version of WritePlotFile writes all components and allows the user to specify the names of the components.

This version also lets you pass in a functor to toggle whether each particle gets output.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
real_comp_namesfor each real component, a name to label the data with
fcallable that returns whether or not to write each particle

◆ WritePlotFileHDF5() [9/10]

void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< std::string > &  real_comp_names,
const Vector< std::string > &  int_comp_names,
const std::string &  compression 
) const

This version of WritePlotFile writes all components and allows the user to specify the names of the components.

Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
real_comp_namesfor each real component, a name to label the data with
int_comp_namesfor each integer component, a name to label the data with

◆ WritePlotFileHDF5() [10/10]

template<class F >
void WritePlotFileHDF5 ( const std::string &  dir,
const std::string &  name,
const Vector< std::string > &  real_comp_names,
const Vector< std::string > &  int_comp_names,
const std::string &  compression,
F &&  f 
) const

This version of WritePlotFile writes all components and allows the user to specify the names of the components.

This version also lets you pass in a functor to toggle whether each particle gets output.

Template Parameters
Ffunction type
Parameters
dirThe base directory into which to write (i.e. "plt00000")
fileThe name of the sub-directory for this particle type (i.e. "Tracer")
real_comp_namesfor each real component, a name to label the data with
int_comp_namesfor each integer component, a name to label the data with
fcallable that returns whether or not to write each particle

◆ WritePlotFilePostHDF5()

void WritePlotFilePostHDF5 ( )

◆ WritePlotFilePreHDF5()

void WritePlotFilePreHDF5 ( )