Checkpointing class. More...
#include <checkpoint.h>
Public Member Functions | |
Checkpoint (const std::string &filename, bool write, bool trunc=true) | |
Create checkpoint file. | |
~Checkpoint () | |
Destructor. | |
void | open () |
Open the file. | |
void | close () |
Close the file. | |
void | flush () |
Flush the data. | |
bool | is_open () const |
Is the file open? | |
bool | exist (const std::string &name) |
Does the entry exist in the file? | |
void | remove (const std::string &name) |
void | write (const std::string &name, const arma::mat &mat) |
Save matrix. More... | |
void | read (const std::string &name, arma::mat &mat) |
Read matrix. | |
void | cwrite (const std::string &name, const arma::cx_mat &mat) |
Save complex matrix. | |
void | cread (const std::string &name, arma::cx_mat &mat) |
Read complex matrix. | |
void | write (const std::string &name, const std::vector< double > &v) |
Save array. | |
void | read (const std::string &name, std::vector< double > &v) |
Load array. | |
void | write (const std::string &name, const std::vector< hsize_t > &v) |
Save array. | |
void | read (const std::string &name, std::vector< hsize_t > &v) |
Load array. | |
void | write (const BasisSet &basis) |
Save basis set. | |
void | read (BasisSet &basis) |
Load basis set. | |
void | write (const energy_t &en) |
Save energies. | |
void | read (energy_t &en) |
Load energies. | |
void | write (const std::string &name, double val) |
Save value. | |
void | read (const std::string &name, double &val) |
Read value. | |
void | write (const std::string &name, int val) |
Save value. | |
void | read (const std::string &name, int &val) |
Read value. | |
void | write (const std::string &name, hsize_t val) |
Save value. | |
void | read (const std::string &name, hsize_t &val) |
Read value. | |
void | write (const std::string &name, bool val) |
Save value. | |
void | read (const std::string &name, bool &val) |
Read value. | |
void | write (const std::string &name, const std::string &val) |
Save value. | |
void | read (const std::string &name, std::string &val) |
Read value. | |
Private Member Functions | |
void | write (const std::string &name, hbool_t val) |
Save value. | |
void | read (const std::string &name, hbool_t &val) |
Read value. | |
Private Attributes | |
std::string | filename |
Name of the file. | |
bool | writemode |
Is file open for writing? | |
bool | opend |
Is the file open. | |
hid_t | file |
The checkpoint file. | |
Checkpointing class.
void Checkpoint::remove | ( | const std::string & | name | ) |
Remove entry if exists. File needs to be opened beforehand. HDF5 doesn't reclaim any used space after the file has been closed, so this is only useful when you want to replace an existing entry with something new.
void Checkpoint::write | ( | const std::string & | name, |
const arma::mat & | mat | ||
) |
Save matrix.
Access routines.
An open file will be left open, a closed file will be left closed.