TRIQS/h5 1.3.0
C++ interface to HDF5
|
Specialized functions to read/write arithmetic scalar types from/to HDF5.
The following types are supported:
T
as long as std::is_arithmetic_v<T> == true
,std::complex<double>
andThe following code writes a std::complex<double>
to an HDF5 file, reads the same number and outputs it to stdout:
Output:
Contents of complex.h5
:
Functions | |
template<typename T > | |
void | h5::h5_read (group g, std::string const &name, T &x) H5_REQUIRES(std |
Read a scalar from an HDF5 dataset. | |
template<typename T > | |
void | h5::h5_read_attribute (object obj, std::string const &name, T &x) H5_REQUIRES(std |
Read a scalar from an HDF5 attribute. | |
template<typename T > | |
void | h5::h5_write (group g, std::string const &name, T const &x) H5_REQUIRES(std |
Write a scalar to an HDF5 dataset. | |
template<typename T > | |
void | h5::h5_write_attribute (object obj, std::string const &name, T const &x) H5_REQUIRES(std |
Write a scalar to an HDF5 attribute. | |
void h5::h5_read | ( | group | g, |
std::string const & | name, | ||
T & | x ) |
#include <h5/scalar.hpp>
Read a scalar from an HDF5 dataset.
The scalar type needs to be either arithmetic, complex or of type h5::dcplx_t.
T | Scalar type. |
g | h5::group containing the dataset. |
name | Name of the dataset. |
x | Scalar variable to be read into. |
Definition at line 85 of file scalar.hpp.
void h5::h5_read_attribute | ( | object | obj, |
std::string const & | name, | ||
T & | x ) |
#include <h5/scalar.hpp>
Read a scalar from an HDF5 attribute.
The scalar type needs to be either arithmetic or std::complex.
T | Scalar type. |
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
x | Scalar variable to be read into. |
Definition at line 140 of file scalar.hpp.
void h5::h5_write | ( | group | g, |
std::string const & | name, | ||
T const & | x ) |
#include <h5/scalar.hpp>
Write a scalar to an HDF5 dataset.
The scalar type needs to be either arithmetic, complex or of type h5::dcplx_t.
T | Scalar type. |
g | h5::group in which the dataset is created. |
name | Name of the dataset. |
x | Scalar value to be written. |
Definition at line 70 of file scalar.hpp.
void h5::h5_write_attribute | ( | object | obj, |
std::string const & | name, | ||
T const & | x ) |
#include <h5/scalar.hpp>
Write a scalar to an HDF5 attribute.
The scalar type needs to be either arithmetic or std::complex.
T | Scalar type. |
obj | h5::object to which the attribute is attached. |
name | Name of the attribute. |
x | Scalar value to be written. |
Definition at line 125 of file scalar.hpp.