SIRIUS 7.5.0
Electronic structure library and applications
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sirius::HDF5_tree Class Reference

Interface to the HDF5 library. More...

#include <hdf5_tree.hpp>

Classes

class  HDF5_attribute
 
class  HDF5_dataset
 Auxiliary class to handle HDF5 Dataset object. More...
 
class  HDF5_dataspace
 Auxiliary class to handle HDF5 Dataspace object. More...
 
class  HDF5_group
 Auxiliary class to handle HDF5 Group object. More...
 

Public Member Functions

 HDF5_tree (const std::string &file_name__, hdf5_access_t access__)
 Constructor to create the HDF5 tree. More...
 
 ~HDF5_tree ()
 Destructor. More...
 
HDF5_tree create_node (int idx)
 Create node by integer index. More...
 
HDF5_tree create_node (std::string const &name)
 Create node by name. More...
 
template<typename T , int N>
void write (const std::string &name, sddk::mdarray< std::complex< T >, N > const &data)
 
template<typename T , int N>
void write (std::string const &name__, sddk::mdarray< T, N > const &data__)
 Write a multidimensional array by name. More...
 
template<typename T , int N>
void write (int name_id, sddk::mdarray< T, N > const &data)
 Write a multidimensional array by integer index. More...
 
template<typename T >
void write (const std::string &name, T const *data, int size)
 Write a buffer. More...
 
template<typename T >
void write (const std::string &name, T data)
 Write a scalar. More...
 
template<typename T >
void write (int name_id, std::vector< T > const &vec)
 Write a vector by id. More...
 
template<typename T >
void write (const std::string &name, std::vector< T > const &vec)
 Write a vector by name. More...
 
template<typename T >
void write_attribute (const std::string &name, const T &data) const
 Write attribute. More...
 
template<typename T >
void write_attribute (const std::string &name, const T &data, const std::string &dataset_name) const
 Write attribute. More...
 
void write_attribute (const std::string &name, const std::string &data, hid_t base_string_type=H5T_FORTRAN_S1) const
 Write string attribute. More...
 
void write_attribute (const std::string &name, const std::string &data, const std::string &dataset_name, hid_t base_string_type=H5T_FORTRAN_S1) const
 Write string attribute. More...
 
template<std::size_t N>
void write_attribute (const std::string &name, const char(&data)[N], hid_t base_string_type=H5T_FORTRAN_S1) const
 Write string attribute. More...
 
template<std::size_t N>
void write_attribute (const std::string &name, const char(&data)[N], const std::string &dataset_name, hid_t base_string_type=H5T_FORTRAN_S1) const
 Write string attribute. More...
 
template<typename T >
void write_attribute (const std::string &name, const std::vector< T > &data) const
 Write array attribute. More...
 
template<typename T >
void write_attribute (const std::string &name, const std::vector< T > &data, const std::string &dataset_name) const
 Write array attribute. More...
 
template<typename T >
void write_attribute (const std::string &name, const std::initializer_list< T > &data) const
 Write array attribute. More...
 
template<typename T >
void write_attribute (const std::string &name, const std::initializer_list< T > &data, const std::string &dataset_name) const
 Write array attribute. More...
 
template<int N>
void read (const std::string &name, sddk::mdarray< std::complex< double >, N > &data)
 
template<typename T , int N>
void read (const std::string &name, sddk::mdarray< T, N > &data)
 
template<typename T , int N>
void read (int name_id, sddk::mdarray< T, N > &data)
 
template<typename T >
void read (std::string const &name, T *data, int size)
 Read a vector or a scalar. More...
 
template<typename T >
void read (int name_id, std::vector< T > &vec)
 
template<typename T >
void read (std::string const &name, std::vector< T > &vec)
 
HDF5_tree operator[] (std::string const &path__)
 
HDF5_tree operator[] (int idx__)
 

Private Member Functions

 HDF5_tree (hid_t file_id__, const std::string &path__)
 Constructor to create branches of the HDF5 tree. More...
 
hid_t string_type (const std::string &data, hid_t base_string_type) const
 Create HDF5 string type from std::string. More...
 
template<typename T >
hid_t array_type (const std::vector< T > &data) const
 Create HDF5 array type from std::vector. More...
 
template<typename T >
void write (const std::string &name, T const *data, std::vector< int > const &dims)
 Write a multidimensional array. More...
 
template<typename T >
void write_attribute (const std::string &name, const T *const data, hid_t type_id) const
 
template<typename T >
void write_attribute (const std::string &name, const T *const data, hid_t type_id, const std::string &dataset_name) const
 
template<typename T >
void read (const std::string &name, T *data, std::vector< int > const &dims)
 Read a multidimensional array. More...
 

Private Attributes

