METHOD
parallelSaveDataHDF5.h
Go to the documentation of this file.
1 #ifndef PARALLELSAVEDATAHDF5_H
2 #define PARALLELSAVEDATAHDF5_H
3 
4 #include <string>
5 #include <iostream>
6 #include <cstdio>
7 #include <cstdlib>
8 #include <cstring>
9 #include <utility>
10 #include "hdf5.h"
11 #include "simData.h"
12 #include "saveData.h"
13 #include "parallelEnv.h"
14 
15 using namespace std;
16 
18 
26 {
27 
28 public:
30  string filename;
31  hid_t file = 0;
32  int file_iteration = 0;
33 
35  enum OutputDetail {
38  OUTPUT_MINIMAL
39  } detail;
40 
42  void saveCons() override;
43 
45  void savePrims() override;
46 
48  void saveAux() override;
49 
51  void saveDomain() override;
52 
54  void saveConsts() override;
55 
57 
63  Data * data, ParallelEnv * env, string filename="data", OutputDetail detail=OUTPUT_ALL
64  ) : SaveData(data, 0), env(env), filename(filename), detail(detail) {
65  // Remove any pre-existing checkpoint file
66  std::remove((filename+".checkpoint.hdf5").c_str());
67  }
68 
69  virtual ~ParallelSaveDataHDF5() { }
70 
72 
79  void saveAll(bool timeSeries=false) override;
80 
82 
89  void saveVar(string variable, int num=1) override;
90 
92 
98  void openFile(const char *name);
99 
101 
105  void openCheckpointFile();
106 
108 
117  void writeDataSetDouble(const hid_t *group, const char *name, const int *var, const double *data);
118 };
119 
120 #endif
ParallelEnv * env
Pointer to PlatformEnv class containing platform specific info such as MPI details.
ParallelSaveDataHDF5(Data *data, ParallelEnv *env, string filename="data", OutputDetail detail=OUTPUT_ALL)
Constructor.
string filename
Filename for the HDF5 file. Defaults to &#39;data.hdf5&#39;.
All conserved, primitive, auxiliary and user-defined data.
virtual ~ParallelSaveDataHDF5()
Destructor.
Class used to save simulation data
Definition: saveData.h:23
ParallelEnv
Definition: parallelEnv.h:19
Data object
Definition: simData.h:49
Class used to save simulation data to HDF5 using multiple processes
OutputDetail
The level of detail to output to file.