Hdf5DataReader Class Reference

#include <Hdf5DataReader.hpp>

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

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


Detailed Description

A concrete HDF5 data reader class.

Definition at line 40 of file Hdf5DataReader.hpp.


Constructor & Destructor Documentation

Hdf5DataReader::Hdf5DataReader ( const std::string &  rDirectory,
const std::string &  rBaseName,
bool  makeAbsolute = true 
)

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 to convert directory to an absolute path using the OutputFileHandler (defaults to true)

Definition at line 35 of file Hdf5DataReader.cpp.

References OutputFileHandler::GetOutputDirectoryFullPath(), MAX_DATASET_RANK, mBaseName, mFileId, mIncompleteNodeIndices, mIsDataComplete, mIsUnlimitedDimensionSet, mNumberTimesteps, mTimeDatasetId, mVariableNames, mVariablesDatasetId, mVariablesDatasetRank, mVariablesDatasetSizes, mVariableToColumnIndex, and mVariableToUnit.


Member Function Documentation

std::vector< double > Hdf5DataReader::GetVariableOverTime ( const std::string &  rVariableName,
unsigned  nodeIndex 
)

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.

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

Todo:
Use DistributedVector?

Definition at line 242 of file Hdf5DataReader.cpp.

References mIsDataComplete, mIsUnlimitedDimensionSet, mNumberTimesteps, mVariablesDatasetId, mVariablesDatasetSizes, and mVariableToColumnIndex.

Referenced by Hdf5ToMeshalyzerConverter::Write().

std::vector< double > Hdf5DataReader::GetUnlimitedDimensionValues (  ) 

unsigned Hdf5DataReader::GetNumberOfRows (  ) 

Get the number of rows in the data file.

Definition at line 339 of file Hdf5DataReader.cpp.

References mVariablesDatasetSizes.

Referenced by PostProcessingWriter::PostProcessingWriter(), and Hdf5ToMeshalyzerConverter::Write().

std::vector< std::string > Hdf5DataReader::GetVariableNames (  ) 

Get the variable names.

Definition at line 344 of file Hdf5DataReader.cpp.

References mVariableNames.

Referenced by Hdf5ToMeshalyzerConverter::Hdf5ToMeshalyzerConverter().

std::string Hdf5DataReader::GetUnit ( const std::string &  rVariableName  ) 

Get the units in which a given variable is measured.

Parameters:
rVariableName name of a variable in the data file

Definition at line 349 of file Hdf5DataReader.cpp.

References mVariableToUnit.

bool Hdf5DataReader::IsDataComplete (  ) 

Get method for mIsDataComplete.

Definition at line 354 of file Hdf5DataReader.cpp.

References mIsDataComplete.

std::vector< unsigned > Hdf5DataReader::GetIncompleteNodeMap (  ) 

Get method for mIncompleteNodeIndices.

Definition at line 359 of file Hdf5DataReader.cpp.

References mIncompleteNodeIndices.

void Hdf5DataReader::Close (  ) 

Close any open files.

Definition at line 326 of file Hdf5DataReader.cpp.

References mFileId, mIsUnlimitedDimensionSet, mTimeDatasetId, and mVariablesDatasetId.


Member Data Documentation

const unsigned Hdf5DataReader::MAX_DATASET_RANK = 3 [static, private]

Defined in HDF5 writer too.

Todo:
: define it once

Definition at line 44 of file Hdf5DataReader.hpp.

Referenced by Hdf5DataReader().

std::string Hdf5DataReader::mDirectory [private]

Directory output files will be stored in.

Definition at line 46 of file Hdf5DataReader.hpp.

std::string Hdf5DataReader::mBaseName [private]

The base name for the output data files.

Definition at line 47 of file Hdf5DataReader.hpp.

Referenced by Hdf5DataReader().

hid_t Hdf5DataReader::mFileId [private]

The data file ID.

Definition at line 49 of file Hdf5DataReader.hpp.

Referenced by Close(), and Hdf5DataReader().

The variables data set ID.

Definition at line 51 of file Hdf5DataReader.hpp.

Referenced by Close(), GetVariableOverNodes(), GetVariableOverTime(), and Hdf5DataReader().

The rank of the variables data set.

Definition at line 52 of file Hdf5DataReader.hpp.

Referenced by Hdf5DataReader().

The sizes of each variable data set.

Definition at line 53 of file Hdf5DataReader.hpp.

Referenced by GetNumberOfRows(), GetVariableOverNodes(), GetVariableOverTime(), and Hdf5DataReader().

Is the unlimited dimension set

Definition at line 55 of file Hdf5DataReader.hpp.

Referenced by Close(), GetUnlimitedDimensionValues(), GetVariableOverNodes(), GetVariableOverTime(), and Hdf5DataReader().

The time data set ID.

Definition at line 56 of file Hdf5DataReader.hpp.

Referenced by Close(), GetUnlimitedDimensionValues(), and Hdf5DataReader().

The number of time steps recorded in the data file.

Definition at line 57 of file Hdf5DataReader.hpp.

Referenced by GetUnlimitedDimensionValues(), GetVariableOverNodes(), and Hdf5DataReader().

std::vector<std::string> Hdf5DataReader::mVariableNames [private]

The variable names.

Definition at line 59 of file Hdf5DataReader.hpp.

Referenced by GetVariableNames(), and Hdf5DataReader().

std::map<std::string, unsigned> Hdf5DataReader::mVariableToColumnIndex [private]

Map between variable names and data column numbers.

Definition at line 60 of file Hdf5DataReader.hpp.

Referenced by GetVariableOverNodes(), GetVariableOverTime(), and Hdf5DataReader().

std::map<std::string, std::string> Hdf5DataReader::mVariableToUnit [private]

Map between variable names and variable units.

Definition at line 61 of file Hdf5DataReader.hpp.

Referenced by GetUnit(), and Hdf5DataReader().

Whether the data file is complete.

Definition at line 63 of file Hdf5DataReader.hpp.

Referenced by GetVariableOverNodes(), GetVariableOverTime(), Hdf5DataReader(), and IsDataComplete().

std::vector<unsigned> Hdf5DataReader::mIncompleteNodeIndices [private]

Vector of node indices for which the data file does not contain data.

Definition at line 64 of file Hdf5DataReader.hpp.

Referenced by GetIncompleteNodeMap(), GetVariableOverTime(), and Hdf5DataReader().


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

Generated on Tue Aug 4 16:11:17 2009 for Chaste by  doxygen 1.5.5