Hdf5DataReader.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef HDF5DATAREADER_HPP_
00037 #define HDF5DATAREADER_HPP_
00038
00039
00040 #ifndef H5_USE_16_API
00041 #define H5_USE_16_API 1
00042 #endif
00043
00044 #include <petscvec.h>
00045 #include <vector>
00046 #include <map>
00047
00048 #include "AbstractHdf5Access.hpp"
00049
00053 class Hdf5DataReader : public AbstractHdf5Access
00054 {
00055 private:
00056
00057 unsigned mVariablesDatasetRank;
00059 hsize_t mNumberTimesteps;
00061 std::vector<std::string> mVariableNames;
00062 std::map<std::string, unsigned> mVariableToColumnIndex;
00063 std::map<std::string, std::string> mVariableToUnit;
00065 bool mClosed;
00070 void CommonConstructor();
00071
00072 public:
00073
00083 Hdf5DataReader(const std::string& rDirectory,
00084 const std::string& rBaseName,
00085 bool makeAbsolute=true,
00086 std::string datasetName="Data");
00087
00095 Hdf5DataReader(const FileFinder& rDirectory,
00096 const std::string& rBaseName,
00097 std::string datasetName="Data");
00098
00105 std::vector<double> GetVariableOverTime(const std::string& rVariableName,
00106 unsigned nodeIndex);
00107
00115 std::vector<std::vector<double> > GetVariableOverTimeOverMultipleNodes(const std::string& rVariableName,
00116 unsigned lowerIndex,
00117 unsigned upperIndex);
00118
00126 void GetVariableOverNodes(Vec data, const std::string& rVariableName, unsigned timestep=0);
00127
00131 std::vector<double> GetUnlimitedDimensionValues();
00132
00136 unsigned GetNumberOfRows();
00137
00141 std::vector<std::string> GetVariableNames();
00142
00148 std::string GetUnit(const std::string& rVariableName);
00149
00153 void Close();
00154
00158 ~Hdf5DataReader();
00159 };
00160
00161 #endif