SpECTRE
v2024.09.29
|
Represents a multicolumn dat file inside an HDF5 file. More...
#include <Dat.hpp>
Public Member Functions | |
HIDDEN_SYMBOLS void | append (const std::vector< double > &data) |
void | append (const std::vector< std::vector< double > > &data) |
void | append (const Matrix &data) |
const std::vector< std::string > & | get_legend () const |
template<typename T = Matrix> | |
T | get_data () const |
template<typename T = Matrix> | |
T | get_data_subset (const std::vector< size_t > &these_columns, size_t first_row=0, size_t num_rows=1) const |
Get only some columns over a range of rows. More... | |
const std::array< hsize_t, 2 > & | get_dimensions () const |
const std::string & | get_header () const |
uint32_t | get_version () const |
const std::string & | subfile_path () const override |
Return the path to the subfile where this object is stored. More... | |
virtual const std::string & | subfile_path () const =0 |
Return the path to the subfile where this object is stored. More... | |
Represents a multicolumn dat file inside an HDF5 file.
A Dat object represents a dat file inside an H5File. A dat file is a multicolumn text file with a header describing what each column represents. Typically dat files are space or tab delimited, and often represent time series data. One common use for them is writing out error norms over the computational domain as a function of time. Inside the H5File they are stored as a string header, and a matrix of doubles holding the data. One problem encountered with dat files is that they quickly increase the file count causing users to run into number of file limitations on HPC systems. Since multiple Dat objects can be stored inside a single H5File the problem of many different dat files being stored as individual files is solved.
void h5::Dat::append | ( | const Matrix & | data | ) |
Requires: data.columns()
is the same as the number of columns in the file
Effects: appends data
to the Dat file
HIDDEN_SYMBOLS void h5::Dat::append | ( | const std::vector< double > & | data | ) |
Requires: data.size()
is the same as the number of columns in the file
Effects: appends data
to the Dat file
void h5::Dat::append | ( | const std::vector< std::vector< double > > & | data | ) |
Requires: data[0].size()
is the same as the number of columns in the file
Effects: appends data
to the Dat file
T h5::Dat::get_data | ( | ) | const |
Returns: all data stored in the Dat file
T h5::Dat::get_data_subset | ( | const std::vector< size_t > & | these_columns, |
size_t | first_row = 0 , |
||
size_t | num_rows = 1 |
||
) | const |
Get only some columns over a range of rows.
Requires: all members of these_columns
have a value less than the number of columns, first_row < last_row
and last_row
is less than or equal to the number of rows
Returns: a subset of the data from the Dat file
|
inline |
Returns: the number of rows (first index) and columns (second index)
|
inline |
Returns: the header of the Dat file
|
inline |
Returns: the legend of the Dat file
|
inline |
Returns: the user-specified version number of the Dat file
|
inlineoverridevirtual |
Return the path to the subfile where this object is stored.
Implements h5::Object.