BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::hdf5 Namespace Reference

Functions

void save_bool_to_file (hid_t &aFileID, const std::string &aLabel, const bool &aValue, herr_t &aStatus)
void load_bool_from_file (hid_t &aFileID, const std::string &aLabel, bool &aValue, herr_t &aStatus)
void save_string_to_file (hid_t &aFileID, const std::string &aLabel, const std::string &aValue, herr_t &aStatus)
void load_string_from_file (hid_t &aFileID, const std::string &aLabel, std::string &aValue, herr_t &aStatus)
hsize_t get_array_size (hid_t &aFileID, const std::string &aLabel)
string create_tree (const Cell< string > &aTree, const string &aLabel)
bool dataset_exists (hid_t aLoc, const std::string &aLabel)
 test if a dataset exists ( tests for a link of that name; the link type is not checked )
bool group_exists (hid_t aLoc, const std::string &aLabel)
 test if a group exists ( tests for a link of that name; the link type is not checked )
Cell< std::string > get_groups (hid_t aLoc)
 list groups that exist in location
template<typename T>
bool check_datatye_size ()
 this function returns true of both the HDF5 datatype and the passed datatype have the same size
template<typename T>
void check_read_datatype (const hid_t aFileType, const std::string &aLabel)
 Guard for every read: the FILE datatype must be convertible into T.
template<typename T>
void save_scalar_to_file (hid_t &aLoc, const std::string &aLabel, const T &aValue, herr_t &aStatus)
 saves a scalar value to a file file must be open
template<typename T>
void load_scalar_from_file (hid_t &aLoc, const std::string &aLabel, T &aValue, herr_t &aStatus)
template<typename T>
void save_array_to_file (hid_t &aLoc, const std::string &aLabel, const T *aData, const hsize_t &aLength, herr_t &aStatus)
template<typename T>
void load_array_from_file (hid_t &aLoc, const std::string &aLabel, T *aData, const hsize_t aLength, herr_t &aStatus)
template<typename T>
void save_vector_to_file (hid_t &aLoc, const std::string &aLabel, const Vector< T > &aVector, herr_t &aStatus)
template<typename T>
void load_vector_from_file (hid_t &aLoc, const std::string &aLabel, Vector< T > &aVector, herr_t &aStatus)
template<typename T>
void save_matrix_to_file (hid_t &aLoc, const std::string &aLabel, const Matrix< T > &aMatrix, herr_t &aStatus, const bool aTranspose=false)
template<typename T>
void load_matrix_from_file (hid_t &aLoc, const std::string &aLabel, Matrix< T > &aMatrix, herr_t &aStatus, const bool aTranspose=false)
void save_strings_to_file (hid_t &aLoc, const std::string &aLabel, const Cell< string > &aCell, herr_t &aStatus)
void load_strings_from_file (hid_t &aLoc, const std::string &aLabel, Cell< string > &aCell, herr_t &aStatus)
hid_t open_group (const std::string &aLabel, hid_t aParent)
herr_t close_group (hid_t aGroup)
template<typename T>
hid_t datatype ()
template<typename T>
hid_t filetype ()

Function Documentation

◆ check_datatye_size()

template<typename T>
bool belfem::hdf5::check_datatye_size ( )

this function returns true of both the HDF5 datatype and the passed datatype have the same size

◆ check_read_datatype()

template<typename T>
void belfem::hdf5::check_read_datatype ( const hid_t aFileType,
const std::string & aLabel )

Guard for every read: the FILE datatype must be convertible into T.

The loaders used to hand the file type to H5Dread as the MEMORY type as well, which tells HDF5 "no conversion" — it then copies at the FILE's element size, so an 8-byte file field read into a 4-byte object overruns it and a 4-byte field into an 8-byte object leaves the upper half uninitialized. Both silent. The exposure is a build-config mismatch, not an OS one: index_t / int_t are flag-selected ( BELFEM_INT64 ), and those are exactly the pointer and index arrays SpMatrix::save and the .bfm meshes write.

The loaders now pass datatype<T>() as the memory type, so HDF5 converts widths itself and a mixed-width file stays READABLE. This function refuses the case conversion cannot fix: a different datatype CLASS ( a float dataset read into an integer, say ), where HDF5 would happily produce numerically meaningless values. Always-active tier — the old class check was a BELFEM_ASSERT and vanished in release, which is where this bites.

