DUNE: Uniform Navigational Environment  2020.01.0
DUNE::Parsers::HDF5Reader Class Reference

Detailed Description

Simplifies reading data and attributes from HDF5 format files.

Classes

struct  HDF5Dataset
 

Public Member Functions

 HDF5Reader (std::string const &filename)
 
 ~HDF5Reader ()
 
bool datasetExists (std::string const &path) const
 
template<typename T >
HDF5Dataset< T > getDataset (std::string const &path) const
 
template<typename T >
std::vector< T > getAttribute (std::string const &path, std::string const &attribute) const
 

Constructor & Destructor Documentation

DUNE::Parsers::HDF5Reader::HDF5Reader ( std::string const &  filename)

Constructor.

Parameters
[in]filenamepath to an hdf5 file.

References ~HDF5Reader().

DUNE::Parsers::HDF5Reader::~HDF5Reader ( )
default

Destructor.

Referenced by HDF5Reader().

Member Function Documentation

bool DUNE::Parsers::HDF5Reader::datasetExists ( std::string const &  path) const

Check if a dataset exists in the given file.

Parameters
[in]pathpath to the dataset in the file.
Returns
whether the dataset exists in the file.
template<typename T >
template std::vector< long double > DUNE::Parsers::HDF5Reader::getAttribute< long double > ( std::string const &  path,
std::string const &  attribute 
) const

Get an attribute.

Parameters
[in]pathpath to the node in the file where the attribute is stored.
[in]attributename of the attribute to get.
Returns
the attribute's data.

References getDataset().

template<typename T >
template HDF5Reader::HDF5Dataset< long double > DUNE::Parsers::HDF5Reader::getDataset ( std::string const &  path) const

Get a dataset and its dimensions.

Parameters
[in]pathpath to the dataset in the file.
Returns
structure containing the data and the dataset dimensions.

Referenced by getAttribute(), and Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::Gridded2DModelDataStreamGenerator().

Collaboration diagram for DUNE::Parsers::HDF5Reader:
Collaboration graph