5 #ifndef _SignificanceMap_h_
6 #define _SignificanceMap_h_
10 #include <vapor/MyBase.h>
50 SignificanceMap(
size_t nx,
size_t ny = 1,
size_t nz = 1,
size_t nt = 1);
66 const unsigned char *map,
size_t nx,
size_t ny=1,
size_t nz=1,
size_t nt=1
86 int Reshape(std::vector <size_t> dims);
87 int Reshape(
size_t nx,
size_t ny=1,
size_t nz=1,
size_t nt=1);
91 void GetShape(std::vector <size_t> &dims)
const {dims = _dimsVec;};
110 int SetXYZT(
size_t x,
size_t y=0,
size_t z=0,
size_t t=0);
121 bool inline Test(
size_t idx)
const;
122 bool inline TestXYZT(
size_t x,
size_t y=0,
size_t z=0,
size_t t=0)
const;
130 int Clear(
size_t idx);
131 int ClearXYZT(
size_t x,
size_t y=0,
size_t z=0,
size_t t=0);
154 size_t i,
size_t *x,
size_t *y=NULL,
size_t *z=NULL,
size_t *t=NULL
186 size_t *x,
size_t *y,
size_t *z,
size_t *t
196 static size_t GetMapSize(vector <size_t> dims,
size_t num_entries);
232 void GetMap(
const unsigned char **map,
size_t *maplen);
241 void GetMap(
unsigned char *map);
254 int SetMap(
const unsigned char *map);
304 static const int HEADER_SIZE = 64;
305 static const int VDF_VERSION = 2;
313 std::vector <size_t> _dimsVec;
315 std::vector<size_t> _sigMapVec;
318 unsigned char *_sigMapEncode;
319 size_t _sigMapEncodeSize;
323 int _SignificanceMap(std::vector <size_t> dims);
324 int _SignificanceMap(
325 const unsigned char *map, std::vector <size_t> dims
328 static size_t _GetBitsPerIdx(vector <size_t> dims);
335 if (idx > _sigMapSize)
return(0);
338 return(binary_search(_sigMapVec.begin(), _sigMapVec.end(), idx));
341 for (
size_t i = 0; i<_sigMapVec.size(); i++) {
342 if (_sigMapVec[i] == idx)
return(1);
348 size_t x,
size_t y,
size_t z,
size_t t
351 size_t idx = (t * _nz * _ny * _nx) + (z * _ny * _nx) + (y * _nx) + x;
353 return(this->
Test(idx));
size_t GetNumSignificant() const
Implements a significance map.
int Reshape(std::vector< size_t > dims)
int GetCoordinatesXYZT(size_t i, size_t *x, size_t *y=NULL, size_t *z=NULL, size_t *t=NULL) const
int GetNextEntry(size_t *idx)
int GetNextEntryXYZT(size_t *x, size_t *y, size_t *z, size_t *t)
int SetXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0)
int ClearXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0)
void GetMap(const unsigned char **map, size_t *maplen)
SignificanceMap & operator=(const SignificanceMap &map)
int Append(const SignificanceMap &smap)
bool TestXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0) const
size_t GetMapSize() const
void GetNextEntryRestart()
void GetShape(std::vector< size_t > &dims) const
bool Test(size_t idx) const
friend std::ostream & operator<<(std::ostream &o, const SignificanceMap &sigmap)
int GetCoordinates(size_t i, size_t *idx) const
int SetMap(const unsigned char *map)