◆ close_group()

herr_t belfem::hdf5::close_group ( hid_t aGroup)
inline

◆ create_tree()

string belfem::hdf5::create_tree ( const Cell< string > & aTree,
const string & aLabel )

◆ dataset_exists()

bool belfem::hdf5::dataset_exists ( hid_t aLoc,
const std::string & aLabel )
inline

test if a dataset exists ( tests for a link of that name; the link type is not checked )

◆ datatype()

template<typename T>
hid_t belfem::hdf5::datatype ( )

◆ filetype()

template<typename T>
hid_t belfem::hdf5::filetype ( )

◆ get_array_size()

hsize_t belfem::hdf5::get_array_size ( hid_t & aFileID,
const std::string & aLabel )

◆ get_groups()

Cell< std::string > belfem::hdf5::get_groups ( hid_t aLoc)
inline

list groups that exist in location

◆ group_exists()

bool belfem::hdf5::group_exists ( hid_t aLoc,
const std::string & aLabel )
inline

test if a group exists ( tests for a link of that name; the link type is not checked )

◆ load_array_from_file()

template<typename T>
void belfem::hdf5::load_array_from_file ( hid_t & aLoc,
const std::string & aLabel,
T * aData,
const hsize_t aLength,
herr_t & aStatus )

◆ load_bool_from_file()

void belfem::hdf5::load_bool_from_file ( hid_t & aFileID,
const std::string & aLabel,
bool & aValue,
herr_t & aStatus )

◆ load_matrix_from_file()

template<typename T>
void belfem::hdf5::load_matrix_from_file ( hid_t & aLoc,
const std::string & aLabel,
Matrix< T > & aMatrix,
herr_t & aStatus,
const bool aTranspose = false )

◆ load_scalar_from_file()

template<typename T>
void belfem::hdf5::load_scalar_from_file ( hid_t & aLoc,
const std::string & aLabel,
T & aValue,
herr_t & aStatus )

◆ load_string_from_file()

void belfem::hdf5::load_string_from_file ( hid_t & aFileID,
const std::string & aLabel,
std::string & aValue,
herr_t & aStatus )

◆ load_strings_from_file()

void belfem::hdf5::load_strings_from_file ( hid_t & aLoc,
const std::string & aLabel,
Cell< string > & aCell,
herr_t & aStatus )
inline

◆ load_vector_from_file()

template<typename T>
void belfem::hdf5::load_vector_from_file ( hid_t & aLoc,
const std::string & aLabel,
Vector< T > & aVector,
herr_t & aStatus )

◆ open_group()

hid_t belfem::hdf5::open_group ( const std::string & aLabel,
hid_t aParent )
inline

◆ save_array_to_file()

template<typename T>
void belfem::hdf5::save_array_to_file ( hid_t & aLoc,
const std::string & aLabel,
const T * aData,
const hsize_t & aLength,
herr_t & aStatus )

◆ save_bool_to_file()

void belfem::hdf5::save_bool_to_file ( hid_t & aFileID,
const std::string & aLabel,
const bool & aValue,
herr_t & aStatus )

◆ save_matrix_to_file()

template<typename T>
void belfem::hdf5::save_matrix_to_file ( hid_t & aLoc,
const std::string & aLabel,
const Matrix< T > & aMatrix,
herr_t & aStatus,
const bool aTranspose = false )

◆ save_scalar_to_file()

template<typename T>
void belfem::hdf5::save_scalar_to_file ( hid_t & aLoc,
const std::string & aLabel,
const T & aValue,
herr_t & aStatus )

saves a scalar value to a file file must be open

Parameters
[in]aLoclocation ( file or group ) to write into
[in]aLabeldataset name
[in]aValuevalue that is to be stored
[out]aStatusHDF5 return code of the write

◆ save_string_to_file()

void belfem::hdf5::save_string_to_file ( hid_t & aFileID,
const std::string & aLabel,
const std::string & aValue,
herr_t & aStatus )

◆ save_strings_to_file()

void belfem::hdf5::save_strings_to_file ( hid_t & aLoc,
const std::string & aLabel,
const Cell< string > & aCell,
herr_t & aStatus )
inline

◆ save_vector_to_file()

template<typename T>
void belfem::hdf5::save_vector_to_file ( hid_t & aLoc,
const std::string & aLabel,
const Vector< T > & aVector,
herr_t & aStatus )