std::string file_name_
 HDF5 file name. More...
 
std::string path_
 path inside HDF5 file More...
 
hid_t file_id_ {-1}
 HDF5 file handler. More...
 
bool root_node_ {true}
 True if this is a root node. More...
 

Detailed Description

Interface to the HDF5 library.

Definition at line 85 of file hdf5_tree.hpp.

Constructor & Destructor Documentation

◆ HDF5_tree() [1/2]

sirius::HDF5_tree::HDF5_tree ( hid_t  file_id__,
const std::string &  path__ 
)
inlineprivate

Constructor to create branches of the HDF5 tree.

Definition at line 273 of file hdf5_tree.hpp.

◆ HDF5_tree() [2/2]

sirius::HDF5_tree::HDF5_tree ( const std::string &  file_name__,
hdf5_access_t  access__ 
)
inline

Constructor to create the HDF5 tree.

Definition at line 377 of file hdf5_tree.hpp.

◆ ~HDF5_tree()

sirius::HDF5_tree::~HDF5_tree ( )
inline

Destructor.

Definition at line 413 of file hdf5_tree.hpp.

Member Function Documentation

◆ string_type()

hid_t sirius::HDF5_tree::string_type ( const std::string &  data,
hid_t  base_string_type 
) const
inlineprivate

Create HDF5 string type from std::string.

Definition at line 281 of file hdf5_tree.hpp.

◆ array_type()

template<typename T >
hid_t sirius::HDF5_tree::array_type ( const std::vector< T > &  data) const
inlineprivate

Create HDF5 array type from std::vector.

Definition at line 293 of file hdf5_tree.hpp.

◆ write() [1/8]

template<typename T >
void sirius::HDF5_tree::write ( const std::string &  name,
T const *  data,
std::vector< int > const &  dims 
)
inlineprivate

Write a multidimensional array.

Definition at line 301 of file hdf5_tree.hpp.

◆ write_attribute() [1/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const T *const  data,
hid_t  type_id 
) const
inlineprivate

Write attribure to current GROUP

Parameters
nameName of the attribute
dataAttribute data
type_idAttribute type ID

Definition at line 324 of file hdf5_tree.hpp.

◆ write_attribute() [2/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const T *const  data,
hid_t  type_id,
const std::string &  dataset_name 
) const
inlineprivate

Write attribure to DATASET within the GROUP

Parameters
nameName of the attribute
dataAttribute data
type_idAttribute type ID
dataset_nameDataset in current group to wich attach the attribute

Definition at line 342 of file hdf5_tree.hpp.

◆ read() [1/7]

template<typename T >
void sirius::HDF5_tree::read ( const std::string &  name,
T *  data,
std::vector< int > const &  dims 
)
inlineprivate

Read a multidimensional array.

Definition at line 358 of file hdf5_tree.hpp.

◆ create_node() [1/2]

HDF5_tree sirius::HDF5_tree::create_node ( int  idx)
inline

Create node by integer index.

Create node at the current location using integer index as a name.

Definition at line 424 of file hdf5_tree.hpp.

◆ create_node() [2/2]

HDF5_tree sirius::HDF5_tree::create_node ( std::string const &  name)
inline

Create node by name.

Create node with the given name at the current location.

Definition at line 431 of file hdf5_tree.hpp.

◆ write() [2/8]

template<typename T , int N>
void sirius::HDF5_tree::write ( const std::string &  name,
sddk::mdarray< std::complex< T >, N > const &  data 
)
inline

Definition at line 442 of file hdf5_tree.hpp.

◆ write() [3/8]

template<typename T , int N>
void sirius::HDF5_tree::write ( std::string const &  name__,
sddk::mdarray< T, N > const &  data__ 
)
inline

Write a multidimensional array by name.

Definition at line 454 of file hdf5_tree.hpp.

◆ write() [4/8]

template<typename T , int N>
void sirius::HDF5_tree::write ( int  name_id,
sddk::mdarray< T, N > const &  data 
)
inline

Write a multidimensional array by integer index.

Definition at line 465 of file hdf5_tree.hpp.

◆ write() [5/8]

template<typename T >
void sirius::HDF5_tree::write ( const std::string &  name,
T const *  data,
int  size 
)
inline

Write a buffer.

Definition at line 473 of file hdf5_tree.hpp.

◆ write() [6/8]

template<typename T >
void sirius::HDF5_tree::write ( const std::string &  name,
data 
)
inline

Write a scalar.

Definition at line 482 of file hdf5_tree.hpp.

◆ write() [7/8]

template<typename T >
void sirius::HDF5_tree::write ( int  name_id,
std::vector< T > const &  vec 
)
inline

Write a vector by id.

Definition at line 491 of file hdf5_tree.hpp.

◆ write() [8/8]

