1 #ifndef HDF5FILE_H_INCLUDED
2 #define HDF5FILE_H_INCLUDED
29 #include <boost/property_tree/ptree.hpp>
48 Hdf5File(
const std::string& file_path);
75 bool Open(
const std::string& file_path);
82 std::vector<std::pair<int, double>>
TimeSteps();
87 void Write(std::shared_ptr<const SimPT_Sim::Sim> sim);
103 boost::property_tree::ptree ReadParameters(hid_t loc_id);
107 boost::property_tree::ptree ReadPtreeFromStringAttribute(hid_t loc_id,
const std::string& attr_name);
153 void WriteParameters(hid_t loc_id,
const boost::property_tree::ptree& params);
163 void WritePtreeToStringAttribute(hid_t loc_id,
const std::string& attr_name, boost::property_tree::ptree
const& pt);
184 std::string m_file_path;
196 #pragma GCC diagnostic ignored "-Wunused-parameter"
209 std::cout <<
"[HDF5] Warning: HDF5 must be enabled at compile time." << std::endl;
213 std::cout <<
"[HDF5] Warning: HDF5 must be enabled at compile time." << std::endl;
217 bool Close() {
return true; }
225 bool IsOpen() {
return true; }
227 bool Open(
const std::string& ) {
return true; }
229 void Write(std::shared_ptr<const SimPT_Sim::Sim> ) {}
233 std::vector<std::pair<int, double>>
TimeSteps() {
return {}; }
240 #endif // end_of_include guard
void Write(std::shared_ptr< const SimPT_Sim::Sim > sim)
Writes the mesh state to the HDF5 file currently associated with exporter object. ...
Namespace for SimPT shell package.
Namespace for the core simulator.
Contains facilities for storing the simulation Mesh to HDF5 files.
std::vector< std::pair< int, double > > TimeSteps()
Reads the time steps contained in the HDF5 file.
static bool HDF5Available()
To avoid littering the code with preprocessor conditionals.
bool IsOpen()
Returns true if exporter is associated with a HDF5 file that has been successfully opened...
virtual ~Hdf5File()
Cleans up HDF5 storage: makes sure files are closed properly.
bool Close()
Closes the HDF5 file associated with exporter, dissociates it from this exporter object and returns t...
Contains the state of the whole Simulator at a given simulation step.
bool Open(const std::string &file_path)
Creates an HDF5 file and binds the exporter object to it.
Contains the state of the whole Mesh at a given simulation step.
Hdf5File()
Creates an empty HDF5 mesh exporter with no file association.
std::string GetFilePath()
Return file path for HDF5 file associated with the exporter object, if any.
static std::string GetFileExtension()
Return file extension for HDF5 format.