SpECTRE
v2023.05.16
|
Contains functions and classes for manipulating HDF5 files. More...
Classes | |
class | Dat |
Represents a multicolumn dat file inside an HDF5 file. More... | |
class | EosTable |
An equation of state table subfile written inside an H5 file. More... | |
class | H5File |
Opens an HDF5 file for access and allows manipulation of data. More... | |
class | Header |
Writes header info about the build, git commit, branch, etc. More... | |
class | Object |
Abstract base class representing an object in an HDF5 file. More... | |
class | SourceArchive |
Writes an archive of the source tree into a dataset. More... | |
class | StellarCollapseEos |
Reads in tabulated equation of state file from stellarcollapse.org More... | |
class | Version |
Used to store the version of the file. More... | |
class | VolumeData |
A volume data subfile written inside an H5 file. More... | |
Enumerations | |
enum class | AccessType { AccessType::ReadWrite , AccessType::ReadOnly } |
Set the access type to the H5File. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &os, AccessType t) |
bool | check_src_files_match (const std::vector< std::string > &input_filenames) |
Check if all files within input_filenames have the same source archive. | |
bool | check_observation_ids_match (const std::vector< std::string > &input_filenames, const std::string &subfile_name) |
Check if all files within input_filenames with volume subfile subfile_name have the same set of observation ids. | |
bool | types_equal (hid_t dtype1, hid_t dtype2) |
Check if dtype1 and dtype2 are the same HDF5 data type. | |
template<typename T > | |
void | write_data (hid_t group_id, const std::vector< T > &data, const std::vector< size_t > &extents, const std::string &name="scalar") |
Write a std::vector named name to the group group_id | |
void | write_data (hid_t group_id, const DataVector &data, const std::string &name) |
Write a DataVector named name to the group group_id | |
template<size_t Dim> | |
void | 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 | write_to_attribute (hid_t location_id, const std::string &name, const Type &value) |
Write a value of type Type to an HDF5 attribute named name | |
template<typename T > | |
void | write_to_attribute (hid_t group_id, const std::string &name, const std::vector< T > &data) |
Write the vector data to the attribute attribute_name in the group group_id . | |
template<typename T , size_t Size> | |
void | write_to_attribute (hid_t group_id, const std::string &name, const std::vector< std::array< T, Size > > &data) |
Write the vector<array<fundamental, size>> data to the attribute name in the group group_id . | |
template<typename Type > | |
Type | read_value_attribute (hid_t location_id, const std::string &name) |
Read a value of type Type from an HDF5 attribute named name | |
template<typename Type > | |
std::vector< Type > | read_rank1_attribute (hid_t group_id, const std::string &name) |
Read rank-1 of type Type from an HDF5 attribute named name | |
template<typename T , size_t Size> | |
std::vector< std::array< T, Size > > | read_rank1_array_attribute (hid_t group_id, const std::string &name) |
Read the vector<array<fundamental, size>> from the attribute name in the group group_id . | |
std::vector< std::string > | get_attribute_names (hid_t file_id, const std::string &group_name) |
Get the names of all the attributes in a group. | |
void | write_connectivity (hid_t group_id, const std::vector< int > &connectivity) |
Write the connectivity into the group in the H5 file. | |
std::vector< std::string > | get_group_names (hid_t file_id, const std::string &group_name) |
Get the names of all the groups and datasets in a group. | |
bool | contains_dataset_or_group (hid_t id, const std::string &group_name, const std::string &dataset_name) |
Check if name is a dataset or group in the subgroup group_name of id . More... | |
bool | 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 | open_dataset (hid_t group_id, const std::string &dataset_name) |
Open an HDF5 dataset. | |
void | close_dataset (hid_t dataset_id) |
Close an HDF5 dataset. | |
hid_t | open_dataspace (hid_t dataset_id) |
Open an HDF5 dataspace. | |
void | close_dataspace (hid_t dataspace_id) |
Close an HDF5 dataspace. | |
template<size_t Rank, typename T > | |
T | read_data (hid_t group_id, const std::string &dataset_name) |
Read an array of rank 0-3 into an object. More... | |
template<size_t Dim> | |
Index< Dim > | read_extents (hid_t group_id, const std::string &extents_name="Extents") |
Read the HDF5 attribute representing extents from a group. | |
template<typename T > | |
hid_t | h5_type () |
Returns the HDF5 datatype for the corresponding type T More... | |
hid_t | fortran_string () |
Create an H5 FORTRAN string. | |
std::pair< size_t, size_t > | offset_and_length_for_grid (const std::string &grid_name, const std::vector< std::string > &all_grid_names, const std::vector< std::vector< size_t > > &all_extents) |
Find the interval within the contiguous dataset stored in h5::VolumeData that holds data for a particular grid_name . More... | |
template<size_t Dim> | |
Mesh< Dim > | mesh_for_grid (const std::string &grid_name, const std::vector< std::string > &all_grid_names, const std::vector< std::vector< size_t > > &all_extents, const std::vector< std::vector< Spectral::Basis > > &all_bases, const std::vector< std::vector< Spectral::Quadrature > > &all_quadratures) |
auto | h5f_acc_rdonly () |
auto | h5f_acc_rdwr () |
auto | h5f_acc_trunc () |
auto | h5p_default () |
auto | h5s_all () |
auto | h5s_unlimited () |
auto | h5s_scalar () |
Contains functions and classes for manipulating HDF5 files.
Wraps many underlying C H5 routines making them easier to use and easier to manipulate H5 files.
std::pair< size_t, size_t > h5::offset_and_length_for_grid | ( | const std::string & | grid_name, |
const std::vector< std::string > & | all_grid_names, | ||
const std::vector< std::vector< size_t > > & | all_extents | ||
) |
Find the interval within the contiguous dataset stored in h5::VolumeData
that holds data for a particular grid_name
.
h5::VolumeData
stores data for all grids that compose the volume contiguously. This function helps with reconstructing which part of that contiguous dataset belongs to a particular grid. See the h5::VolumeData
documentation for more information on how it stores data.
To use this function, call h5::VolumeData::get_grid_names
and h5::VolumeData::get_extents
and pass the results for the all_grid_names
and all_extents
arguments, respectively. This means you can retrieve this information from an h5::VolumeData
once and use it to call offset_and_length_for_grid
multiple times with different grid_name
s.
Here is an example for using this function:
h5::VolumeData