00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _HDF5SERIE_MATRIXSERIE_H_
00023 #define _HDF5SERIE_MATRIXSERIE_H_
00024
00025 #include <fmatvec/atom.h>
00026 #include <H5Cpp.h>
00027 #include <vector>
00028 #include <string>
00029 #include <assert.h>
00030 #include <hdf5serie/simpleattribute.h>
00031 #include <hdf5serie/fileserie.h>
00032
00033 namespace H5 {
00034
00035
00036
00067 template<class T>
00068 class MatrixSerie : public DataSet, public fmatvec::Atom {
00069 private:
00070 DataType memDataType;
00071 DataSpace memDataSpace;
00072 hsize_t dims[3];
00073 public:
00078 MatrixSerie();
00079
00081 MatrixSerie(const MatrixSerie<T>& dataset);
00082
00087 MatrixSerie(const CommonFG& parent, const std::string& name);
00088
00093 MatrixSerie(const CommonFG& parent, const std::string& name, const int rows, const int cols, int compression=FileSerie::getDefaultCompression(), int chunkSize=FileSerie::getDefaultChunkSize());
00094
00101 void create(const CommonFG& parent, const std::string& name, const int rows, const int cols, int compression=FileSerie::getDefaultCompression(), int chunksize=FileSerie::getDefaultChunkSize());
00102
00107 void open(const CommonFG& parent, const std::string& name);
00108
00113 void setDescription(const std::string& desc);
00114
00120 void append(const std::vector<std::vector<T> > &matrix);
00121
00123 inline unsigned int getNumberOfMatrices();
00124
00126 inline unsigned int getRows();
00127
00129 inline unsigned int getColumns();
00130
00135 std::vector<std::vector<T> > getMatrix(const int number);
00136
00141 std::string getDescription();
00142
00143 void extend(const hsize_t* size);
00144 };
00145
00146
00147
00148
00149
00150 template<class T>
00151 unsigned int MatrixSerie<T>::getNumberOfMatrices() {
00152 return dims[0];
00153 }
00154
00155 template<class T>
00156 unsigned int MatrixSerie<T>::getRows() {
00157
00158 DataSpace fileDataSpace=getSpace();
00159 fileDataSpace.getSimpleExtentDims(dims);
00160
00161 return dims[1];
00162 }
00163
00164 template<class T>
00165 unsigned int MatrixSerie<T>::getColumns() {
00166 return dims[2];
00167 }
00168
00169 }
00170
00171 #endif