Hdf5DataReader Class Reference

#include <Hdf5DataReader.hpp>

Inherits AbstractHdf5Access.

Collaboration diagram for Hdf5DataReader:
Collaboration graph
[legend]

List of all members.

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< doubleGetVariableOverTime (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< doubleGetUnlimitedDimensionValues ()
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, unsignedmVariableToColumnIndex
std::map< std::string,
std::string > 
mVariableToUnit
bool mClosed

Detailed Description

A concrete HDF5 data reader class.

Todo:
Add to documentation whether we can call this in serial/parallel, whether we can call it when file is open already etc...

Definition at line 55 of file Hdf5DataReader.hpp.


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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 (  ) 

Destructor just calls Close.

Definition at line 437 of file Hdf5DataReader.cpp.

References Close().


Member Function Documentation

void Hdf5DataReader::Close (  ) 
void Hdf5DataReader::CommonConstructor (  )  [private]
unsigned Hdf5DataReader::GetNumberOfRows (  ) 
std::string Hdf5DataReader::GetUnit ( const std::string &  rVariableName  ) 
Returns:
the units in which a given variable is measured.
Parameters:
rVariableName name of a variable in the data file

Definition at line 452 of file Hdf5DataReader.cpp.

References mVariableToUnit.

std::vector< double > Hdf5DataReader::GetUnlimitedDimensionValues (  ) 
std::vector< std::string > Hdf5DataReader::GetVariableNames (  ) 
Returns:
the variable names.

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 
)
std::vector< double > Hdf5DataReader::GetVariableOverTime ( const std::string &  rVariableName,
unsigned  nodeIndex 
)
std::vector< std::vector< double > > Hdf5DataReader::GetVariableOverTimeOverMultipleNodes ( const std::string &  rVariableName,
unsigned  lowerIndex,
unsigned  upperIndex 
)
Returns:
the values of a given variable at each time step over multiple nodes.
Parameters:
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().


Member Data Documentation

Whether we've already closed the file.

Definition at line 67 of file Hdf5DataReader.hpp.

Referenced by Close().

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


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

Generated by  doxygen 1.6.2