#include <Hdf5DataReader.hpp>
Inherits AbstractHdf5Access.
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 () | |
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 |
A concrete HDF5 data reader class.
Definition at line 55 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().
void Hdf5DataReader::CommonConstructor | ( | ) | [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().
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 AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter(), VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh(), PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WritePseudoEcg(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
std::vector< std::string > Hdf5DataReader::GetVariableNames | ( | ) |
Definition at line 447 of file Hdf5DataReader.cpp.
References mVariableNames.
Referenced by PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
void Hdf5DataReader::GetVariableOverNodes | ( | Vec | data, | |
const std::string & | rVariableName, | |||
unsigned | timestep = 0 | |||
) |
data | PETSc vec to hold the data | |
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 PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputePseudoEcgAtOneTimeStep(), ExtendedBidomainProblem< DIM >::load(), AbstractCardiacProblem< DIM, DIM, 1 >::load(), and VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh().
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 PropagationPropertiesCalculator::CalculateAllConductionVelocities(), PropagationPropertiesCalculator::CalculateConductionVelocity(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PseudoEcgCalculator(), PropagationPropertiesCalculator::rGetCachedVoltages(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
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().
bool Hdf5DataReader::mClosed [private] |
Whether we've already closed the file.
Definition at line 67 of file Hdf5DataReader.hpp.
Referenced by Close().
hsize_t Hdf5DataReader::mNumberTimesteps [private] |
The number of time steps recorded in the data file.
Definition at line 61 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetUnlimitedDimensionValues(), and GetVariableOverNodes().
std::vector<std::string> Hdf5DataReader::mVariableNames [private] |
The variable names.
Definition at line 63 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetVariableNames().
The rank of the variables data set.
Definition at line 59 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
std::map<std::string, unsigned> Hdf5DataReader::mVariableToColumnIndex [private] |
Map between variable names and data column numbers.
Definition at line 64 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetVariableOverNodes(), GetVariableOverTime(), and GetVariableOverTimeOverMultipleNodes().
std::map<std::string, std::string> Hdf5DataReader::mVariableToUnit [private] |
Map between variable names and variable units.
Definition at line 65 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetUnit().