FileH5
A file handler for hdf5 files. The proper tool to write results of XDiag simulations to disk. Only provided for the C++ version as Julia already provides good tools handling hdf5 files.
Sources file_h5.hpp, file_h5.cpp
Constructors
Name | Description | Default |
---|---|---|
filename | filename of the hdf5 file | |
iomode | whether to read or write to file | w |
There are four possible values of iomode
r
: read-only modew
: secure write mode, new file is created if it does not existw!
: forced write mode, existing file will be overwrittena
: append mode, new datasets in an existing file can be created
Methods
getindex / operator[]
Returns a handler to a value to be read or written from or to the hdf5 file.
Usage Example
std::string filename = XDIAG_DIRECTORY "/misc/data/hdf5/write.h5";
auto fl = FileH5(filename, "w!");
// Write output to the hdf5 file
fl["val"] = 12;
fl["test/to"] = 22;
fl["test/to2/group"] = 32;
fl["test/to3/group2/asdf"] = 42;
auto mat = arma::cx_mat(3, 5, arma::fill::randn);
fl["a/b/c/mat"] = mat;