![]() |
Nalu
Nalu: a generalized unstructured massively parallel low Mach flow code designed to support a variety of energy applications of interest (most notably Wind ECP) built on the Sierra Toolkit and Trilinos solver Tpetra/Epetra stack. The open source BSD, clause 3 license model has been chosen for the code base. See LICENSE for more information. http://NaluCFD.org
|
Simple wrapper around the HDF5 library to make usage easier. More...
#include <H5IO.h>
Public Member Functions | |
| H5IO () | |
| ~H5IO () | |
| void | create_file (const std::string &name, int version=1) |
| void | open_file (const std::string &name) |
| void | close_file () |
| H5IO | create_group (const std::string &name) |
| H5IO | open_group (const std::string &name) |
| unsigned int | num_attributes () |
| int | file_version () const |
| void | write_attribute (const std::string &name, int value) |
| void | write_attribute (const std::string &name, unsigned int value) |
| void | write_attribute (const std::string &name, double value) |
| void | write_attribute (const std::string &name, const std::string &value) |
| void | write_attribute (const std::string &name, const std::vector< int > &value) |
| void | write_attribute (const std::string &name, const std::vector< unsigned int > &value) |
| void | write_attribute (const std::string &name, const std::vector< double > &value) |
| void | write_attribute (const std::string &name, const std::vector< std::string > &value) |
| bool | has_attribute (const std::string &name) |
| void | read_attribute (const std::string &name, int &value) |
| void | read_attribute (const std::string &name, unsigned int &value) |
| void | read_attribute (const std::string &name, double &value) |
| void | read_attribute (const std::string &name, std::string &value) |
| void | read_attribute (unsigned int index, std::string &name, std::string &value) |
| void | read_attribute (const std::string &name, std::vector< int > &value) |
| void | read_attribute (const std::string &name, std::vector< unsigned int > &value) |
| void | read_attribute (const std::string &name, std::vector< double > &value) |
| void | read_attribute (const std::string &name, std::vector< std::string > &value) |
| void | write_dataset (const std::string &name, const std::vector< double > &value) |
| void | read_dataset (const std::string &name, std::vector< double > &value) |
Private Member Functions | |
| void | h5io_create_group (const std::string &name) |
| void | h5io_open_group (const std::string &name) |
| void | h5io_open_group () |
| void | h5io_close_group () |
| hid_t | h5io_create_scalar () |
| hid_t | h5io_create_1D_array (unsigned int size) |
| hid_t | h5io_create_attribute (const std::string &name, hid_t type, hid_t space) |
| hid_t | h5io_create_dataset (const std::string &name, hid_t type, hid_t space) |
Private Attributes | |
| std::string | fileName_ |
| std::string | groupName_ |
| hid_t | file_ |
| hid_t | group_ |
| int | fileVersion_ |
Simple wrapper around the HDF5 library to make usage easier.
This wrapper supports opening a new file for writing or an old file for reading. Once open, the H5IO object allows reading and writing of both attributes (meta-data) and datasets (large blocks of data) to the file. Sub-groups, similar to sub-directories, can be opened inside the file and written to. Typical usage involves passing name/value pairs to the API, and works something like this:
H5IO io; io.create_file( "fileName.h5" ); io.write_attribute( "attribute1", attribute1 ); io.write_attribute( "attribute2", attribute2 ); io.write_dataset( "data1", data1 ); io.write_dataset( "data2", data2 ); H5IO group = io.create_group( "groupName" ); group.write_attribute( "attribute3", attribute3 ); group.write_dataset( "data3", data3 ); io.close_file();
This data can be read back from disk using a similar procedure. Note that the variables can be read back from the file in a different order (or not at all). The same order is preserved here, for clarity:
H5IO io; io.open_file( "fileName.h5" ); io.read_attribute( "attribute1", attribute1 ); io.read_attribute( "attribute2", attribute2 ); io.read_dataset( "data1", data1 ); io.read_dataset( "data2", data2 ); H5IO group = io.open_group( "groupName" ); group.read_attribute( "attribute3", attribute3 ); group.read_dataset( "data3", data3 ); io.close_file();
| sierra::nalu::H5IO::H5IO | ( | ) |
| sierra::nalu::H5IO::~H5IO | ( | ) |
| void sierra::nalu::H5IO::close_file | ( | ) |
References file_, fileName_, group_, and groupName_.
Referenced by create_file(), open_file(), and sierra::nalu::HDF5FilePtr::~HDF5FilePtr().
| void sierra::nalu::H5IO::create_file | ( | const std::string & | name, |
| int | version = 1 |
||
| ) |
References close_file(), file_, fileName_, fileVersion_, groupName_, and write_attribute().
| H5IO sierra::nalu::H5IO::create_group | ( | const std::string & | name | ) |
|
inline |
References fileVersion_, h5io_close_group(), h5io_create_1D_array(), h5io_create_attribute(), h5io_create_dataset(), h5io_create_group(), h5io_create_scalar(), h5io_open_group(), has_attribute(), read_attribute(), read_dataset(), write_attribute(), and write_dataset().
Referenced by sierra::nalu::BSpline1D::read_hdf5(), sierra::nalu::HStarConverter::read_hdf5(), and sierra::nalu::HDF5Table::read_hdf5_table().
|
private |
References fileName_, group_, and groupName_.
Referenced by file_version(), h5io_create_group(), h5io_open_group(), has_attribute(), num_attributes(), read_attribute(), read_dataset(), write_attribute(), and write_dataset().
|
private |
References fileName_, and groupName_.
Referenced by file_version(), write_attribute(), and write_dataset().
|
private |
References fileName_, group_, and groupName_.
Referenced by file_version(), and write_attribute().
|
private |
References fileName_, group_, and groupName_.
Referenced by file_version(), and write_dataset().
|
private |
References file_, fileName_, group_, groupName_, and h5io_close_group().
Referenced by file_version().
|
private |
References fileName_, and groupName_.
Referenced by file_version(), and write_attribute().
|
private |
References file_, fileName_, group_, groupName_, and h5io_close_group().
|
private |
References file_, fileName_, group_, and groupName_.
Referenced by file_version(), has_attribute(), num_attributes(), read_attribute(), read_dataset(), write_attribute(), and write_dataset().
| bool sierra::nalu::H5IO::has_attribute | ( | const std::string & | name | ) |
References group_, h5io_close_group(), h5io_open_group(), and num_attributes().
Referenced by file_version(), and open_file().
| unsigned int sierra::nalu::H5IO::num_attributes | ( | ) |
References fileName_, group_, groupName_, h5io_close_group(), and h5io_open_group().
Referenced by has_attribute(), and sierra::nalu::HDF5Table::read_hdf5_table().
| void sierra::nalu::H5IO::open_file | ( | const std::string & | name | ) |
References close_file(), file_, fileName_, fileVersion_, groupName_, has_attribute(), and read_attribute().
Referenced by sierra::nalu::HDF5FilePtr::read_hdf5().
| H5IO sierra::nalu::H5IO::open_group | ( | const std::string & | name | ) |
References file_.
Referenced by sierra::nalu::ChiConverter::read_hdf5(), sierra::nalu::BSpline2D::read_hdf5(), sierra::nalu::GammaConverter::read_hdf5(), sierra::nalu::BSpline3D::read_hdf5(), sierra::nalu::BSpline4D::read_hdf5(), sierra::nalu::BSpline5D::read_hdf5(), sierra::nalu::HDF5Table::read_hdf5_property(), and sierra::nalu::HDF5Table::read_hdf5_table().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| int & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
Referenced by file_version(), open_file(), sierra::nalu::HDF5FilePtr::read_hdf5(), sierra::nalu::Converter::read_hdf5(), sierra::nalu::ChiConverter::read_hdf5(), sierra::nalu::BSpline1D::read_hdf5(), sierra::nalu::DeltaChiConverter::read_hdf5(), sierra::nalu::BSpline2D::read_hdf5(), sierra::nalu::DeltaGammaConverter::read_hdf5(), sierra::nalu::BSpline3D::read_hdf5(), sierra::nalu::HStarConverter::read_hdf5(), sierra::nalu::BSpline4D::read_hdf5(), sierra::nalu::BSpline5D::read_hdf5(), sierra::nalu::HDF5Table::read_hdf5_property(), and sierra::nalu::HDF5Table::read_hdf5_table().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| unsigned int & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| double & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| std::string & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | unsigned int | index, |
| std::string & | name, | ||
| std::string & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| std::vector< int > & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| std::vector< unsigned int > & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| std::vector< double > & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_attribute | ( | const std::string & | name, |
| std::vector< std::string > & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
| void sierra::nalu::H5IO::read_dataset | ( | const std::string & | name, |
| std::vector< double > & | value | ||
| ) |
References group_, h5io_close_group(), and h5io_open_group().
Referenced by file_version(), sierra::nalu::BSpline1D::read_hdf5(), and sierra::nalu::HDF5Table::read_hdf5_table().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| int | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_attribute(), h5io_create_scalar(), and h5io_open_group().
Referenced by create_file(), file_version(), sierra::nalu::BSpline1D::write_hdf5(), sierra::nalu::BSpline2D::write_hdf5(), sierra::nalu::BSpline3D::write_hdf5(), sierra::nalu::BSpline4D::write_hdf5(), and sierra::nalu::BSpline5D::write_hdf5().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| unsigned int | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_attribute(), h5io_create_scalar(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| double | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_attribute(), h5io_create_scalar(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_attribute(), h5io_create_scalar(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| const std::vector< int > & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_1D_array(), h5io_create_attribute(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| const std::vector< unsigned int > & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_1D_array(), h5io_create_attribute(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| const std::vector< double > & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_1D_array(), h5io_create_attribute(), and h5io_open_group().
| void sierra::nalu::H5IO::write_attribute | ( | const std::string & | name, |
| const std::vector< std::string > & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_1D_array(), h5io_create_attribute(), and h5io_open_group().
| void sierra::nalu::H5IO::write_dataset | ( | const std::string & | name, |
| const std::vector< double > & | value | ||
| ) |
References fileName_, groupName_, h5io_close_group(), h5io_create_1D_array(), h5io_create_dataset(), and h5io_open_group().
Referenced by file_version().
|
private |
Referenced by close_file(), create_file(), create_group(), h5io_create_group(), h5io_open_group(), open_file(), and open_group().
|
private |
|
private |
Referenced by create_file(), file_version(), and open_file().
|
private |
|
private |
1.8.11