Dakota
Version 6.19
Explore and Predict with Confidence
|
Public Member Functions | |
HDF5IOHelper (const std::string &file_name, bool overwrite=false) | |
template<typename T > | |
void | store_scalar (const std::string &dset_name, const T &val) |
Store scalar data to a data set. | |
void | store_scalar (const std::string &dset_name, const String &val) |
Store string scalar data to a data set. | |
template<typename T > | |
void | store_vector (const std::string &dset_name, const std::vector< T > &array) const |
Store vector (1D) information to a dataset. | |
template<typename T > | |
void | store_vector (const std::string &dset_name, const Teuchos::SerialDenseVector< int, T > &vec) |
Store vector (1D) information to a dataset. | |
void | store_vector (const std::string &dset_name, const StringMultiArrayConstView &vec) |
Store vector (1D) information to a dataset. | |
void | store_vector (const std::string &dset_name, const SizetMultiArrayConstView &vec) |
Store vector (1D) information to a dataset. | |
template<typename T > | |
void | store_matrix (const std::string &dset_name, const Teuchos::SerialDenseMatrix< int, T > &matrix, const bool &transpose=false) const |
Store matrix (2D) information to a dataset. | |
template<typename T > | |
void | store_matrix (const std::string &dset_name, const std::vector< T > &buf, const int &num_cols, const bool &transpose=false) const |
Store matrix (2D) information to a dataset. | |
void | store_matrix (const std::string &dset_name, const std::vector< String > &buf, const int &num_cols, const bool &transpose=false) const |
Store matrix (2D) information to a dataset. | |
template<typename T > | |
void | set_scalar (const String &dset_name, const T &data, const int &index) |
Set a scalar in a 1D dataset at index using its name. | |
template<typename T > | |
void | set_scalar (const String &dset_name, H5::DataSet &ds, const T &data, const int &index) |
Set a scalar in a 1D dataset at index using the dataset object. | |
void | set_scalar (const String &dset_name, H5::DataSet &ds, const String &data, const int &index) |
Set a scalar in a 1D dataset at index using the dataset object. More... | |
template<typename T > | |
void | set_vector (const String &dset_name, const T &data, const int &index, const bool &row=true) |
Set a row or column in a 2D dataset at index using its name. | |
void | set_vector (const String &dset_name, H5::DataSet &ds, const StringMultiArrayConstView &data, const int &index, const bool &row=true) |
Set a row or column of Strings in a 2D dataset at index using the dataset object. | |
void | set_vector (const String &dset_name, H5::DataSet &ds, const std::vector< String > &data, const int &index, const bool &row=true) |
Set a row or column of Strings in a 2D dataset at index using the dataset object. | |
template<typename T > | |
void | set_vector (const String &dset_name, H5::DataSet &ds, const T &data, const int &index, const bool &row=true) |
Set a row or column in a 2D dataset at index using the dataset object. | |
template<typename T > | |
void | set_matrix (const String &dset_name, const Teuchos::SerialDenseMatrix< int, T > &data, const int &index, const bool &transpose=false) |
Set a matrix in a 3D dataset at the index into the 0th dimension by name. Dims of matrix must match those of the trailing dimensions of the dataset. | |
template<typename T > | |
void | set_matrix (const String &dset_name, H5::DataSet &ds, const Teuchos::SerialDenseMatrix< int, T > &data, const int &index, const bool &transpose=false) |
Set a matrix in a 3D dataset at the index into the 0th dimension using a dataset object. Dims of matrix must match those of the trailing dimensions of the dataset. | |
template<typename T > | |
void | set_vector_matrix (const String &dset_name, const std::vector< Teuchos::SerialDenseMatrix< int, T > > &data, const int &index, const bool &transpose=false) |
Set a 3D slab in a 4D dataset at the index into the 0th dimension by name. The length of the vector must match the 1st dimension of the dataset, and the dimensions of the matrices must all match the 2nd and 3rd dimensions. | |
template<typename T > | |
void | set_vector_matrix (const String &dset_name, H5::DataSet &ds, const std::vector< Teuchos::SerialDenseMatrix< int, T > > &data, const int &index, const bool &transpose=false) |
Set a 3D slab in a 4D dataset at the index into the 0th dimension using a dataset object. The length of the vector must match the 1st dimension of the dataset, and the dimensions of the matrices must all match the 2nd and 3rd dimensions. | |
template<typename T > | |
void | set_vector_scalar_field (const String &dset_name, const T &data, const String &field_name) |
Set a scalar field on all elements of a 1D dataset of compound type using a ds name. | |
template<typename T > | |
void | set_vector_scalar_field (const String &dset_name, H5::DataSet &ds, const std::vector< T > &data, const String &field_name) |
Set a scalar field on all elements of a 1D dataset of compound type using a ds object. More... | |
template<typename T > | |
void | set_vector_vector_field (const String &dset_name, const T &data, const size_t length, const String &field_name) |
Set a vector field on all elements of a 1D dataset of compound type using a ds name. | |
template<typename T > | |
void | set_vector_vector_field (const String &dset_name, H5::DataSet &ds, const std::vector< T > &data, const size_t length, const String &field_name) |
Set a vector field on all elements of a 1D dataset of compound type using a ds object. More... | |
void | set_vector_vector_field (const String &dset_name, H5::DataSet &ds, const std::vector< String > &data, const size_t length, const String &field_name) |
Set a vector field on all elements of a 1D dataset of compound type using a ds object. More... | |
int | append_empty (const String &dset_name) |
Append an empty "layer" to the 0th dimension and return its index. | |
template<typename T > | |
void | append_scalar (const String &dset_name, const T &data) |
Append a scalar to a 1D dataset. | |
void | append_scalar (const String &dset_name, const String &data) |
Append a scalar to a 1D dataset. | |
template<typename T > | |
void | append_vector (const String &dset_name, const T &data, const bool &row=true) |
Append a vector as a row or column to a 2D dataset. | |
void | append_vector (const String &dset_name, const std::vector< String > &data, const bool &row=true) |
Append a vector as a row or column to a 2D dataset. | |
void | append_vector (const String &dset_name, const StringMultiArrayConstView &data, const bool &row=true) |
Append a vector as a row or column to a 2D dataset. | |
template<typename T > | |
void | append_matrix (const String &dset_name, const Teuchos::SerialDenseMatrix< int, T > &data, const bool &transpose=false) |
Append a SerialDenseMatrix to a 3D dataset. The dataset will be expanded along the 0th dimension. By default, the shape of the matrix, (nrows, ncols), must match the size of the 1st and 2nd dimensions of the dataset. For transpose=true, the reverse must be true. | |
template<typename T > | |
void | append_vector_matrix (const String &dset_name, const std::vector< Teuchos::SerialDenseMatrix< int, T > > &data, const bool &transpose=false) |
Append a std::vector of SerialDenseMatrix's to a 4D dataset. The dataset will be expanded along the 0th dimension. By default, the size of the vector must equal the size of the 1st dimension of the dataset, andthe shape of the SDMs (nrows, ncols), must match the sizes of the 2nd and 2nd dimensions of the dataset. For transpose=true, the reverse must be true of the SDMs. | |
template<typename T > | |
void | read_scalar (const std::string &dset_name, T &val) |
Read scalar data from a dataset. | |
void | read_scalar (const std::string &dset_name, String &val) |
Read scalar data from a dataset. | |
template<typename T > | |
void | read_vector (const std::string &dset_name, T &array) const |
Read vector (1D) information from a dataset. | |
void | read_vector (const std::string &dset_name, StringArray &array) const |
Read a vector of Strings from a dataset. More... | |
template<typename T > | |
void | read_matrix (const std::string &dset_name, Teuchos::SerialDenseMatrix< int, T > &matrix, const bool &transpose=false) const |
Read matrix (2D) information from a dataset Currently this involves a wasteful copy to do the transpose and is intended only for purposes of testing. | |
template<typename T > | |
void | get_matrix (const std::string &dset_name, Teuchos::SerialDenseMatrix< int, T > &matrix, const int &index, const bool &transpose=false) const |
Get the matrix (2D) at the index into the 0th dimension of the 3D dataset at dsetname. Currently this involves a wasteful copy to do the transpose and is intended only for purposes of testing. | |
template<typename T > | |
void | get_vector_matrix (const std::string &dset_name, std::vector< Teuchos::SerialDenseMatrix< int, T > > &data, const int &index, const bool &transpose=false) const |
Read the 3D slice at the index into the 0th dimension of the 4D dataset at ds_name. Currently this involves a wasteful copy to do the transpose and is intended only for purposes of testing. | |
void | report_num_open () |
Report the number of open descriptors of each type; just for debugging. | |
void | create_empty_dataset (const String &dset_name, const IntArray &dims, ResultsOutputType stored_type, int chunk_size=0, const void *fill_val=NULL) |
Create an empty dataset. Setting the first element of dims to 0 makes the dataset unlimited in that dimension. DSs unlimited in other dimensions currently are unsupported. | |
void | create_empty_dataset (const String &dset_name, const IntArray &dims, const std::vector< VariableParametersField > &fields) |
Create a dataset with compound type. | |
void | attach_scale (const String &dset_name, const String &scale_name, const String &label, const int &dim) const |
attach a dimension scale to a dataset | |
template<typename T > | |
void | add_attribute (const String &location, const String &label, const T &value) |
Add an attribute to a group or dataset. | |
void | add_attribute (const String &location, const String &label, const String &value) |
Add an attribute to a group or dataset. | |
bool | exists (const String location_name) const |
Does a group or dataset exist? | |
bool | is_scale (const H5::DataSet dset) const |
Is the dataset a dimenions scale? | |
H5::Group | create_groups (const std::string &name, bool includes_dset=true) const |
Create a group hierarchy (final token optionally a dataset name) | |
H5::DataSet | create_dataset (const H5::H5Location &loc, const std::string &name, const H5::DataType &type, const H5::DataSpace &space, const H5::DSetCreatPropList &create_plist=H5::DSetCreatPropList(), const H5::DSetAccPropList &access_plist=H5::DSetAccPropList()) const |
Create a dataset with a custom CreatPropList. | |
H5::Group | create_group (const H5::H5Location &loc, const std::string &name) const |
Create a group. | |
void | create_softlink (const String &link_location, const String &source_location) |
Create a soft link. | |
void | flush () const |
Flush cache to file. | |
Public Attributes | |
H5::LinkCreatPropList | linkCreatePL |
Gobal link creation property list. | |
H5::DSetCreatPropList | datasetCompactPL |
Gobal DataSet creation property list for compact datasets. | |
H5::DSetCreatPropList | datasetContiguousPL |
Gobal DataSet creation property list for contiguous datasets. | |
Protected Member Functions | |
template<typename T > | |
H5::Attribute | create_attribute (const String &location, const String &label, const T &data) |
create an attribute at the location and return it | |
template<typename T > | |
void | store_vector (const String &dset_name, const T *data, const int &len) const |
Store vector data using a pointer to the first element and length. | |
void | store_vector (const String &dset_name, const String *data, const int &len) const |
Store vector of Strings using a pointer to the first element and length. | |
Protected Attributes | |
std::string | fileName |
Name of the HDF5 file. | |
H5::H5File | h5File |
HDF5 file object. | |
std::map< String, H5::DataSet > | datasetCache |
Cache open datasets that have unlimited dimension This is an optimization to prevent eval-related datasets being repeatedly flushed and reopened, which is very costly. | |
This helper class provides wrapper functions that perform low-level access operations in HDF5 databases.
Authors: J. Adam Stephens, Russell Hooper, Elliott Ridgway
void set_scalar | ( | const String & | dset_name, |
H5::DataSet & | ds, | ||
const String & | data, | ||
const int & | index | ||
) |
Set a scalar in a 1D dataset at index using the dataset object.
Set a scalar in a 1D dataset at index using an object.
void set_vector_scalar_field | ( | const String & | dset_name, |
H5::DataSet & | ds, | ||
const std::vector< T > & | data, | ||
const String & | field_name | ||
) |
Set a scalar field on all elements of a 1D dataset of compound type using a ds object.
Set a field on all elements of a 1D dataset of compound type using a ds object.
References Dakota::h5_mem_dtype().
void set_vector_vector_field | ( | const String & | dset_name, |
H5::DataSet & | ds, | ||
const std::vector< T > & | data, | ||
const size_t | length, | ||
const String & | field_name | ||
) |
Set a vector field on all elements of a 1D dataset of compound type using a ds object.
Set a field on all elements of a 1D dataset of compound type using a ds object.
References Dakota::h5_mem_dtype(), and Dakota::length().
void set_vector_vector_field | ( | const String & | dset_name, |
H5::DataSet & | ds, | ||
const std::vector< String > & | data, | ||
const size_t | length, | ||
const String & | field_name | ||
) |
Set a vector field on all elements of a 1D dataset of compound type using a ds object.
Set a field on all elements of a 1D dataset of compound type using a ds object.
References Dakota::length(), and Dakota::pointers_to_strings().
void read_vector | ( | const std::string & | dset_name, |
StringArray & | array | ||
) | const |
Read a vector of Strings from a dataset.
Read vector (1D) String information from a dataset.
References Dakota::abort_handler(), and Dakota::h5_mem_dtype().