VAPoR  0.1
Compressor.h
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 
5 #ifndef _Compressor_h_
6 #define _Compressor_h_
7 
8 #include <vector>
9 #include "SignificanceMap.h"
10 #include "MatWaveWavedec.h"
11 
12 namespace VAPoR {
13 
14 
28 //
29 class Compressor : public MatWaveWavedec {
30 public:
31 
47  //
48  Compressor(
49  std::vector <size_t> dims,
50  const string &wname, const string &mode
51  );
52  Compressor(
53  std::vector <size_t> dims,
54  const string &wname
55  );
56 
57  ~Compressor();
58 
77  //
78  int Compress(
79  const float *src_arr, float *dst_arr, size_t dst_arr_len,
80  SignificanceMap *sigmap
81  );
82  int Compress(
83  const double *src_arr, double *dst_arr, size_t dst_arr_len,
84  SignificanceMap *sigmap
85  );
86 
87 
100  //
101  int Decompress(
102  const float *src_arr, float *dst_arr, SignificanceMap *sigmap
103  );
104  int Decompress(
105  const double *src_arr, double *dst_arr, SignificanceMap *sigmap
106  );
107 
136  //
137  int Decompose(
138  const float *src_arr, float *dst_arr, const vector <size_t> &dst_arr_lens,
139  vector <SignificanceMap > &sigmaps
140  );
141  int Decompose(
142  const double *src_arr, double *dst_arr, const vector <size_t> &dst_arr_lens,
143  vector <SignificanceMap > &sigmaps
144  );
145 
182  int Reconstruct(
183  const float *src_arr, float *dst_arr,
184  vector <SignificanceMap > &sigmaps, int l
185  );
186  int Reconstruct(
187  const double *src_arr, double *dst_arr,
188  vector <SignificanceMap > &sigmaps, int l
189  );
190 
203  //static bool IsCompressible(
204 // std::vector <size_t> dims, const string &wavename, const string &mode
205  //);
206 
218  void GetSigMapShape(std::vector <size_t> &dims) const {
219  dims.clear(); dims.push_back(_CLen);
220  };
221 
240  size_t GetNumWaveCoeffs() const { return(_CLen); };
241 
249  size_t GetSigMapSize(size_t num_entries) const {
250  std::vector <size_t> dims; dims.push_back(GetNumWaveCoeffs());
251  return(SignificanceMap::GetMapSize(dims, num_entries));
252  };
253 
254 
269 
270  void GetDimension(vector <size_t> &dims, int l) const;
271 
281  //
282  int GetNumLevels() const {return(_nlevels); };
283 
294  //
295  size_t GetMinCompression() const;
296 
304  bool &KeepAppOnOff() {return(_keepapp); };
305 
316  bool &ClampMinOnOff() {return (_clamp_min_flag); };
317 
322  double &ClampMin() {return (_clamp_min); };
323 
334  bool &ClampMaxOnOff() {return (_clamp_max_flag); };
335 
340  double &ClampMax() {return (_clamp_max); };
341 
352  bool &EpsilonOnOff() {return (_epsilon_flag); };
353 
358  double &Epsilon() {return (_epsilon); };
359 
360  static bool CompressionInfo(
361  vector <size_t> dims, const string wavename,
362  bool keepapp, size_t &nlevels, size_t &maxcratio
363  );
364 
365 
366  friend std::ostream &operator<<(
367  std::ostream &o, const Compressor &rhs
368  );
369 
370 private:
371 
372  vector <size_t> _dims; // dimensions of array
373  int _nlevels; // Number of wavelet transformation levels
374  vector <void *> _indexvec; // used to sort wavelet coefficients
375  size_t _nx;
376  size_t _ny;
377  size_t _nz;
378  double *_C; // storage for wavelet coefficients
379  size_t _CLen;
380  size_t *_L; // wavelet coefficient book keeping array
381  size_t _LLen;
382  bool _keepapp; // if true, approximation coeffs are not used in compression
383  bool _clamp_min_flag;
384  bool _clamp_max_flag;
385  bool _epsilon_flag;
386  double _clamp_min;
387  double _clamp_max;
388  double _epsilon;
389 
390  void _Compressor(std::vector <size_t> dims);
391 
392 };
393 
394 }
395 
396 
397 #endif
int Compress(const float *src_arr, float *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap)
bool & ClampMinOnOff()
Definition: Compressor.h:316
size_t GetMinCompression() const
double & ClampMax()
Definition: Compressor.h:340
Implements a significance map.
void GetSigMapShape(std::vector< size_t > &dims) const
Definition: Compressor.h:218
bool & EpsilonOnOff()
Definition: Compressor.h:352
int Decompress(const float *src_arr, float *dst_arr, SignificanceMap *sigmap)
double & Epsilon()
Definition: Compressor.h:358
friend std::ostream & operator<<(std::ostream &o, const Compressor &rhs)
int Reconstruct(const float *src_arr, float *dst_arr, vector< SignificanceMap > &sigmaps, int l)
Compressor(std::vector< size_t > dims, const string &wname, const string &mode)
static bool CompressionInfo(vector< size_t > dims, const string wavename, bool keepapp, size_t &nlevels, size_t &maxcratio)
bool & ClampMaxOnOff()
Definition: Compressor.h:334
int GetNumLevels() const
Definition: Compressor.h:282
size_t GetMapSize() const
size_t GetSigMapSize(size_t num_entries) const
Definition: Compressor.h:249
int Decompose(const float *src_arr, float *dst_arr, const vector< size_t > &dst_arr_lens, vector< SignificanceMap > &sigmaps)
size_t GetNumWaveCoeffs() const
Definition: Compressor.h:240
double & ClampMin()
Definition: Compressor.h:322
bool & KeepAppOnOff()
Definition: Compressor.h:304
Implements a multi-level wavelet filter.
A class for managing data set metadata.
Definition: Compressor.h:29
void GetDimension(vector< size_t > &dims, int l) const