Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
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 53 of file AbstractHdf5Access.hpp.

Constructor & Destructor Documentation

◆ AbstractHdf5Access() [1/2]

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 96 of file AbstractHdf5Access.cpp.

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

◆ AbstractHdf5Access() [2/2]

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 117 of file AbstractHdf5Access.cpp.

◆ ~AbstractHdf5Access()

AbstractHdf5Access::~AbstractHdf5Access ( )
virtual

Destructor.

Definition at line 128 of file AbstractHdf5Access.cpp.

Member Function Documentation

◆ DoesDatasetExist()

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

◆ GetIncompleteNodeMap()

std::vector< unsigned > AbstractHdf5Access::GetIncompleteNodeMap ( )
Returns
mIncompleteNodeIndices. Vector of node indices for which the data file does not contain data.

Definition at line 137 of file AbstractHdf5Access.cpp.

References mIncompleteNodeIndices.

◆ GetUnlimitedDimensionName()

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

Definition at line 142 of file AbstractHdf5Access.cpp.

References mUnlimitedDimensionName.

◆ GetUnlimitedDimensionUnit()

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

Definition at line 147 of file AbstractHdf5Access.cpp.

References mUnlimitedDimensionUnit.

◆ IsDataComplete()

bool AbstractHdf5Access::IsDataComplete ( )

Get method for mIsDataComplete. If this is true the data file contains entries for all nodes. If this is false the data file only contains entries for some nodes.

Returns
mIsDataComplete.

Definition at line 132 of file AbstractHdf5Access.cpp.

References mIsDataComplete.

◆ SetMainDatasetRawChunkCache()

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 152 of file AbstractHdf5Access.cpp.

References mFileId, and mVariablesDatasetId.

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

◆ SetUnlimitedDatasetId()

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 46 of file AbstractHdf5Access.cpp.

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

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

Member Data Documentation

◆ DATASET_DIMS

◆ mBaseName

std::string AbstractHdf5Access::mBaseName
protected

The base name for the data files.

Definition at line 57 of file AbstractHdf5Access.hpp.

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

◆ mDatasetDims

◆ mDatasetName

◆ mDirectory

FileFinder AbstractHdf5Access::mDirectory
protected

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

Definition at line 59 of file AbstractHdf5Access.hpp.

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

◆ mFileId

◆ mIncompleteNodeIndices

std::vector<unsigned> AbstractHdf5Access::mIncompleteNodeIndices
protected

◆ mIsDataComplete

◆ mIsUnlimitedDimensionSet

◆ mUnlimitedDatasetId

◆ mUnlimitedDimensionName

std::string AbstractHdf5Access::mUnlimitedDimensionName
protected

◆ mUnlimitedDimensionUnit

std::string AbstractHdf5Access::mUnlimitedDimensionUnit
protected

The physical units of the unlimited dimension.

Definition at line 64 of file AbstractHdf5Access.hpp.

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

◆ mVariablesDatasetId


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