Implements a significance map.
More...
#include <SignificanceMap.h>
|
| SignificanceMap () |
|
| SignificanceMap (size_t nx, size_t ny=1, size_t nz=1, size_t nt=1) |
|
| SignificanceMap (std::vector< size_t > dims) |
|
| SignificanceMap (const unsigned char *map, size_t nx, size_t ny=1, size_t nz=1, size_t nt=1) |
|
| SignificanceMap (const unsigned char *map, std::vector< size_t > dims) |
|
| SignificanceMap (const SignificanceMap &) |
|
| ~SignificanceMap () |
|
int | Reshape (std::vector< size_t > dims) |
|
int | Reshape (size_t nx, size_t ny=1, size_t nz=1, size_t nt=1) |
|
void | GetShape (std::vector< size_t > &dims) const |
|
int | Set (size_t idx) |
|
int | SetXYZT (size_t x, size_t y=0, size_t z=0, size_t t=0) |
|
bool | Test (size_t idx) const |
|
bool | TestXYZT (size_t x, size_t y=0, size_t z=0, size_t t=0) const |
|
int | Clear (size_t idx) |
|
int | ClearXYZT (size_t x, size_t y=0, size_t z=0, size_t t=0) |
|
void | Clear () |
|
size_t | GetNumSignificant () const |
|
int | GetCoordinatesXYZT (size_t i, size_t *x, size_t *y=NULL, size_t *z=NULL, size_t *t=NULL) const |
|
int | GetCoordinates (size_t i, size_t *idx) const |
|
void | GetNextEntryRestart () |
|
int | GetNextEntry (size_t *idx) |
|
int | GetNextEntryXYZT (size_t *x, size_t *y, size_t *z, size_t *t) |
|
size_t | GetMapSize (size_t num_entries) const |
|
size_t | GetMapSize () const |
|
void | GetMap (const unsigned char **map, size_t *maplen) |
|
void | GetMap (unsigned char *map) |
|
int | SetMap (const unsigned char *map) |
|
int | Append (const SignificanceMap &smap) |
|
void | Invert () |
|
void | Sort () |
|
SignificanceMap & | operator= (const SignificanceMap &map) |
|
| MyBase () |
|
const string & | getClassName () const |
|
Implements a significance map.
- Author
- John Clyne
- Version
- Revision
- 1.5
- Date
- Date
- 2012/02/28 18:15:58
This class implements a quick and dirty significance map - a mapping indicating which entries in an array are valid and which are not.
Definition at line 35 of file SignificanceMap.h.
VAPoR::SignificanceMap::SignificanceMap |
( |
| ) |
|
VAPoR::SignificanceMap::SignificanceMap |
( |
size_t |
nx, |
|
|
size_t |
ny = 1 , |
|
|
size_t |
nz = 1 , |
|
|
size_t |
nt = 1 |
|
) |
| |
Significance map constructors for 1D, 2D, 3D, and 4D maps
- Parameters
-
[in] | nx | Dimension of X axis (fastest varying) |
[in] | ny | Dimension of Y axis (second fastest varying) |
[in] | nz | Dimension of Z axis (third fastest varying) |
[in] | nt | Dimension of Z axis (fourth fastest varying) |
[in] | dims | A vector specifying the number of dimensions and their lengths. |
VAPoR::SignificanceMap::SignificanceMap |
( |
std::vector< size_t > |
dims | ) |
|
VAPoR::SignificanceMap::SignificanceMap |
( |
const unsigned char * |
map, |
|
|
size_t |
nx, |
|
|
size_t |
ny = 1 , |
|
|
size_t |
nz = 1 , |
|
|
size_t |
nt = 1 |
|
) |
| |
Significance map constructors for 1D, 2D, 3D, and 4D maps, using a previously created map. I.e. a map returned from GetMap()
- Parameters
-
[in] | map | An encoded significance map returned by GetMap() |
[in] | nx | Dimension of X axis (fastest varying) |
[in] | ny | Dimension of Y axis (second fastest varying) |
[in] | nz | Dimension of Z axis (third fastest varying) |
[in] | nt | Dimension of Z axis (fourth fastest varying) |
[in] | dims | A vector specifying the number of dimensions and their lengths. |
VAPoR::SignificanceMap::SignificanceMap |
( |
const unsigned char * |
map, |
|
|
std::vector< size_t > |
dims |
|
) |
| |
Significance map copy constructor
VAPoR::SignificanceMap::~SignificanceMap |
( |
| ) |
|
Append a SignificanceMap
This method appends the coordinates in the map, smap
, to this map, creating a new signficance map containing the entries from both this signficance map and smap
. The ordering of the new map is as if the GetNextEntry() method of smap
was called iteratively, storing the the returned coordinate with Set().
The dimensions of smap
must match those of this map or error condition is returned.
- Parameters
-
[in] | smap | An encoded significance map returned by GetMap() |
- Return values
-
status | a negative value is returned on failure |
int VAPoR::SignificanceMap::Clear |
( |
size_t |
idx | ) |
|
Mark the indicated entry as insignificant
This method clears the indicated entry (marks it as insignificant)
- Return values
-
status | a negative value is returned on failure |
void VAPoR::SignificanceMap::Clear |
( |
| ) |
|
int VAPoR::SignificanceMap::ClearXYZT |
( |
size_t |
x, |
|
|
size_t |
y = 0 , |
|
|
size_t |
z = 0 , |
|
|
size_t |
t = 0 |
|
) |
| |
int VAPoR::SignificanceMap::GetCoordinates |
( |
size_t |
i, |
|
|
size_t * |
idx |
|
) |
| const |
int VAPoR::SignificanceMap::GetCoordinatesXYZT |
( |
size_t |
i, |
|
|
size_t * |
x, |
|
|
size_t * |
y = NULL , |
|
|
size_t * |
z = NULL , |
|
|
size_t * |
t = NULL |
|
) |
| const |
Return coordinates for an ordered entry in the map
Return the coordinates of the ith significant entry in the significant map. Note, the mapping between an entry number and it's coordinates returned by this function are no longer valid after the map is modified (set, cleared, or sorted). If the coordinate pointers, x,y,z,t are null, no value is returned for that coordinate.
Valid values for 'i' are in the range [0..GetNumSignificant()-1]
- Return values
-
status | a negative value is returned on failure |
void VAPoR::SignificanceMap::GetMap |
( |
const unsigned char ** |
map, |
|
|
size_t * |
maplen |
|
) |
| |
Return the compressed representation of the significance map. The data returned are only suitable passing as an argument to the constructor.
- Parameters
-
map[out] | Encoded significance map data |
maplen[out] | Length of map in bytes |
void VAPoR::SignificanceMap::GetMap |
( |
unsigned char * |
map | ) |
|
Return the compressed representation of the significance map. The data returned are only suitable passing as an argument to the constructor.
- Parameters
-
map[out] | Encoded significance map data. Caller is responsible for allocating memory. The array map must be of size GetMapSize(). |
static size_t VAPoR::SignificanceMap::GetMapSize |
( |
vector< size_t > |
dims, |
|
|
size_t |
num_entries |
|
) |
| |
|
static |
Return size in bytes of an encoded signficance map of given size
This static member method returns the size in bytes of an encoded signficance map that would be returned by GetMap() for a SignificanceMap of given dimension, dims
, and number of entries, num_entries
.
size_t VAPoR::SignificanceMap::GetMapSize |
( |
size_t |
num_entries | ) |
const |
Return size in bytes of an encoded signficance map of given size
This method returns the size in bytes of an encoded signficance map that would be returned by GetMap() after the given number of entries, num_entries
, were stored. This method can be used to determine the amount of space required to store an encoded signficance map after num_entries
entries have been stored in it. In general, this is not the same value for the current significance map.
- Parameters
-
num_entries[in] | Number of entries in the signficance map |
- See also
- GetMap()
size_t VAPoR::SignificanceMap::GetMapSize |
( |
| ) |
const |
|
inline |
int VAPoR::SignificanceMap::GetNextEntry |
( |
size_t * |
idx | ) |
|
Return the coordinates for the next signficant entry in the significance map. This method may be called iteratively until all map entries are turned. The GetNextEntryRestart() method may be used to reset the current entry to the first one in the map. A zero value is returned if the entry list is exhausted. The coordinates are returned in the order that they were set with Set() or SetXYZT().
- Note
- For sequential processing of map entries it is preferable to use this method over the indexed GetEntry() method.
- Return values
-
status | a negative value is returned on failure |
void VAPoR::SignificanceMap::GetNextEntryRestart |
( |
| ) |
|
Restart counters for GetNextEntry()
This method is used to restore internal counters used by the GetNextEntry() method
- See also
- GetMextEntry()
int VAPoR::SignificanceMap::GetNextEntryXYZT |
( |
size_t * |
x, |
|
|
size_t * |
y, |
|
|
size_t * |
z, |
|
|
size_t * |
t |
|
) |
| |
size_t VAPoR::SignificanceMap::GetNumSignificant |
( |
| ) |
const |
|
inline |
void VAPoR::SignificanceMap::GetShape |
( |
std::vector< size_t > & |
dims | ) |
const |
|
inline |
void VAPoR::SignificanceMap::Invert |
( |
| ) |
|
Invert the signficance map
This method inverts the signficance map, making insignficant coordinates (those not found in the significance map) into significant coordinates. The ordering of the newly created map will be from smallest to largest coordinate.
- See also
- GetNextEntry()
int VAPoR::SignificanceMap::Reshape |
( |
std::vector< size_t > |
dims | ) |
|
Set the shape (dimension) of a significance map
This method changes the shape (dimension) of a significance map
- Parameters
-
[in] | nx | Dimension of X axis (fastest varying) |
[in] | ny | Dimension of Y axis (second fastest varying) |
[in] | nz | Dimension of Z axis (third fastest varying) |
[in] | nt | Dimension of Z axis (fourth fastest varying) |
[in] | dims | A vector specifying the number of dimensions and their lengths. |
int VAPoR::SignificanceMap::Reshape |
( |
size_t |
nx, |
|
|
size_t |
ny = 1 , |
|
|
size_t |
nz = 1 , |
|
|
size_t |
nt = 1 |
|
) |
| |
int VAPoR::SignificanceMap::Set |
( |
size_t |
idx | ) |
|
Mark a map entry as significant.
This method marks a particular coordinate as significant. The coordinate parameters, x
, y
, z
, and t
, must lie within the range [0..n-1], where n-1 is the value passed as the coordinates dimension to the constructor. No attempt is to prevent duplicate entries. If a coordinate is not specified its default value is zero.
- Parameters
-
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | z | Z coordinate |
[in] | t | T coordinate |
[in] | idx | coordinate specified as an offset from a linear array |
- Return values
-
status | a negative value is returned on failure |
int VAPoR::SignificanceMap::SetMap |
( |
const unsigned char * |
map | ) |
|
Reinitialize the significance map with the map, map
, returned from a previous call to GetMap.
- Parameters
-
[in] | map | An encoded significance map returned by GetMap() |
- See also
- GetMap()
- Return values
-
status | a negative value is returned on failure |
int VAPoR::SignificanceMap::SetXYZT |
( |
size_t |
x, |
|
|
size_t |
y = 0 , |
|
|
size_t |
z = 0 , |
|
|
size_t |
t = 0 |
|
) |
| |
void VAPoR::SignificanceMap::Sort |
( |
| ) |
|
Sort map entries
This method sorts the entries of the significance maps so that they are stored from smallest to largest. Once sorted, map entries returned by GetNextEntry() are guaranteed to be returned from smallest to largest
- See also
- GetNextEntry()
bool VAPoR::SignificanceMap::Test |
( |
size_t |
idx | ) |
const |
|
inline |
Return true if the indicated entry is significant. Test() returns false if the entry is out of range or in range, but not set
- Parameters
-
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | z | Z coordinate |
[in] | t | T coordinate |
[in] | idx | coordinate specified as an offset from a linear array |
Definition at line 333 of file SignificanceMap.h.
Referenced by TestXYZT().
bool VAPoR::SignificanceMap::TestXYZT |
( |
size_t |
x, |
|
|
size_t |
y = 0 , |
|
|
size_t |
z = 0 , |
|
|
size_t |
t = 0 |
|
) |
| const |
|
inline |
std::ostream& operator<< |
( |
std::ostream & |
o, |
|
|
const SignificanceMap & |
sigmap |
|
) |
| |
|
friend |
The documentation for this class was generated from the following file: