Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <Hdf5DataReader.hpp>
Public Member Functions | |
Hdf5DataReader (const std::string &rDirectory, const std::string &rBaseName, bool makeAbsolute=true, std::string datasetName="Data") | |
Hdf5DataReader (const FileFinder &rDirectory, const std::string &rBaseName, std::string datasetName="Data") | |
std::vector< double > | GetVariableOverTime (const std::string &rVariableName, unsigned nodeIndex) |
std::vector< std::vector< double > > | GetVariableOverTimeOverMultipleNodes (const std::string &rVariableName, unsigned lowerIndex, unsigned upperIndex) |
void | GetVariableOverNodes (Vec data, const std::string &rVariableName, unsigned timestep=0) |
std::vector< double > | GetUnlimitedDimensionValues () |
unsigned | GetNumberOfRows () |
std::vector< std::string > | GetVariableNames () |
std::string | GetUnit (const std::string &rVariableName) |
void | Close () |
~Hdf5DataReader () | |
Public Member Functions inherited from AbstractHdf5Access | |
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 () |
Private Member Functions | |
void | CommonConstructor () |
Private Attributes | |
unsigned | mVariablesDatasetRank |
hsize_t | mNumberTimesteps |
std::vector< std::string > | mVariableNames |
std::map< std::string, unsigned > | mVariableToColumnIndex |
std::map< std::string, std::string > | mVariableToUnit |
bool | mClosed |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractHdf5Access | |
bool | DoesDatasetExist (const std::string &rDatasetName) |
void | SetUnlimitedDatasetId () |
void | SetMainDatasetRawChunkCache () |
Protected Attributes inherited from AbstractHdf5Access | |
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 inherited from AbstractHdf5Access | |
static const unsigned | DATASET_DIMS = 3 |
A concrete HDF5 data reader class.
Definition at line 50 of file Hdf5DataReader.hpp.
Hdf5DataReader::Hdf5DataReader | ( | const std::string & | rDirectory, |
const std::string & | rBaseName, | ||
bool | makeAbsolute = true , |
||
std::string | datasetName = "Data" |
||
) |
Read data from the given files into memory.
rDirectory | The directory the files are stored in |
rBaseName | The base name of the files to read (i.e. without the extensions) |
makeAbsolute | Whether the h5 file should be treated as relative to Chaste test output, and converted to absolute, the file is otherwise treated as relative to current working directory. |
datasetName | The name of the HDF5 dataset to read, defaults to "Data". |
Definition at line 44 of file Hdf5DataReader.cpp.
References CommonConstructor().
Hdf5DataReader::Hdf5DataReader | ( | const FileFinder & | rDirectory, |
const std::string & | rBaseName, | ||
std::string | datasetName = "Data" |
||
) |
Alternative constructor taking a FileFinder to specify the directory.
rDirectory | The directory the files are stored in |
rBaseName | The base name of the files to read (i.e. without the extensions) |
datasetName | The name of the HDF5 dataset to read, defaults to "Data". |
Definition at line 55 of file Hdf5DataReader.cpp.
References CommonConstructor().
Hdf5DataReader::~Hdf5DataReader | ( | ) |
void Hdf5DataReader::Close | ( | ) |
Close any open files.
Definition at line 423 of file Hdf5DataReader.cpp.
References mClosed, AbstractHdf5Access::mFileId, AbstractHdf5Access::mIsUnlimitedDimensionSet, AbstractHdf5Access::mUnlimitedDatasetId, and AbstractHdf5Access::mVariablesDatasetId.
Referenced by ~Hdf5DataReader().
|
private |
Contains functionality common to both constructors.
Definition at line 65 of file Hdf5DataReader.cpp.
References RelativeTo::Absolute, AbstractHdf5Access::DATASET_DIMS, EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), FileFinder::IsDir(), AbstractHdf5Access::mBaseName, AbstractHdf5Access::mDatasetDims, AbstractHdf5Access::mDatasetName, AbstractHdf5Access::mDirectory, AbstractHdf5Access::mFileId, AbstractHdf5Access::mIncompleteNodeIndices, AbstractHdf5Access::mIsDataComplete, mNumberTimesteps, AbstractHdf5Access::mUnlimitedDatasetId, mVariableNames, AbstractHdf5Access::mVariablesDatasetId, mVariablesDatasetRank, mVariableToColumnIndex, mVariableToUnit, AbstractHdf5Access::SetMainDatasetRawChunkCache(), and AbstractHdf5Access::SetUnlimitedDatasetId().
Referenced by Hdf5DataReader(), and Hdf5DataReader().
unsigned Hdf5DataReader::GetNumberOfRows | ( | ) |
Definition at line 442 of file Hdf5DataReader.cpp.
References AbstractHdf5Access::mDatasetDims.
Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter(), and PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PseudoEcgCalculator().
std::string Hdf5DataReader::GetUnit | ( | const std::string & | rVariableName | ) |
rVariableName | name of a variable in the data file |
Definition at line 452 of file Hdf5DataReader.cpp.
References mVariableToUnit.
std::vector< double > Hdf5DataReader::GetUnlimitedDimensionValues | ( | ) |
Definition at line 404 of file Hdf5DataReader.cpp.
References AbstractHdf5Access::mIsUnlimitedDimensionSet, mNumberTimesteps, and AbstractHdf5Access::mUnlimitedDatasetId.
Referenced by VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter().
std::vector< std::string > Hdf5DataReader::GetVariableNames | ( | ) |
Definition at line 447 of file Hdf5DataReader.cpp.
References mVariableNames.
void Hdf5DataReader::GetVariableOverNodes | ( | Vec | data, |
const std::string & | rVariableName, | ||
unsigned | timestep = 0 |
||
) |
Return the values of a given variable at each node at a given time step via argument.
data | PETSc vec to hold the data (returned) |
rVariableName | name of a variable in the data file |
timestep | the time step for which the data is obtained (defaults to 0) |
Definition at line 343 of file Hdf5DataReader.cpp.
References EXCEPTION, AbstractHdf5Access::mDatasetDims, AbstractHdf5Access::mDatasetName, AbstractHdf5Access::mIsDataComplete, AbstractHdf5Access::mIsUnlimitedDimensionSet, mNumberTimesteps, AbstractHdf5Access::mVariablesDatasetId, mVariableToColumnIndex, and UNUSED_OPT.
Referenced by VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::load(), and ExtendedBidomainProblem< DIM >::load().
std::vector< double > Hdf5DataReader::GetVariableOverTime | ( | const std::string & | rVariableName, |
unsigned | nodeIndex | ||
) |
rVariableName | name of a variable in the data file |
nodeIndex | the index of the node for which the data is obtained |
Definition at line 219 of file Hdf5DataReader.cpp.
References EXCEPTION, AbstractHdf5Access::mDatasetDims, AbstractHdf5Access::mDatasetName, AbstractHdf5Access::mIncompleteNodeIndices, AbstractHdf5Access::mIsDataComplete, AbstractHdf5Access::mIsUnlimitedDimensionSet, AbstractHdf5Access::mVariablesDatasetId, and mVariableToColumnIndex.
Referenced by PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PseudoEcgCalculator(), PropagationPropertiesCalculator::CalculateAllConductionVelocities(), PropagationPropertiesCalculator::CalculateConductionVelocity(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), and PropagationPropertiesCalculator::rGetCachedVoltages().
std::vector< std::vector< double > > Hdf5DataReader::GetVariableOverTimeOverMultipleNodes | ( | const std::string & | rVariableName, |
unsigned | lowerIndex, | ||
unsigned | upperIndex | ||
) |
rVariableName | name of a variable in the data file |
lowerIndex | the index of the lower node for which the data is obtained |
upperIndex | one past the index of the upper node for which the data is obtained |
Definition at line 277 of file Hdf5DataReader.cpp.
References EXCEPTION, AbstractHdf5Access::mDatasetDims, AbstractHdf5Access::mDatasetName, AbstractHdf5Access::mIsDataComplete, AbstractHdf5Access::mIsUnlimitedDimensionSet, AbstractHdf5Access::mVariablesDatasetId, and mVariableToColumnIndex.
Referenced by PropagationPropertiesCalculator::CalculateAllActionPotentialDurationsForNodeRange().
|
private |
Whether we've already closed the file.
Definition at line 62 of file Hdf5DataReader.hpp.
Referenced by Close().
|
private |
The number of time steps recorded in the data file.
Definition at line 56 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetUnlimitedDimensionValues(), and GetVariableOverNodes().
|
private |
The variable names.
Definition at line 58 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetVariableNames().
|
private |
The rank of the variables data set.
Definition at line 54 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
|
private |
Map between variable names and data column numbers.
Definition at line 59 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetVariableOverNodes(), GetVariableOverTime(), and GetVariableOverTimeOverMultipleNodes().
|
private |
Map between variable names and variable units.
Definition at line 60 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetUnit().