Chaste  Release::3.4
AbstractHdf5Access Class Reference

#include <AbstractHdf5Access.hpp>

+ Inheritance diagram for AbstractHdf5Access:
+ Collaboration diagram for AbstractHdf5Access:

Public Member Functions

 AbstractHdf5Access (const std::string &rDirectory, const std::string &rBaseName, const std::string &rDatasetName, bool makeAbsolute=true)
 
 AbstractHdf5Access (const FileFinder &rDirectory, const std::string &rBaseName, const std::string &rDatasetName)
 
virtual ~AbstractHdf5Access ()
 
bool IsDataComplete ()
 
std::vector< unsignedGetIncompleteNodeMap ()
 
std::string GetUnlimitedDimensionName ()
 
std::string GetUnlimitedDimensionUnit ()
 

Protected Member Functions

bool DoesDatasetExist (const std::string &rDatasetName)
 
void SetUnlimitedDatasetId ()
 
void SetMainDatasetRawChunkCache ()
 

Protected Attributes

std::string mBaseName
 
std::string mDatasetName
 
FileFinder mDirectory
 
bool mIsDataComplete
 
std::string mUnlimitedDimensionName
 
std::string mUnlimitedDimensionUnit
 
bool mIsUnlimitedDimensionSet
 
std::vector< unsignedmIncompleteNodeIndices
 
hid_t mFileId
 
hid_t mUnlimitedDatasetId
 
hid_t mVariablesDatasetId
 
hsize_t mDatasetDims [DATASET_DIMS]
 

Static Protected Attributes

static const unsigned DATASET_DIMS =3
 

Detailed Description

Todo:
: magic number

An abstract class to get common code for reading and writing HDF5 files into one place.

It doesn't do very much, but provides common member variables.

Definition at line 55 of file AbstractHdf5Access.hpp.

Constructor & Destructor Documentation

AbstractHdf5Access::AbstractHdf5Access ( const std::string &  rDirectory,
const std::string &  rBaseName,
const std::string &  rDatasetName,
bool  makeAbsolute = true 
)

Constructor for directory given as string

Parameters
rDirectorythe directory in which to read/write the data to file
rBaseNameThe base name of the HDF5 file (with no extension)
rDatasetNameThe dataset name - default is "Data" for voltage and extracellular potential.
makeAbsoluteWhether the h5 file should be treated as relative to Chaste test output, otherwise treated as CWD or absolute.

Definition at line 114 of file AbstractHdf5Access.cpp.

References RelativeTo::Absolute, RelativeTo::ChasteTestOutput, mDirectory, and FileFinder::SetPath().

AbstractHdf5Access::AbstractHdf5Access ( const FileFinder rDirectory,
const std::string &  rBaseName,
const std::string &  rDatasetName 
)

Constructor for directory given as FileFinder

Parameters
rDirectorythe directory in which to read/write the data to file
rBaseNameThe base name of the HDF5 file (with no extension)
rDatasetNameThe dataset name - default is "Data" for voltage and extracellular potential.

Definition at line 135 of file AbstractHdf5Access.cpp.

AbstractHdf5Access::~AbstractHdf5Access ( )
virtual

Destructor.

Definition at line 146 of file AbstractHdf5Access.cpp.

Member Function Documentation

bool AbstractHdf5Access::DoesDatasetExist ( const std::string &  rDatasetName)
protected

Check for the existence of a dataset in an HDF5 file.

Parameters
rDatasetNamethe name of the dataset.
Returns
whether or not the dataset already exists in the file.

Definition at line 39 of file AbstractHdf5Access.cpp.

References mFileId.

Referenced by Hdf5DataWriter::Hdf5DataWriter(), and SetUnlimitedDatasetId().

std::vector< unsigned > AbstractHdf5Access::GetIncompleteNodeMap ( )
Returns
mIncompleteNodeIndices.

Definition at line 157 of file AbstractHdf5Access.cpp.

References mIncompleteNodeIndices.

std::string AbstractHdf5Access::GetUnlimitedDimensionName ( )
Returns
the name of the Unlimited dimension (usually "Time").

Definition at line 162 of file AbstractHdf5Access.cpp.

References mUnlimitedDimensionName.

std::string AbstractHdf5Access::GetUnlimitedDimensionUnit ( )
Returns
the unit of the Unlimited dimension (usually "msec").

Definition at line 167 of file AbstractHdf5Access.cpp.

References mUnlimitedDimensionUnit.

bool AbstractHdf5Access::IsDataComplete ( )

Get method for mIsDataComplete.

Returns
mIsDataComplete.

Definition at line 151 of file AbstractHdf5Access.cpp.

References mIsDataComplete.

void AbstractHdf5Access::SetMainDatasetRawChunkCache ( )
protected

Sets the raw dataset chunk cache for our main dataset (mVariablesDatasetId). The default in HDF5 is 1 MB, which is too small for many problems, so we've bumped it up to 128 M.

Note: this cache is not currently used with the parallel (MPIO and MPIPOSIX) drivers in read/write mode (as we have in Hdf5DataWriter). However it should be used by the Hdf5DataReader (which uses the default driver).

If system memory is at a premium you may find you need to reduce the size of this cache by reducing max_bytes_in_cache.

Definition at line 172 of file AbstractHdf5Access.cpp.

References mFileId, and mVariablesDatasetId.

Referenced by Hdf5DataReader::CommonConstructor(), and Hdf5DataWriter::EndDefineMode().

void AbstractHdf5Access::SetUnlimitedDatasetId ( )
protected

This method sets mUnlimitedDatasetId, the unlimited dataset ID. It does this by looking for a given unlimited dataset name in the file.

Either one of the new format of [mDatasetName + "_Unlimited"], or one of the old format of ["Time"].

Definition at line 64 of file AbstractHdf5Access.cpp.

References DoesDatasetExist(), mDatasetName, mFileId, mIsUnlimitedDimensionSet, mUnlimitedDatasetId, mUnlimitedDimensionName, mUnlimitedDimensionUnit, and NEVER_REACHED.

Referenced by Hdf5DataReader::CommonConstructor(), and Hdf5DataWriter::Hdf5DataWriter().

Member Data Documentation

std::string AbstractHdf5Access::mBaseName
protected

The base name for the data files.

Definition at line 59 of file AbstractHdf5Access.hpp.

Referenced by Hdf5DataReader::CommonConstructor(), and Hdf5DataWriter::OpenFile().

FileFinder AbstractHdf5Access::mDirectory
protected

Directory HDF5 file will be, or is, stored in.

Definition at line 61 of file AbstractHdf5Access.hpp.

Referenced by AbstractHdf5Access(), Hdf5DataReader::CommonConstructor(), and Hdf5DataWriter::OpenFile().

std::string AbstractHdf5Access::mUnlimitedDimensionName
protected
std::string AbstractHdf5Access::mUnlimitedDimensionUnit
protected

The physical units of the unlimited dimension.

Definition at line 66 of file AbstractHdf5Access.hpp.

Referenced by Hdf5DataWriter::DefineUnlimitedDimension(), Hdf5DataWriter::EndDefineMode(), GetUnlimitedDimensionUnit(), and SetUnlimitedDatasetId().


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