Block-Structured AMR Software Framework
AMReX_ParticlesHDF5.H
Go to the documentation of this file.
1 #ifndef AMREX_PARTICLES_HDF5_H_
2 #define AMREX_PARTICLES_HDF5_H_
3 
4 public:
12  void WriteParticleRealDataHDF5 (void* data, size_t size, hid_t fid) const;
13 
21  void ReadParticleRealDataHDF5 (void* data, size_t size, hid_t fid);
22 
31  void CheckpointHDF5 (const std::string& dir, const std::string& name,
32  const std::string& compression = "None@0") const;
33 
37  void CheckpointHDF5 (const std::string& dir, const std::string& name, bool is_checkpoint,
38  const Vector<std::string>& real_comp_names = Vector<std::string>(),
39  const Vector<std::string>& int_comp_names = Vector<std::string>(),
40  const std::string& compression = "None@0") const;
41 
57  template <class F>
58  void WriteHDF5ParticleData (const std::string& dir,
59  const std::string& name,
60  const Vector<int>& write_real_comp,
61  const Vector<int>& write_int_comp,
62  const Vector<std::string>& real_comp_names,
63  const Vector<std::string>& int_comp_names,
64  const std::string& compression,
65  F&& f, bool is_checkpoint=false) const;
66 
67 
69 
71 
78  void RestartHDF5 (const std::string& dir, const std::string& file);
79 
87  void RestartHDF5 (const std::string& dir, const std::string& file, bool is_checkpoint);
88 
95  void WritePlotFileHDF5 (const std::string& dir, const std::string& name, const std::string& compression) const;
96 
108  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>>>* = nullptr>
109  void WritePlotFileHDF5 (const std::string& dir, const std::string& name, const std::string& compression, F&& f) const;
110 
119  void WritePlotFileHDF5 (const std::string& dir, const std::string& name,
120  const Vector<std::string>& real_comp_names,
121  const Vector<std::string>& int_comp_names,
122  const std::string& compression) const;
123 
137  template <class F>
138  void WritePlotFileHDF5 (const std::string& dir, const std::string& name,
139  const Vector<std::string>& real_comp_names,
140  const Vector<std::string>& int_comp_names,
141  const std::string& compression, F&& f) const;
142 
151  void WritePlotFileHDF5 (const std::string& dir, const std::string& name,
152  const Vector<std::string>& real_comp_names,
153  const std::string& compression) const;
154 
168  template <class F, std::enable_if_t<!std::is_same_v<F, Vector<std::string>>>* = nullptr>
169  void WritePlotFileHDF5 (const std::string& dir, const std::string& name,
170  const Vector<std::string>& real_comp_names,
171  const std::string& compression, F&& f) const;
172 
182  void WritePlotFileHDF5 (const std::string& dir,
183  const std::string& name,
184  const Vector<int>& write_real_comp,
185  const Vector<int>& write_int_comp,
186  const std::string& compression) const;
187 
202  template <class F>
203  void WritePlotFileHDF5 (const std::string& dir,
204  const std::string& name,
205  const Vector<int>& write_real_comp,
206  const Vector<int>& write_int_comp,
207  const std::string& compression, F&& f) const;
208 
222  void WritePlotFileHDF5 (const std::string& dir,
223  const std::string& name,
224  const Vector<int>& write_real_comp,
225  const Vector<int>& write_int_comp,
226  const Vector<std::string>& real_comp_names,
227  const Vector<std::string>& int_comp_names,
228  const std::string& compression) const;
229 
248  template <class F>
249  void WritePlotFileHDF5 (const std::string& dir,
250  const std::string& name,
251  const Vector<int>& write_real_comp,
252  const Vector<int>& write_int_comp,
253  const Vector<std::string>& real_comp_names,
254  const Vector<std::string>& int_comp_names,
255  const std::string& compression,
256  F&& f) const;
257 
259 
261 
262  void
263  WriteParticlesHDF5 (int level, hid_t grp,
264  Vector<int>& which, Vector<int>& count, Vector<Long>& where,
265  const Vector<int>& write_real_comp, const Vector<int>& write_int_comp,
266  const std::string& compression,
267  const Vector<std::map<std::pair<int, int>,IntVector>>& particle_io_flags, bool is_checkpoint) const;
268 
269 protected:
270 
271 template <class RTYPE>
272 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);
273 
274 #endif
Array4< int const > offset
Definition: AMReX_HypreMLABecLap.cpp:1089
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.
void WritePlotFilePreHDF5()
void CheckpointPreHDF5()
void WritePlotFilePostHDF5()
void ReadParticleRealDataHDF5(void *data, size_t size, hid_t fid)
Read a contiguous chunk of real particle data from HDF5 file.
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)
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.
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
void RestartHDF5(const std::string &dir, const std::string &file)
Restart from checkpoint.
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.
void CheckpointPostHDF5()
void WriteParticleRealDataHDF5(void *data, size_t size, hid_t fid) const
Write a contiguous chunk of real particle data to an HDF5 file.
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44