Chombo + EB  3.0
Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
HDF5HeaderData Class Reference

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, Realm_real
 
map< std::string, int > m_int
 
map< std::string, std::string > m_string
 
map< std::string, IntVectm_intvect
 
map< std::string, Boxm_box
 
map< std::string, RealVectm_realvect
 

Static Private Member Functions

static herr_t attributeScan (hid_t loc_id, const char *name, void *opdata)
 

Detailed Description

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");

Member Function Documentation

◆ writeToFile()

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().

◆ readFromFile()

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().

◆ clear()

void HDF5HeaderData::clear ( )

◆ writeToLocation()

int HDF5HeaderData::writeToLocation ( hid_t  loc_id) const

◆ readFromLocation()

int HDF5HeaderData::readFromLocation ( hid_t  loc_id)

◆ dump()

void HDF5HeaderData::dump ( ) const

useful for debugging. dumps contents to std::cout

◆ attributeScan()

static herr_t HDF5HeaderData::attributeScan ( hid_t  loc_id,
const char *  name,
void *  opdata 
)
staticprivate

Member Data Documentation

◆ m_real

map<std::string, Real> HDF5HeaderData::m_real

◆ m_int

map<std::string, int> HDF5HeaderData::m_int

◆ m_string

map<std::string, std::string> HDF5HeaderData::m_string

Referenced by blockWrite(), and write().

◆ m_intvect

map<std::string, IntVect> HDF5HeaderData::m_intvect

Referenced by blockRead(), blockWrite(), read(), and write().

◆ m_box

map<std::string, Box> HDF5HeaderData::m_box

◆ m_realvect

map<std::string, RealVect> HDF5HeaderData::m_realvect

The documentation for this class was generated from the following file: