File datafile.hxx¶
Data file handling object definition.
26th Sep 2009: Modified to use varargs
- Author
B.Dudson
- Date
April 2009
Defines
-
SAVE_ONCE1(var)¶
Write this variable once to the grid file.
-
SAVE_ONCE2(var1, var2)¶
-
SAVE_ONCE3(var1, var2, var3)¶
-
SAVE_ONCE4(var1, var2, var3, var4)¶
-
SAVE_ONCE5(var1, var2, var3, var4, var5)¶
-
SAVE_ONCE6(var1, var2, var3, var4, var5, var6)¶
-
SAVE_ONCE(...)¶
-
SAVE_REPEAT1(var)¶
Write this variable every timestep.
-
SAVE_REPEAT2(var1, var2)¶
-
SAVE_REPEAT3(var1, var2, var3)¶
-
SAVE_REPEAT4(var1, var2, var3, var4)¶
-
SAVE_REPEAT5(var1, var2, var3, var4, var5)¶
-
SAVE_REPEAT6(var1, var2, var3, var4, var5, var6)¶
-
SAVE_REPEAT(...)¶
-
class Datafile¶
- #include <datafile.hxx>
Uses a generic interface to file formats (DataFormat) and provides an interface for reading/writing simulation data.
Public Functions
-
~Datafile() = default¶
-
bool isValid()¶
-
void close()¶
-
void setLowPrecision()¶
Only output floats.
-
void add(std::vector<int> &ivec, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(std::string &s, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(BoutReal &r, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(Field2D &f, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(Field3D &f, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(FieldPerp &f, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(Vector2D &f, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
void add(Vector3D &f, const char *name, bool save_repeat = false, const std::string &description =
"")¶
-
bool read()¶
Read data into added variables.
-
bool write()¶
Write added variables.
-
template<typename S, typename ...Args>
inline bool write(const S &format, const Args&... args) const¶
Private Functions
Private Members
-
bool parallel = {false}¶
-
bool flush = {true}¶
-
bool guards = {true}¶
-
bool floats = {false}¶
-
bool openclose = {true}¶
-
int Lx¶
-
int Ly¶
-
int Lz¶
-
bool enabled = {true}¶
-
bool init_missing¶
-
bool shiftoutput = {false}¶
-
bool shiftinput = {false}¶
-
int flushFrequencyCounter = {0}¶
-
int flushfrequency = {1}¶
-
std::unique_ptr<DataFormat> file¶
-
bool writable = {false}¶
-
bool appending = {false}¶
-
bool first_time = {true}¶
-
template<class T>
struct VarStr¶ A structure to hold a pointer to a class, and associated name and flags.
Public Members
-
T *ptr¶
Pointer to the data. Note that this may be a user object, not a copy, so must not be destroyed
-
bool save_repeat¶
If true, has a time dimension and is saved every time step.
-
bool covar¶
For vectors, true if a covariant vector, false if contravariant.
-
size_t size¶
Size of a stored vector or string, to check it does not change after being added.
-
T *ptr¶
-
~Datafile() = default¶