Chaste
Release::3.4
|
#include <AbstractHdf5Access.hpp>
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< unsigned > | GetIncompleteNodeMap () |
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< unsigned > | mIncompleteNodeIndices |
hid_t | mFileId |
hid_t | mUnlimitedDatasetId |
hid_t | mVariablesDatasetId |
hsize_t | mDatasetDims [DATASET_DIMS] |
Static Protected Attributes | |
static const unsigned | DATASET_DIMS =3 |
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.
AbstractHdf5Access::AbstractHdf5Access | ( | const std::string & | rDirectory, |
const std::string & | rBaseName, | ||
const std::string & | rDatasetName, | ||
bool | makeAbsolute = true |
||
) |
Constructor for directory given as string
rDirectory | the directory in which to read/write the data to file |
rBaseName | The base name of the HDF5 file (with no extension) |
rDatasetName | The dataset name - default is "Data" for voltage and extracellular potential. |
makeAbsolute | Whether 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
rDirectory | the directory in which to read/write the data to file |
rBaseName | The base name of the HDF5 file (with no extension) |
rDatasetName | The dataset name - default is "Data" for voltage and extracellular potential. |
Definition at line 135 of file AbstractHdf5Access.cpp.
|
virtual |
Destructor.
Definition at line 146 of file AbstractHdf5Access.cpp.
|
protected |
Check for the existence of a dataset in an HDF5 file.
rDatasetName | the name of the dataset. |
Definition at line 39 of file AbstractHdf5Access.cpp.
References mFileId.
Referenced by Hdf5DataWriter::Hdf5DataWriter(), and SetUnlimitedDatasetId().
std::vector< unsigned > AbstractHdf5Access::GetIncompleteNodeMap | ( | ) |
Definition at line 157 of file AbstractHdf5Access.cpp.
References mIncompleteNodeIndices.
std::string AbstractHdf5Access::GetUnlimitedDimensionName | ( | ) |
Definition at line 162 of file AbstractHdf5Access.cpp.
References mUnlimitedDimensionName.
std::string AbstractHdf5Access::GetUnlimitedDimensionUnit | ( | ) |
Definition at line 167 of file AbstractHdf5Access.cpp.
References mUnlimitedDimensionUnit.
bool AbstractHdf5Access::IsDataComplete | ( | ) |
Get method for mIsDataComplete.
Definition at line 151 of file AbstractHdf5Access.cpp.
References mIsDataComplete.
|
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().
|
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().
|
staticprotected |
The dimensions of each dataset (variable, node, time).
Definition at line 62 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataWriter::CalculateChunkDims(), Hdf5DataWriter::CalculateNumberOfChunks(), Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::EndDefineMode(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::PutStripedVector(), Hdf5DataWriter::PutVector(), and Hdf5DataWriter::SetChunkSize().
|
protected |
The base name for the data files.
Definition at line 59 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::CommonConstructor(), and Hdf5DataWriter::OpenFile().
|
protected |
The sizes of each dimension of the dataset (variable, node, time).
Definition at line 73 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), Hdf5DataWriter::CalculateChunkDims(), Hdf5DataWriter::CalculateNumberOfChunks(), Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::EmptyDataset(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetNumberOfRows(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::OpenFile(), and Hdf5DataWriter::PossiblyExtend().
|
protected |
The base name for the dataset we are reading/writing.
Definition at line 60 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), Hdf5DataWriter::Hdf5DataWriter(), and SetUnlimitedDatasetId().
|
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().
|
protected |
The data file ID.
Definition at line 70 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::Close(), Hdf5DataWriter::Close(), Hdf5DataReader::CommonConstructor(), DoesDatasetExist(), Hdf5DataWriter::EndDefineMode(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::OpenFile(), SetMainDatasetRawChunkCache(), and SetUnlimitedDatasetId().
|
protected |
Vector of node indices for which the data file does not contain data.
Definition at line 68 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::ComputeIncompleteOffset(), Hdf5DataWriter::DefineFixedDimension(), Hdf5DataWriter::DefineFixedDimensionUsingMatrix(), Hdf5DataWriter::EndDefineMode(), GetIncompleteNodeMap(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::PutStripedVector(), and Hdf5DataWriter::PutVector().
|
protected |
Whether the data file is complete.
Definition at line 64 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::DefineFixedDimension(), Hdf5DataWriter::DefineFixedDimensionUsingMatrix(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), Hdf5DataWriter::Hdf5DataWriter(), IsDataComplete(), Hdf5DataWriter::PutStripedVector(), and Hdf5DataWriter::PutVector().
|
protected |
Is the unlimited dimension set up at the moment?
Definition at line 67 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), Hdf5DataReader::Close(), Hdf5DataWriter::Close(), Hdf5DataWriter::DefineUnlimitedDimension(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetUnlimitedDimensionValues(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::PutUnlimitedVariable(), and SetUnlimitedDatasetId().
|
protected |
The dataset ID for the unlimited (independent) variable - usually time.
Definition at line 71 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::Close(), Hdf5DataWriter::Close(), Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetUnlimitedDimensionValues(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::PossiblyExtend(), Hdf5DataWriter::PutUnlimitedVariable(), and SetUnlimitedDatasetId().
|
protected |
The name of the unlimited dimension.
Definition at line 65 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataWriter::DefineUnlimitedDimension(), Hdf5DataWriter::EndDefineMode(), GetUnlimitedDimensionName(), and SetUnlimitedDatasetId().
|
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().
|
protected |
The dataset ID for the dependent variables.
Definition at line 72 of file AbstractHdf5Access.hpp.
Referenced by Hdf5DataReader::Close(), Hdf5DataWriter::Close(), Hdf5DataReader::CommonConstructor(), Hdf5DataWriter::EndDefineMode(), Hdf5DataReader::GetVariableOverNodes(), Hdf5DataReader::GetVariableOverTime(), Hdf5DataReader::GetVariableOverTimeOverMultipleNodes(), Hdf5DataWriter::Hdf5DataWriter(), Hdf5DataWriter::OpenFile(), Hdf5DataWriter::PossiblyExtend(), Hdf5DataWriter::PutStripedVector(), Hdf5DataWriter::PutVector(), and SetMainDatasetRawChunkCache().