METHOD
serialSaveDataHDF5.h
Go to the documentation of this file.
1 #ifndef SERIALSAVEDATAHDF5_H
2 #define SERIALSAVEDATAHDF5_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 "serialEnv.h"
14 
15 using namespace std;
16 
17 #include "hdf5.h"
19 
27 {
28 
29  public:
30 
32  string filename;
33  hid_t file = 0;
34  int file_iteration = 0;
35 
37  enum OutputDetail {
40  OUTPUT_MINIMAL
41  } detail;
42 
44  void saveCons() override;
45 
47  void savePrims() override;
48 
50  void saveAux() override;
51 
53  void saveDomain() override;
54 
56  void saveConsts() override;
57 
59 
65  Data * data, SerialEnv * env, string filename="data", OutputDetail detail=OUTPUT_ALL
66  ) : SaveData(data, 0), env(env), filename(filename), detail(detail) {
67  // Remove any pre-existing checkpoint file
68  std::remove((filename+".checkpoint.hdf5").c_str());
69  }
70 
71  virtual ~SerialSaveDataHDF5() { }
72 
74 
81  void saveAll(bool timeSeries=false) override;
82 
84 
91  void saveVar(string variable, int num=1) override;
92 
94 
100  void openFile(const char *name);
101 
103 
107  void openCheckpointFile();
108 
110 
119  void writeDataSetDouble(const hid_t *group, const char *name, const int *var, const double *data);
120 };
121 
122 #endif
Class used to save simulation data to HDF5 using a single process
SerialSaveDataHDF5(Data *data, SerialEnv *env, string filename="data", OutputDetail detail=OUTPUT_ALL)
Constructor.
All conserved, primitive, auxiliary and user-defined data.
virtual ~SerialSaveDataHDF5()
Destructor.
Class used to save simulation data
Definition: saveData.h:23
string filename
Filename for the HDF5 file. Defaults to &#39;data.hdf5&#39;.
SerialEnv
Definition: serialEnv.h:18
Data object
Definition: simData.h:49
OutputDetail
The level of detail to output to file.
SerialEnv * env
Pointer to PlatformEnv class containing platform specific info such as MPI details.