class HDF5HeaderData

data to be added to HDF5 files.

Inheritance:

HDF5HeaderData


public members:

int writeToFile( HDF5Handle & file) const
int readFromFile( HDF5Handle & file)
void clear()
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

Documentation

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

int 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.


this class has no child classes.

alphabetic index hierarchy of classes


Chombo

Copyright Notice

This software is copyright (C) by the Lawrence Berkeley National Laboratory. Permission is granted to reproduce this software for non-commercial purposes provided that this notice is left intact.

It is acknowledged that the U.S. Government has rights to this software under Contract DE-AC03-765F00098 between the U.S. Department of Energy and the University of California.

This software is provided as a professional and academic contribution for joint exchange. Thus it is experimental, is provided ``as is'', with no warranties of any kind whatsoever, no support, no promise of updates, or printed documentation. By using this software, you acknowledge that the Lawrence Berkeley National Laboratory and Regents of the University of California shall have no liability with respect to the infringement of other copyrights by any part of this software.