Chombo + EB
3.0
|
data to be added to HDF5 files. More...
#include <CH_HDF5.H>
Public Member Functions | |
int | writeToFile (HDF5Handle &file) const |
int | readFromFile (HDF5Handle &file) |
void | clear () |
int | writeToLocation (hid_t loc_id) const |
int | readFromLocation (hid_t loc_id) |
void | dump () const |
useful for debugging. dumps contents to std::cout More... | |
Public Attributes | |
map< std::string, Real > | m_real |
map< std::string, int > | m_int |
map< std::string, std::string > | m_string |
map< std::string, IntVect > | m_intvect |
map< std::string, Box > | m_box |
map< std::string, RealVect > | m_realvect |
Static Private Member Functions | |
static herr_t | attributeScan (hid_t loc_id, const char *name, void *opdata) |
data to be added to HDF5 files.
HDF5HeaderData is a wrapper for some data maps to be added to HDF5 files. instead of an overdose of access functions, the maps are made public and they can be manipulated by the user at will. They maintain type safety.
to add a Real data entry, a user can simply program as follows:
Real dx;HDF5HeaderData metaData; metaData.m_real["dx"] = dx;
If "dx" already existed, then it is overwritten, otherwise an entry is created and added with the new value;
To search for entries, the user does the following:
HDF5HeaderData metaData; HDF5Handle currentStep(filename); currentStep.setGroupToLevel(0); metaData.readFromFile(currentStep); if (metaData.m_intvect.find("ghost") != metaData.m_intvect.end()) ghost = metaData.m_intvect["ghost"]; else ghost = defaultGhostIntVect;
A user can skip the check for existence if they have reason to "know" the data will be there. It is just good coding practice.
To erase an entry, you can use:
metaData.m_real.erase("dx");
int HDF5HeaderData::writeToFile | ( | HDF5Handle & | file | ) | const |
Writes this HDF5HeaderData's current attribute list to the current group in 'file.' Returns 0 on success, returns the error code from HDF5 on failure.
Referenced by blockWrite(), blockWriteLevel(), write(), and writeLevel().
int HDF5HeaderData::readFromFile | ( | HDF5Handle & | file | ) |
Reads into this HDF5HeaderData's attribute list from file. Read process is add/change, does not remove key-value pairs. Reads from current group. Returns 0 on success, positive number if a particular member of group caused an error, negative on general error.
Referenced by blockRead(), blockReadLevel(), read(), and readLevel().
void HDF5HeaderData::clear | ( | ) |
int HDF5HeaderData::writeToLocation | ( | hid_t | loc_id | ) | const |
int HDF5HeaderData::readFromLocation | ( | hid_t | loc_id | ) |
void HDF5HeaderData::dump | ( | ) | const |
useful for debugging. dumps contents to std::cout
|
staticprivate |
map<std::string, Real> HDF5HeaderData::m_real |
Referenced by blockReadLevel(), blockWriteLevel(), readLevel(), and writeLevel().
map<std::string, int> HDF5HeaderData::m_int |
Referenced by blockRead(), blockReadLevel(), blockWrite(), blockWriteLevel(), read(), readLevel(), write(), and writeLevel().
map<std::string, std::string> HDF5HeaderData::m_string |
Referenced by blockWrite(), and write().
map<std::string, IntVect> HDF5HeaderData::m_intvect |
Referenced by blockRead(), blockWrite(), read(), and write().
map<std::string, Box> HDF5HeaderData::m_box |
Referenced by blockReadLevel(), blockWriteLevel(), readLevel(), and writeLevel().
map<std::string, RealVect> HDF5HeaderData::m_realvect |