template<typename T >
void sirius::HDF5_tree::write ( const std::string &  name,
std::vector< T > const &  vec 
)
inline

Write a vector by name.

Definition at line 499 of file hdf5_tree.hpp.

◆ write_attribute() [3/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const T &  data 
) const
inline

Write attribute.

Definition at line 506 of file hdf5_tree.hpp.

◆ write_attribute() [4/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const T &  data,
const std::string &  dataset_name 
) const
inline

Write attribute.

Definition at line 513 of file hdf5_tree.hpp.

◆ write_attribute() [5/12]

void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::string &  data,
hid_t  base_string_type = H5T_FORTRAN_S1 
) const
inline

Write string attribute.

Definition at line 519 of file hdf5_tree.hpp.

◆ write_attribute() [6/12]

void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::string &  data,
const std::string &  dataset_name,
hid_t  base_string_type = H5T_FORTRAN_S1 
) const
inline

Write string attribute.

Definition at line 526 of file hdf5_tree.hpp.

◆ write_attribute() [7/12]

template<std::size_t N>
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const char(&)  data[N],
hid_t  base_string_type = H5T_FORTRAN_S1 
) const
inline

Write string attribute.

Definition at line 534 of file hdf5_tree.hpp.

◆ write_attribute() [8/12]

template<std::size_t N>
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const char(&)  data[N],
const std::string &  dataset_name,
hid_t  base_string_type = H5T_FORTRAN_S1 
) const
inline

Write string attribute.

Definition at line 541 of file hdf5_tree.hpp.

◆ write_attribute() [9/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::vector< T > &  data 
) const
inline

Write array attribute.

Definition at line 549 of file hdf5_tree.hpp.

◆ write_attribute() [10/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::vector< T > &  data,
const std::string &  dataset_name 
) const
inline

Write array attribute.

Definition at line 556 of file hdf5_tree.hpp.

◆ write_attribute() [11/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::initializer_list< T > &  data 
) const
inline

Write array attribute.

Definition at line 563 of file hdf5_tree.hpp.

◆ write_attribute() [12/12]

template<typename T >
void sirius::HDF5_tree::write_attribute ( const std::string &  name,
const std::initializer_list< T > &  data,
const std::string &  dataset_name 
) const
inline

Write array attribute.

Definition at line 570 of file hdf5_tree.hpp.

◆ read() [2/7]

template<int N>
void sirius::HDF5_tree::read ( const std::string &  name,
sddk::mdarray< std::complex< double >, N > &  data 
)
inline

Definition at line 577 of file hdf5_tree.hpp.

◆ read() [3/7]

template<typename T , int N>
void sirius::HDF5_tree::read ( const std::string &  name,
sddk::mdarray< T, N > &  data 
)
inline

Definition at line 588 of file hdf5_tree.hpp.

◆ read() [4/7]

template<typename T , int N>
void sirius::HDF5_tree::read ( int  name_id,
sddk::mdarray< T, N > &  data 
)
inline

Definition at line 598 of file hdf5_tree.hpp.

◆ read() [5/7]

template<typename T >
void sirius::HDF5_tree::read ( std::string const &  name,
T *  data,
int  size 
)
inline

Read a vector or a scalar.

Definition at line 606 of file hdf5_tree.hpp.

◆ read() [6/7]

template<typename T >
void sirius::HDF5_tree::read ( int  name_id,
std::vector< T > &  vec 
)
inline

Definition at line 614 of file hdf5_tree.hpp.

◆ read() [7/7]

template<typename T >
void sirius::HDF5_tree::read ( std::string const &  name,
std::vector< T > &  vec 
)
inline

Definition at line 620 of file hdf5_tree.hpp.

◆ operator[]() [1/2]

HDF5_tree sirius::HDF5_tree::operator[] ( std::string const &  path__)
inline

Definition at line 625 of file hdf5_tree.hpp.

◆ operator[]() [2/2]

HDF5_tree sirius::HDF5_tree::operator[] ( int  idx__)
inline

Definition at line 631 of file hdf5_tree.hpp.

Member Data Documentation

◆ file_name_

std::string sirius::HDF5_tree::file_name_
private

HDF5 file name.

Definition at line 89 of file hdf5_tree.hpp.

◆ path_

std::string sirius::HDF5_tree::path_
private

path inside HDF5 file

Definition at line 92 of file hdf5_tree.hpp.

◆ file_id_

hid_t sirius::HDF5_tree::file_id_ {-1}
private

HDF5 file handler.

Definition at line 95 of file hdf5_tree.hpp.

◆ root_node_

bool sirius::HDF5_tree::root_node_ {true}
private

True if this is a root node.

Definition at line 98 of file hdf5_tree.hpp.


The documentation for this class was generated from the following file: