#include <Hdf5DataReader.hpp>
Public Member Functions | |
Hdf5DataReader (const std::string &rDirectory, const std::string &rBaseName, bool makeAbsolute=true) | |
Hdf5DataReader (const FileFinder &rDirectory, const std::string &rBaseName) | |
std::vector< double > | GetVariableOverTime (const std::string &rVariableName, unsigned nodeIndex) |
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) |
bool | IsDataComplete () |
std::vector< unsigned > | GetIncompleteNodeMap () |
void | Close () |
~Hdf5DataReader () | |
Private Member Functions | |
void | CommonConstructor (const FileFinder &rDirectory, const std::string &rBaseName) |
Private Attributes | |
std::string | mDirectory |
std::string | mBaseName |
hid_t | mFileId |
hid_t | mVariablesDatasetId |
unsigned | mVariablesDatasetRank |
hsize_t | mVariablesDatasetSizes [MAX_DATASET_RANK] |
bool | mIsUnlimitedDimensionSet |
hid_t | mTimeDatasetId |
hsize_t | mNumberTimesteps |
std::vector< std::string > | mVariableNames |
std::map< std::string, unsigned > | mVariableToColumnIndex |
std::map< std::string, std::string > | mVariableToUnit |
bool | mIsDataComplete |
std::vector< unsigned > | mIncompleteNodeIndices |
Static Private Attributes | |
static const unsigned | MAX_DATASET_RANK = 3 |
Definition at line 49 of file Hdf5DataReader.hpp.
Hdf5DataReader::Hdf5DataReader | ( | const std::string & | rDirectory, | |
const std::string & | rBaseName, | |||
bool | makeAbsolute = true | |||
) |
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 to convert directory to an absolute path using the OutputFileHandler (defaults to true) |
Definition at line 35 of file Hdf5DataReader.cpp.
References RelativeTo::Absolute, RelativeTo::ChasteTestOutput, and CommonConstructor().
Hdf5DataReader::Hdf5DataReader | ( | const FileFinder & | rDirectory, | |
const std::string & | rBaseName | |||
) |
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) |
Definition at line 56 of file Hdf5DataReader.cpp.
References CommonConstructor().
Hdf5DataReader::~Hdf5DataReader | ( | ) |
void Hdf5DataReader::CommonConstructor | ( | const FileFinder & | rDirectory, | |
const std::string & | rBaseName | |||
) | [private] |
Contains functionality common to both constructors.
rDirectory | The directory the files are stored in | |
rBaseName | The base name of the files to read (i.e. without the extensions) |
Definition at line 66 of file Hdf5DataReader.cpp.
References EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), FileFinder::IsDir(), MAX_DATASET_RANK, mBaseName, mDirectory, mFileId, mIncompleteNodeIndices, mIsDataComplete, mIsUnlimitedDimensionSet, mNumberTimesteps, mTimeDatasetId, mVariableNames, mVariablesDatasetId, mVariablesDatasetRank, mVariablesDatasetSizes, mVariableToColumnIndex, and mVariableToUnit.
Referenced by Hdf5DataReader().
std::vector< double > Hdf5DataReader::GetVariableOverTime | ( | const std::string & | rVariableName, | |
unsigned | nodeIndex | |||
) |
Get the values of a given variable at each time step at a given node.
rVariableName | name of a variable in the data file | |
nodeIndex | the index of the node for which the data is obtained |
Definition at line 196 of file Hdf5DataReader.cpp.
References EXCEPTION, mIncompleteNodeIndices, mIsDataComplete, mIsUnlimitedDimensionSet, mVariablesDatasetId, mVariablesDatasetSizes, and mVariableToColumnIndex.
Referenced by PropagationPropertiesCalculator::CalculateAboveThresholdDepolarisationsForLastAp(), PropagationPropertiesCalculator::CalculateActionPotentialDuration(), PropagationPropertiesCalculator::CalculateAllAboveThresholdDepolarisations(), PropagationPropertiesCalculator::CalculateAllActionPotentialDurations(), PropagationPropertiesCalculator::CalculateAllConductionVelocities(), PropagationPropertiesCalculator::CalculateAllMaximumUpstrokeVelocities(), PropagationPropertiesCalculator::CalculateConductionVelocity(), PropagationPropertiesCalculator::CalculateMaximumUpstrokeVelocity(), PropagationPropertiesCalculator::CalculatePeakMembranePotential(), PropagationPropertiesCalculator::CalculateUpstrokeTimes(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PseudoEcgCalculator(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
void Hdf5DataReader::GetVariableOverNodes | ( | Vec | data, | |
const std::string & | rVariableName, | |||
unsigned | timestep = 0 | |||
) |
Get the values of a given variable at each node at a given time step.
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 258 of file Hdf5DataReader.cpp.
References EXCEPTION, mIsDataComplete, mIsUnlimitedDimensionSet, mNumberTimesteps, mVariablesDatasetId, mVariablesDatasetSizes, and mVariableToColumnIndex.
Referenced by PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputePseudoEcgAtOneTimeStep(), Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), AbstractCardiacProblem< ELEMENT_DIM, ELEMENT_DIM, 1 >::load(), VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh(), Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Write(), and Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write().
std::vector< double > Hdf5DataReader::GetUnlimitedDimensionValues | ( | ) |
Get the unlimited dimension values.
Definition at line 319 of file Hdf5DataReader.cpp.
References mIsUnlimitedDimensionSet, mNumberTimesteps, and mTimeDatasetId.
Referenced by AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::AbstractHdf5Converter(), PropagationPropertiesCalculator::CalculateAboveThresholdDepolarisationsForLastAp(), PropagationPropertiesCalculator::CalculateActionPotentialDuration(), PropagationPropertiesCalculator::CalculateAllAboveThresholdDepolarisations(), PropagationPropertiesCalculator::CalculateAllActionPotentialDurations(), PropagationPropertiesCalculator::CalculateAllConductionVelocities(), PropagationPropertiesCalculator::CalculateAllMaximumUpstrokeVelocities(), PropagationPropertiesCalculator::CalculateConductionVelocity(), PropagationPropertiesCalculator::CalculateMaximumUpstrokeVelocity(), PropagationPropertiesCalculator::CalculateUpstrokeTimes(), AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), VoltageInterpolaterOntoMechanicsMesh< DIM >::VoltageInterpolaterOntoMechanicsMesh(), Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Write(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::WriteCmguiScript(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
unsigned Hdf5DataReader::GetNumberOfRows | ( | ) |
Get the number of rows in the data file.
Definition at line 364 of file Hdf5DataReader.cpp.
References mVariablesDatasetSizes.
Referenced by AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::AbstractHdf5Converter(), Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::PostProcessingWriter(), PseudoEcgCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PseudoEcgCalculator(), Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Write(), and Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write().
std::vector< std::string > Hdf5DataReader::GetVariableNames | ( | ) |
Get the variable names.
Definition at line 369 of file Hdf5DataReader.cpp.
References mVariableNames.
Referenced by AbstractHdf5Converter< ELEMENT_DIM, SPACE_DIM >::AbstractHdf5Converter(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToCmguiConverter(), Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToMeshalyzerConverter(), Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::WriteCmguiScript(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WriteVariablesOverTimeAtNodes().
std::string Hdf5DataReader::GetUnit | ( | const std::string & | rVariableName | ) |
Get the units in which a given variable is measured.
rVariableName | name of a variable in the data file |
Definition at line 374 of file Hdf5DataReader.cpp.
References mVariableToUnit.
bool Hdf5DataReader::IsDataComplete | ( | ) |
Get method for mIsDataComplete.
Definition at line 379 of file Hdf5DataReader.cpp.
References mIsDataComplete.
std::vector< unsigned > Hdf5DataReader::GetIncompleteNodeMap | ( | ) |
Get method for mIncompleteNodeIndices.
Definition at line 384 of file Hdf5DataReader.cpp.
References mIncompleteNodeIndices.
void Hdf5DataReader::Close | ( | ) |
Close any open files.
Definition at line 346 of file Hdf5DataReader.cpp.
References mFileId, mIsUnlimitedDimensionSet, mTimeDatasetId, and mVariablesDatasetId.
Referenced by ~Hdf5DataReader().
const unsigned Hdf5DataReader::MAX_DATASET_RANK = 3 [static, private] |
Defined in HDF5 writer too.
Definition at line 53 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
std::string Hdf5DataReader::mDirectory [private] |
Directory output files will be stored in (absolute path).
Definition at line 55 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
std::string Hdf5DataReader::mBaseName [private] |
The base name for the output data files.
Definition at line 56 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
hid_t Hdf5DataReader::mFileId [private] |
The data file ID.
Definition at line 58 of file Hdf5DataReader.hpp.
Referenced by Close(), and CommonConstructor().
hid_t Hdf5DataReader::mVariablesDatasetId [private] |
The variables data set ID.
Definition at line 60 of file Hdf5DataReader.hpp.
Referenced by Close(), CommonConstructor(), GetVariableOverNodes(), and GetVariableOverTime().
unsigned Hdf5DataReader::mVariablesDatasetRank [private] |
The rank of the variables data set.
Definition at line 61 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor().
hsize_t Hdf5DataReader::mVariablesDatasetSizes[MAX_DATASET_RANK] [private] |
The sizes of each variable data set.
Definition at line 62 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetNumberOfRows(), GetVariableOverNodes(), and GetVariableOverTime().
bool Hdf5DataReader::mIsUnlimitedDimensionSet [private] |
Is the unlimited dimension set
Definition at line 64 of file Hdf5DataReader.hpp.
Referenced by Close(), CommonConstructor(), GetUnlimitedDimensionValues(), GetVariableOverNodes(), and GetVariableOverTime().
hid_t Hdf5DataReader::mTimeDatasetId [private] |
The time data set ID.
Definition at line 65 of file Hdf5DataReader.hpp.
Referenced by Close(), CommonConstructor(), and GetUnlimitedDimensionValues().
hsize_t Hdf5DataReader::mNumberTimesteps [private] |
The number of time steps recorded in the data file.
Definition at line 66 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetUnlimitedDimensionValues(), and GetVariableOverNodes().
std::vector<std::string> Hdf5DataReader::mVariableNames [private] |
The variable names.
Definition at line 68 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetVariableNames().
std::map<std::string, unsigned> Hdf5DataReader::mVariableToColumnIndex [private] |
Map between variable names and data column numbers.
Definition at line 69 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetVariableOverNodes(), and GetVariableOverTime().
std::map<std::string, std::string> Hdf5DataReader::mVariableToUnit [private] |
Map between variable names and variable units.
Definition at line 70 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), and GetUnit().
bool Hdf5DataReader::mIsDataComplete [private] |
Whether the data file is complete.
Definition at line 72 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetVariableOverNodes(), GetVariableOverTime(), and IsDataComplete().
std::vector<unsigned> Hdf5DataReader::mIncompleteNodeIndices [private] |
Vector of node indices for which the data file does not contain data.
Definition at line 73 of file Hdf5DataReader.hpp.
Referenced by CommonConstructor(), GetIncompleteNodeMap(), and GetVariableOverTime().