Namespaces | Classes | Macros | Enumerations | Functions
HDF5

Functions and classes for manipulating HDF5 files. More...

Namespaces

 h5
 Contains functions and classes for manipulating HDF5 files.
 

Classes

class  h5::Dat
 Represents a multicolumn dat file inside an HDF5 file. More...
 
class  h5::H5File< Access_t >
 Opens an HDF5 file for access and allows manipulation of data. More...
 
class  h5::Header
 Writes header info about the build, git commit, branch, etc. More...
 
class  h5::Object
 Abstract base class representing an object in an HDF5 file. More...
 
class  h5::SourceArchive
 Writes an archive of the source tree into a dataset. More...
 
class  h5::StellarCollapseEos
 Reads in tabulated equation of state file from stellarcollapse.org More...
 
class  h5::Version
 Used to store the version of the file. More...
 
class  h5::VolumeData
 A volume data subfile written inside an H5 file. More...
 

Macros

#define CHECK_H5(h5_status, m)
 Check if an HDF5 operation was successful. More...
 

Enumerations

enum  h5::AccessType { h5::AccessType::ReadWrite, h5::AccessType::ReadOnly }
 Set the access type to the H5File. More...
 

Functions

template<typename T >
void h5::write_data (hid_t group_id, const std::vector< T > &data, const std::vector< size_t > &extents, const std::string &name="scalar") noexcept
 Write a std::vector named name to the group group_id
 
void h5::write_data (hid_t group_id, const DataVector &data, const std::string &name) noexcept
 Write a DataVector named name to the group group_id
 
template<size_t Dim>
void h5::write_extents (hid_t group_id, const Index< Dim > &extents, const std::string &name="Extents")
 Write the extents as an attribute named name to the group group_id.
 
template<typename Type >
void h5::write_to_attribute (hid_t location_id, const std::string &name, const Type &value) noexcept
 Write a value of type Type to an HDF5 attribute named name
 
template<typename T >
void h5::write_to_attribute (hid_t group_id, const std::string &name, const std::vector< T > &data) noexcept
 Write the vector data to the attribute attribute_name in the group group_id.
 
template<typename Type >
Type h5::read_value_attribute (hid_t location_id, const std::string &name) noexcept
 Read a value of type Type from an HDF5 attribute named name
 
template<typename T >
std::vector< T > h5::read_rank1_attribute (hid_t group_id, const std::string &name) noexcept
 Read rank-1 of type Type from an HDF5 attribute named name
 
std::vector< std::stringh5::get_attribute_names (hid_t file_id, const std::string &group_name)
 Get the names of all the attributes in a group.
 
void h5::write_connectivity (hid_t group_id, const std::vector< int > &connectivity) noexcept
 Write the connectivity into the group in the H5 file.
 
std::vector< std::stringh5::get_group_names (hid_t file_id, const std::string &group_name) noexcept
 Get the names of all the groups and datasets in a group.
 
bool h5::contains_dataset_or_group (hid_t id, const std::string &group_name, const std::string &dataset_name) noexcept
 Check if name is a dataset or group in the subgroup group_name of id. More...
 
bool h5::contains_attribute (hid_t file_id, const std::string &group_name, const std::string &attribute_name)
 Check if an attribute is in a group.
 
hid_t h5::open_dataset (hid_t group_id, const std::string &dataset_name) noexcept
 Open an HDF5 dataset.
 
void h5::close_dataset (hid_t dataset_id) noexcept
 Close an HDF5 dataset.
 
hid_t h5::open_dataspace (hid_t dataset_id) noexcept
 Open an HDF5 dataspace.
 
void h5::close_dataspace (hid_t dataspace_id) noexcept
 Close an HDF5 dataspace.
 
template<size_t Rank, typename T >
h5::read_data (hid_t group_id, const std::string &dataset_name) noexcept
 Read an array of rank 0-3 into an object. More...
 
template<size_t Dim>
Index< Dim > h5::read_extents (hid_t group_id, const std::string &extents_name="Extents")
 Read the HDF5 attribute representing extents from a group.
 
template<typename T >
h5::StellarCollapseEos::get_scalar_dataset (const std::string &dataset_name) const noexcept
 reads a rank-0 dataset (contains only one element)
 
std::vector< double > h5::StellarCollapseEos::get_rank1_dataset (const std::string &dataset_name) const noexcept
 reads a dataset with elements along 1 dimension
 
boost::multi_array< double, 3 > h5::StellarCollapseEos::get_rank3_dataset (const std::string &dataset_name) const noexcept
 reads a dataset with elements along 3 dimensions
 
template<typename T >
hid_t h5::h5_type ()
 Returns the HDF5 datatype for the corresponding type T More...
 
hid_t h5::fortran_string () noexcept
 Create an H5 FORTRAN string.
 
auto h5::h5f_acc_rdonly () noexcept
 
auto h5::h5f_acc_rdwr () noexcept
 
auto h5::h5p_default () noexcept
 
auto h5::h5s_all () noexcept
 
auto h5::h5s_unlimited () noexcept
 
auto h5::h5s_scalar () noexcept
 

Detailed Description

Functions and classes for manipulating HDF5 files.

Macro Definition Documentation

◆ CHECK_H5

#define CHECK_H5 (   h5_status,
 
)
Value:
if (h5_status < 0) { /*NOLINT*/ \
ERROR("Failed HDF5 operation: " << m); /*NOLINT*/ \
} else \
static_cast<void>(0)

Check if an HDF5 operation was successful.

Requires: h5_status is a valid HDF5 return type, m is a stringstream syntax error message.

Effects: if h5_status is set to error then aborts execution else none

Enumeration Type Documentation

◆ AccessType

enum h5::AccessType
strong

Set the access type to the H5File.

Enumerator
ReadWrite 

Allow read-write access to the file.

ReadOnly 

Allow only read access to the file.

Function Documentation

◆ contains_dataset_or_group()

bool h5::contains_dataset_or_group ( hid_t  id,
const std::string group_name,
const std::string dataset_name 
)
noexcept

Check if name is a dataset or group in the subgroup group_name of id.

Note
To check the current id for name, pass "" as group_name.

◆ h5_type()

template<typename T >
hid_t h5::h5_type ( )

Returns the HDF5 datatype for the corresponding type T

Requires: T is a valid type with a corresponding HDF5 datatype, i.e. a fundamental or a std::string

Returns: the HDF5 datatype for the corresponding type T

Note
For strings, the returned type must be released with H5Tclose

◆ read_data()

template<size_t Rank, typename T >
T h5::read_data ( hid_t  group_id,
const std::string dataset_name 
)
noexcept

Read an array of rank 0-3 into an object.

For each rank, the data can be read into objects of the following types: rank 0: double or int rank 1: std::vector or DataVector rank 2: boost::multiarray or DataVector rank 3: boost::multiarray or DataVector