class HDF5Handle

Handle to a particular group in an HDF file.

Inheritance:

HDF5Handle


public members:

enummode

constructor
HDF5Handle()
HDF5Handle(const std::string& a_filename, mode a_mode)

File functions
int open(const std::string& a_filename, mode a_mode)
bool isOpen() const
void close()

Group functions
void setGroupToLevel(int a_level)
int setGroup(const std::string& groupAbsPath)
const std::string& getGroup() const

Documentation

HDF5Handle is a handle to a particular group in an HDF file. Upon construction, group is defined to be the root. All data is written and read assuming the native representations for data on the architecture it is running on. When a file is opened, these settings are checked and an error is flagged when things don't match up. It is the USER'S responsibility to close() this object when it is no longer needed.

enum mode
Enumeration of opening modes for HDF5 files.

CREATE: file is created if it didn't exist, or an existing file of the same name is clobbered.

OPEN_RDONLY: existing file is opened in read-only mode. If the file doesn't already exist then open fails and isOpen() returns false.

OPEN_RDWR: existing file is opened in read-write mode. If the file doesn't already exist then open fails and isOpen() returns false.

HDF5Handle ()
Default constructor. User must call open() prior to using constructed object.

HDF5Handle (const std::string& a_filename, mode a_mode)
Opens file and sets the current group to the root "/" group.

if mode == CREATE, then file is created if it didn't exist, or an existing file of the same name is clobbered.

if mode == OPEN_*, then existing file is opened, if the file doesn't already exist then open fails and isOpen() returns false.

int open (const std::string& a_filename, mode a_mode)
Opens file and sets the current group of this HDF5Handle to the root "/" group. File that this HDF5Handle previously pointed at is NOT closed, that is the users responsibility.

if mode == CREATE, then file is created if it didn't exist, or an existing file of the same name is clobbered.

if mode == OPEN_*, then existing file is opened, if the file doesn't already exist then open fails and isOpen() returns false.

returns:
0 on success
negative number if file open failed (return code from HDF5)
1 file does not appear to contain datacheck info, probably not a Chombo file
2 on data bit size differences between code and file.

aborts on SpaceDim not matching between code and file

bool isOpen () const
A NULL or failed constructed HDF5Handle will return false.

void close ()
Closes the file. Must be called to close file. Files are not automatically closed.

void setGroupToLevel (int a_level)
Sets the current group to be "/levelx" where x=a_level.

int setGroup (const std::string& groupAbsPath)
Set group to users choice, referenced from file root. groupAbsPath will look like a Unix file path: "/mySpecialData/group1/" "/" is the root group of the file. returns a negative value on failure

const std::string& getGroup () const
Returns name of current group. groupAbsPath will look like a Unix file path: "/mySpecialData/group1/" "/" is the root group of the file.


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.