Medusa  1.1
Coordinate Free Mehless Method implementation
HDF_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_IO_HDF_FWD_HPP_
2 #define MEDUSA_BITS_IO_HDF_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
13 #include <hdf5.h>
14 #include <string>
15 #include <vector>
16 #include <fstream>
17 #include <ostream>
18 #include <type_traits>
19 
21 namespace Eigen {
22 template <typename Derived>
23 class MatrixBase;
24 
25 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
26 class Matrix;
27 }
28 
29 template <template <typename...> class base, typename derived>
30 struct is_base_of_template_impl {
31  template<typename... Ts>
32  static constexpr std::true_type test(const base<Ts...> *);
33  static constexpr std::false_type test(...);
34  using type = decltype(test(std::declval<derived*>()));
35 };
36 
37 template <template <typename...> class base, typename derived>
38 using is_base_of_template = typename is_base_of_template_impl<base, derived>::type;
40 
41 namespace mm {
42 
75 class HDF {
76  std::string filename_;
77  std::string group_name_;
78 
79  hid_t file;
80  hid_t group;
81 
82  public:
84  enum Mode : unsigned {
85  APPEND = 256,
86  DESTROY = 128,
87  READONLY = 64
88  };
89  private:
91  static std::string str(Mode mode);
92 
93  public:
95  HDF() : filename_(), group_name_(), file(-1), group(-1) {}
101  explicit HDF(std::string filename, Mode mode = APPEND) :
102  filename_(std::move(filename)), group_name_("/"), file(-1), group(-1) {
103  file = openFileHelper(filename_, mode);
104  group = H5Gopen(file, "/", H5P_DEFAULT);
105  }
107  ~HDF() { close(); }
108 
109  private:
111  static hid_t openFileHelper(const std::string& filename, Mode mode);
112 
113  public:
120  void open(const std::string& filename, const std::string& group_name = "/",
121  Mode mode = APPEND) {
122  openFile(filename, mode);
123  openGroup(group_name);
124  }
125 
130  void openFile(const std::string& filename, Mode mode = APPEND) {
131  closeFile();
133  file = openFileHelper(filename, mode);
134  }
135 
137  void reopenFile(Mode mode = APPEND) { openFile(filename_, mode); }
138 
146  void openGroup(std::string group_name);
148  void reopenGroup() {
149  if (!H5Iis_valid(group)) { openGroup(group_name_); }
150  }
152  void reopen(Mode mode = APPEND) { reopenFile(mode); reopenGroup(); }
154  bool isFileOpen() const { return H5Iis_valid(file) != 0; }
156  bool isGroupOpen() const { return H5Iis_valid(group) != 0; }
158  void flush() const;
160  void closeGroup() const;
162  void closeFile() const;
164  void close() const { closeFile(); }
166  const std::string& filename() const { return filename_; }
168  const std::string& fileName() const { return filename(); }
170  void setFilename(const std::string& filename) { closeFile(); filename_ = filename; }
172  void setFileName(const std::string& filename) { setFilename(filename); }
174  const std::string& groupName() const { return group_name_; }
176  void setGroupName(const std::string& group_name);
177 
189  template <class T>
190  T readAttribute(const std::string& attr_name) const;
191 
201  template <class T>
202  void writeAttribute(const std::string& attr_name, const T& value, const hid_t& type,
203  bool overwrite = false) const;
204 
214  template <typename T>
215  std::pair<std::vector<hsize_t>, std::vector<T>>
216  readLinearArray(const std::string& dataset_name) const;
217 
227  template<typename T>
228  std::vector<T> read1DArray(const std::string& dataset_name) const;
229 
239  template<typename T>
240  std::vector<std::vector<T>> read2DArray(const std::string& dataset_name) const;
241 
251  template<typename T>
252  std::vector<std::vector<std::vector<T>>> read3DArray(const std::string& dataset_name) const;
253 
264  template<int dim, typename T>
265  void writeLinearArray(const std::string& dataset_name, const T* value,
266  const std::array<hsize_t, dim>& sizes, hid_t type, bool overwrite) const;
267 
279  template<typename T, typename array_t>
280  void write1DArray(const std::string& dataset_name, const array_t& value,
281  hid_t type, bool overwrite) const;
282 
295  template<typename T, class array_t>
296  void write2DArray(const std::string& dataset_name, const array_t& value, hid_t type,
297  bool overwrite) const {
298  write2DArray<T>(dataset_name, value, type, overwrite,
299  is_base_of_template<Eigen::MatrixBase, array_t>());
300  }
301 
302  private:
304  template<typename T, class array_t>
305  void write2DArray(const std::string&, const array_t&, hid_t, bool, std::false_type) const;
306 
308  template<typename T, class array_t>
309  void write2DArray(const std::string&, const array_t&, hid_t, bool, std::true_type) const {
310  static_assert(!std::is_same<T, T>::value,
311  "This function produces wrong results for Eigen matrices. Use writeEigen instead.");
312  }
313 
314  public:
327  template<typename T, class array_t>
328  void write3DArray(const std::string& dataset_name, const array_t& value, hid_t type,
329  bool overwrite) const;
330 
332  int readIntAttribute(const std::string& attr_name) const;
334  bool readBoolAttribute(const std::string& attr_name) const;
336  double readDoubleAttribute(const std::string& attr_name) const;
338  float readFloatAttribute(const std::string& attr_name) const;
344  std::string readStringAttribute(const std::string& attr_name) const;
346  std::string readNullTerminatedStringAttribute(const std::string& attr_name) const;
347 
349  void writeIntAttribute(const std::string& attr_name, int value, bool overwrite = false) const;
351  void writeBoolAttribute(const std::string& attr_name, bool value, bool overwrite = false) const;
353  void writeDoubleAttribute(const std::string& attr_name, double value,
354  bool overwrite = false) const;
356  void writeFloatAttribute(const std::string& attr_name, float value,
357  bool overwrite = false) const;
363  void writeStringAttribute(const std::string& attr_name, const std::string& value,
364  bool overwrite = false) const;
365 
367  std::vector<int> readIntArray(const std::string& dataset_name) const;
369  std::vector<double> readDoubleArray(const std::string& dataset_name) const;
371  std::vector<float> readFloatArray(const std::string& dataset_name) const;
372 
374  template <typename array_t>
375  void writeIntArray(const std::string& dataset_name, const array_t& value,
376  bool overwrite = false) const;
378  template <typename array_t>
379  void writeDoubleArray(const std::string& dataset_name, const array_t& value,
380  bool overwrite = false) const;
382  template <typename array_t>
383  void writeFloatArray(const std::string& dataset_name, const array_t& value,
384  bool overwrite = false) const;
385 
387  std::vector<std::vector<int>> readInt2DArray(const std::string& dataset_name) const;
389  std::vector<std::vector<double>> readDouble2DArray(const std::string& dataset_name) const;
391  std::vector<std::vector<float>> readFloat2DArray(const std::string& dataset_name) const;
392 
394  template <typename array_t>
395  void writeInt2DArray(const std::string& dataset_name, const array_t& value,
396  bool overwrite = false) const;
398  template <typename array_t>
399  void writeDouble2DArray(const std::string& dataset_name, const array_t& value,
400  bool overwrite = false) const;
402  template <typename array_t>
403  void writeFloat2DArray(const std::string& dataset_name, const array_t& value,
404  bool overwrite = false) const;
405 
407  std::vector<std::vector<std::vector<int>>> readInt3DArray(
408  const std::string& dataset_name) const;
410  std::vector<std::vector<std::vector<double>>> readDouble3DArray(
411  const std::string& dataset_name) const;
413  std::vector<std::vector<std::vector<float>>> readFloat3DArray(
414  const std::string& dataset_name) const;
415 
417  template <typename array_t>
418  void writeInt3DArray(const std::string& dataset_name, const array_t& value,
419  bool overwrite = false) const;
421  template <typename array_t>
422  void writeDouble3DArray(const std::string& dataset_name, const array_t& value,
423  bool overwrite = false) const;
425  template <typename array_t>
426  void writeFloat3DArray(const std::string& dataset_name, const array_t& value,
427  bool overwrite = false) const;
428 
437  template <typename scalar_t = double>
438  Eigen::Matrix<scalar_t, -1, -1, 0, -1, -1> readEigen(const std::string& dataset_name) const;
439 
444  template <typename Derived>
445  void writeEigen(const std::string& dataset_name, const Eigen::MatrixBase<Derived>& value,
446  bool overwrite = false) const;
447 
460  template <typename SparseMatrixType>
461  void writeSparseMatrix(const std::string& name, SparseMatrixType& matrix, bool one_based = true,
462  bool overwrite = false);
463 
480  template <typename domain_t>
481  void writeDomain(const std::string& name, const domain_t& domain, bool overwrite = false);
482 
496  template <typename timer_t>
497  void writeTimer(const std::string& name, const timer_t& timer, bool overwrite = false);
498 
509  template <typename conf_t>
510  void writeXML(const std::string& name, const conf_t& conf, bool overwrite = false);
511 
520  HDF atomic() const;
521 
523  hid_t getFileID() const { return file; }
525  hid_t getGroupID() const { return group; }
526 
527  private:
529  static herr_t memberIterateCallback(hid_t loc_id, const char* name,
530  const H5L_info_t*, void* data);
531 
532  public:
534  struct Members {
535  std::vector<std::string> groups,
539 
541  friend std::ostream& operator<<(std::ostream& os, const Members& members) {
542  os << "groups: " << members.groups << "\ndatasets: " << members.datasets
543  << "\ndatatypes: " << members.datatypes << "\nunknowns: " << members.unknowns;
544  return os;
545  }
546  };
547 
552  Members members() const;
553 
555  std::vector<std::string> groups() const { return members().groups; }
556 
558  std::vector<std::string> datasets() const { return members().datasets; }
559 
561  friend std::ostream& operator<<(std::ostream& os, const HDF& hdf) {
562  os << "HDF reader for file '" << hdf.filename()
563  << "' with current group '" << hdf.groupName() << "'. ";
564  os << "The file is " << (hdf.isFileOpen() ? "open" : "closed")
565  << " and the group is " << (hdf.isGroupOpen() ? "open" : "closed") << '.';
566  return os;
567  }
568 };
569 
570 } // namespace mm
571 
572 #endif // MEDUSA_BITS_IO_HDF_FWD_HPP_
mm::HDF::readIntArray
std::vector< int > readIntArray(const std::string &dataset_name) const
Read given dataset into vector of ints.
Definition: HDF.cpp:190
mm::HDF::write2DArray
void write2DArray(const std::string &dataset_name, const array_t &value, hid_t type, bool overwrite) const
Writes given 2D array of given value and type to file.
Definition: HDF_fwd.hpp:296
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::HDF::str
static std::string str(Mode mode)
Convert HDF::Mode enum to string.
Definition: HDF.cpp:12
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::HDF::getGroupID
hid_t getGroupID() const
Return raw HDF C group identifier.
Definition: HDF_fwd.hpp:525
mm::HDF::readDouble3DArray
std::vector< std::vector< std::vector< double > > > readDouble3DArray(const std::string &dataset_name) const
Read given dataset into 3D vector of doubles.
Definition: HDF.cpp:220
mm::HDF::writeFloatArray
void writeFloatArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 1D array of floatss.
Definition: HDF.hpp:252
mm::HDF::reopenGroup
void reopenGroup()
Reopens current group.
Definition: HDF_fwd.hpp:148
mm::HDF::readFloatAttribute
float readFloatAttribute(const std::string &attr_name) const
Reads float attribute.
Definition: HDF.cpp:130
mm::HDF::readDoubleArray
std::vector< double > readDoubleArray(const std::string &dataset_name) const
Read given dataset into vector of doubles.
Definition: HDF.cpp:194
mm::HDF::close
void close() const
Closes all open objects. Alias of closeFile().
Definition: HDF_fwd.hpp:164
mm::HDF::write1DArray
void write1DArray(const std::string &dataset_name, const array_t &value, hid_t type, bool overwrite) const
Writes given 1D array with given value and type to file.
Definition: HDF.hpp:190
mm::HDF::Members::datasets
std::vector< std::string > datasets
Names of datasets.
Definition: HDF_fwd.hpp:536
mm::HDF::memberIterateCallback
static herr_t memberIterateCallback(hid_t loc_id, const char *name, const H5L_info_t *, void *data)
Callback required by HDF Literate function when getting a list of members.
Definition: HDF.cpp:277
mm::HDF::readFloat3DArray
std::vector< std::vector< std::vector< float > > > readFloat3DArray(const std::string &dataset_name) const
Read given dataset into 3D vector of floats.
Definition: HDF.cpp:225
mm::HDF::Members::unknowns
std::vector< std::string > unknowns
Names of unknown objects.
Definition: HDF_fwd.hpp:538
mm::HDF::openFile
void openFile(const std::string &filename, Mode mode=APPEND)
Opens a given file with a given mode.
Definition: HDF_fwd.hpp:130
mm::HDF::closeFile
void closeFile() const
Closes current file and all objects associated with it (e.g. the group), if open.
Definition: HDF.cpp:243
mm::HDF::writeTimer
void writeTimer(const std::string &name, const timer_t &timer, bool overwrite=false)
Writes given timer to file.
Definition: HDF.hpp:346
mm::HDF::reopen
void reopen(Mode mode=APPEND)
Reopens current file and group.
Definition: HDF_fwd.hpp:152
mm::HDF::readFloat2DArray
std::vector< std::vector< float > > readFloat2DArray(const std::string &dataset_name) const
Read given dataset into 2D vector of floats.
Definition: HDF.cpp:210
mm::HDF::read2DArray
std::vector< std::vector< T > > read2DArray(const std::string &dataset_name) const
Read given dataset into 2D array of vectors.
Definition: HDF.hpp:105
mm::HDF::readDouble2DArray
std::vector< std::vector< double > > readDouble2DArray(const std::string &dataset_name) const
Read given dataset into 2D vector of doubles.
Definition: HDF.cpp:206
mm::HDF::writeDoubleAttribute
void writeDoubleAttribute(const std::string &attr_name, double value, bool overwrite=false) const
Write double attribute.
Definition: HDF.cpp:146
mm::HDF::openFileHelper
static hid_t openFileHelper(const std::string &filename, Mode mode)
Opens given file with given mode.
Definition: HDF.cpp:21
mm::HDF::group
hid_t group
Currently open group identifier.
Definition: HDF_fwd.hpp:80
mm::HDF::setGroupName
void setGroupName(const std::string &group_name)
Set new group name without opening the new group. Any previously opened group is closed.
Definition: HDF.cpp:262
mm::HDF::readLinearArray
std::pair< std::vector< hsize_t >, std::vector< T > > readLinearArray(const std::string &dataset_name) const
Read given dataset into linear dim-D array.
Definition: HDF.hpp:68
mm::HDF::READONLY
@ READONLY
Read only open, the file must exist.
Definition: HDF_fwd.hpp:87
mm::HDF
Simplified HDF5 I/O utilities.
Definition: HDF_fwd.hpp:75
mm::HDF::writeEigen
void writeEigen(const std::string &dataset_name, const Eigen::MatrixBase< Derived > &value, bool overwrite=false) const
Write given Eigen expression as a 2D array of its type (either int, double or float).
Definition: HDF_Eigen.hpp:46
mm::HDF::isFileOpen
bool isFileOpen() const
Returns true is currently specified file is open and false otherwise.
Definition: HDF_fwd.hpp:154
mm::HDF::setFilename
void setFilename(const std::string &filename)
Sets new filename without opening the new file. Any previously opened file is closed.
Definition: HDF_fwd.hpp:170
mm::HDF::writeFloat3DArray
void writeFloat3DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 3D array of floats.
Definition: HDF.hpp:288
mm::HDF::read1DArray
std::vector< T > read1DArray(const std::string &dataset_name) const
Read 1D dataset given by dataset_name.
Definition: HDF.hpp:95
mm::HDF::~HDF
~HDF()
Closes all opened objects, by using close().
Definition: HDF_fwd.hpp:107
mm::HDF::group_name_
std::string group_name_
Current group name.
Definition: HDF_fwd.hpp:77
Config.hpp
mm::HDF::writeIntArray
void writeIntArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 1D array of ints.
Definition: HDF.hpp:240
mm::HDF::writeStringAttribute
void writeStringAttribute(const std::string &attr_name, const std::string &value, bool overwrite=false) const
Write string attribute.
Definition: HDF.cpp:154
mm::HDF::readInt3DArray
std::vector< std::vector< std::vector< int > > > readInt3DArray(const std::string &dataset_name) const
Read given dataset into 3D vector of ints.
Definition: HDF.cpp:215
mm::HDF::readInt2DArray
std::vector< std::vector< int > > readInt2DArray(const std::string &dataset_name) const
Read given dataset into 2D vector of ints.
Definition: HDF.cpp:202
mm::HDF::write3DArray
void write3DArray(const std::string &dataset_name, const array_t &value, hid_t type, bool overwrite) const
Writes given 3D array of given value and type to file.
Definition: HDF.hpp:216
mm::HDF::readBoolAttribute
bool readBoolAttribute(const std::string &attr_name) const
Reads bool attribute.
Definition: HDF.cpp:122
mm::HDF::Mode
Mode
Possible file opening modes.
Definition: HDF_fwd.hpp:84
mm::HDF::read3DArray
std::vector< std::vector< std::vector< T > > > read3DArray(const std::string &dataset_name) const
Read given dataset into 3D array of vectors.
Definition: HDF.hpp:123
mm::HDF::Members::groups
std::vector< std::string > groups
Names of subgroups.
Definition: HDF_fwd.hpp:535
mm::HDF::readAttribute
T readAttribute(const std::string &attr_name) const
Read attribute given by attr_name.
Definition: HDF.hpp:16
mm::HDF::getFileID
hid_t getFileID() const
Return raw HDF C file identifier.
Definition: HDF_fwd.hpp:523
mm::HDF::writeInt2DArray
void writeInt2DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 2D array of ints.
Definition: HDF.hpp:258
mm::HDF::writeFloat2DArray
void writeFloat2DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 2D array of floats.
Definition: HDF.hpp:270
mm::HDF::open
void open(const std::string &filename, const std::string &group_name="/", Mode mode=APPEND)
Opens given file and group.
Definition: HDF_fwd.hpp:120
mm::HDF::writeInt3DArray
void writeInt3DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 3D array of ints.
Definition: HDF.hpp:276
mm::HDF::Members::operator<<
friend std::ostream & operator<<(std::ostream &os, const Members &members)
Output this type in a user friendly way for quick inspection.
Definition: HDF_fwd.hpp:541
mm::HDF::readStringAttribute
std::string readStringAttribute(const std::string &attr_name) const
Reads non-null-terminated string attribute.
Definition: HDF.cpp:134
mm::HDF::isGroupOpen
bool isGroupOpen() const
Returns true is currently specified group is open and false otherwise.
Definition: HDF_fwd.hpp:156
mm::HDF::filename_
std::string filename_
Current file name.
Definition: HDF_fwd.hpp:76
mm::HDF::readDoubleAttribute
double readDoubleAttribute(const std::string &attr_name) const
Reads double attribute.
Definition: HDF.cpp:126
mm::HDF::HDF
HDF()
Construct an empty HDF reader.
Definition: HDF_fwd.hpp:95
mm::HDF::reopenFile
void reopenFile(Mode mode=APPEND)
Reopens the current file.
Definition: HDF_fwd.hpp:137
mm::HDF::Members::datatypes
std::vector< std::string > datatypes
Names of datatypes.
Definition: HDF_fwd.hpp:537
mm::HDF::groupName
const std::string & groupName() const
Get current group name.
Definition: HDF_fwd.hpp:174
mm::HDF::filename
const std::string & filename() const
Get current filename.
Definition: HDF_fwd.hpp:166
mm::HDF::readEigen
Eigen::Matrix< scalar_t, -1, -1, 0, -1, -1 > readEigen(const std::string &dataset_name) const
Reads data as an Eigen matrix of type scalar_t.
mm::HDF::members
Members members() const
Returns an object with categorized names of all members of current group.
Definition: HDF.cpp:298
mm::HDF::writeIntAttribute
void writeIntAttribute(const std::string &attr_name, int value, bool overwrite=false) const
Write int attribute.
Definition: HDF.cpp:138
mm::HDF::closeGroup
void closeGroup() const
Closes current group, if open.
Definition: HDF.cpp:236
mm::HDF::flush
void flush() const
Flush opened file, if it is open.
Definition: HDF.cpp:229
mm::HDF::HDF
HDF(std::string filename, Mode mode=APPEND)
Construct a HDF reader and open filename with given mode.
Definition: HDF_fwd.hpp:101
mm::HDF::writeDouble2DArray
void writeDouble2DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 2D array of doubles.
Definition: HDF.hpp:264
mm::HDF::DESTROY
@ DESTROY
Removes old contents, if any exist.
Definition: HDF_fwd.hpp:86
mm::HDF::readIntAttribute
int readIntAttribute(const std::string &attr_name) const
Reads int attribute.
Definition: HDF.cpp:118
mm::HDF::writeLinearArray
void writeLinearArray(const std::string &dataset_name, const T *value, const std::array< hsize_t, dim > &sizes, hid_t type, bool overwrite) const
Writes a dim-dimensional dataset stored in 1D array in col-major fashion.
Definition: HDF.hpp:144
mm::HDF::writeAttribute
void writeAttribute(const std::string &attr_name, const T &value, const hid_t &type, bool overwrite=false) const
Writes given attribute with given value and type to file.
Definition: HDF.hpp:38
Matrix
Matrix(const Scalar &s)
Construct matrix from scalar. Enabled only for fixed size matrices.
Definition: MatrixAddons.hpp:21
mm::HDF::groups
std::vector< std::string > groups() const
Returns names of all subgroups in current group in alphabetical order.
Definition: HDF_fwd.hpp:555
mm::HDF::writeDoubleArray
void writeDoubleArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 1D array of doubles.
Definition: HDF.hpp:246
mm::HDF::write2DArray
void write2DArray(const std::string &, const array_t &, hid_t, bool, std::true_type) const
Overload for static_assert for Eigen due to different size method.
Definition: HDF_fwd.hpp:309
mm::HDF::datasets
std::vector< std::string > datasets() const
Returns names of all datasets in current group in alphabetical order.
Definition: HDF_fwd.hpp:558
mm::HDF::writeDouble3DArray
void writeDouble3DArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 3D array of doubles.
Definition: HDF.hpp:282
print.hpp
mm::HDF::writeDomain
void writeDomain(const std::string &name, const domain_t &domain, bool overwrite=false)
Writes given domain discretization to file.
Definition: HDF.hpp:332
mm::HDF::writeFloatAttribute
void writeFloatAttribute(const std::string &attr_name, float value, bool overwrite=false) const
Write float attribute.
Definition: HDF.cpp:150
mm::HDF::APPEND
@ APPEND
Appends to the existing contents, if any exist.
Definition: HDF_fwd.hpp:85
mm::HDF::setFileName
void setFileName(const std::string &filename)
Alias of setFilename().
Definition: HDF_fwd.hpp:172
mm::HDF::fileName
const std::string & fileName() const
Alias of filename().
Definition: HDF_fwd.hpp:168
mm::HDF::openGroup
void openGroup(std::string group_name)
Open given group, closing any previously opened group().
Definition: HDF.cpp:48
mm::HDF::writeXML
void writeXML(const std::string &name, const conf_t &conf, bool overwrite=false)
Writes given XML object to file.
Definition: HDF.hpp:294
mm::HDF::operator<<
friend std::ostream & operator<<(std::ostream &os, const HDF &hdf)
Output basic info about HDF reader, such as current group and file.
Definition: HDF_fwd.hpp:561
mm::HDF::file
hid_t file
Currently open file identifier.
Definition: HDF_fwd.hpp:79
mm::HDF::writeSparseMatrix
void writeSparseMatrix(const std::string &name, SparseMatrixType &matrix, bool one_based=true, bool overwrite=false)
Writes a sparse matrix.
Definition: HDF.hpp:316
mm::HDF::readNullTerminatedStringAttribute
std::string readNullTerminatedStringAttribute(const std::string &attr_name) const
Reads null-terminated string attribute.
Definition: HDF.cpp:113
mm::HDF::readFloatArray
std::vector< float > readFloatArray(const std::string &dataset_name) const
Read given dataset into vector of floats.
Definition: HDF.cpp:198
mm::HDF::writeBoolAttribute
void writeBoolAttribute(const std::string &attr_name, bool value, bool overwrite=false) const
Write bool attribute.
Definition: HDF.cpp:142
mm::HDF::Members
Holds categorized names for all members of a group.
Definition: HDF_fwd.hpp:534
mm::HDF::atomic
HDF atomic() const
Allows for "atomic" read and write operations to HDF5 files.
Definition: HDF.cpp:250