UT_VoxelTile< T > Class Template Reference

#include <UT_VoxelArray.h>

List of all members.

Public Types

enum  CompressionType {
  COMPRESS_RAW, COMPRESS_RAWFULL, COMPRESS_CONSTANT, COMPRESS_FPREAL16,
  COMPRESS_ENGINE
}

Public Member Functions

 UT_VoxelTile (int xres, int yres, int zres)
virtual ~UT_VoxelTile ()
 UT_VoxelTile (const UT_VoxelTile< T > &src)
const UT_VoxelTile< T > & operator= (const UT_VoxelTile< T > &src)
operator() (int x, int y, int z) const
lerp (int x, int y, int z, float fx, float fy, float fz) const
T * fillCacheLine (T *cacheline, int &stride, int x, int y, int z, bool forcecopy, bool strideofone) const
void writeCacheLine (T *cacheline, int y, int z)
 Fills a cache line from an external buffer into our own data.
void setValue (int x, int y, int z, T t)
void findMinMax (T &min, T &max) const
 Finds the minimum and maximum T values.
void findAverage (T &avg) const
 Determines the average value of the tile.
bool isConstant () const
 Returns if this tile is constant.
bool hasNan () const
 Returns true if any NANs are in this tile.
bool isRaw () const
 Returns if this tile is in raw format.
bool isRawFull () const
 Returns if this tile is in raw full format.
bool isSimpleCompression () const
bool tryCompress (const UT_VoxelCompressOptions &options)
void makeConstant (T t)
 Turns this tile into a constant tile of the given value.
void makeFpreal16 ()
 Explicit compress to fpreal16. Lossy. No-op if already constant.
void uncompress ()
 Turns a compressed tile into a raw tile.
void uncompressFull ()
 Turns a tile into a raw full tile.
T * rawFullData ()
 Returns the raw full data of the tile.
T * rawData ()
const T * rawData () const
int xres () const
 Read the current resolution.
int yres () const
int zres () const
int getRes (int dim) const
int numVoxels () const
int64 getMemoryUsage () const
 Returns the amount of memory used by this tile.
int64 getDataLength () const
 Returns the amount of data used by the tile myData pointer.
void weightedSum (int pstart[3], int pend[3], float *weights[3], int start[3], T &result)
void save (ostream &os)
void load (UT_IStream &is, const UT_IntArray &compression)

Static Public Member Functions

static T lerpValues (T v1, T v2, fpreal32 bias)
 Lerps two numbers, templated to work with T.
static void expandMinMax (T v, T &min, T &max)
 Designed to be specialized according to T.
static fpreal dist (T a, T b)
static void registerCompressionEngine (UT_VoxelTileCompress< T > *engine)
static int lookupCompressionEngine (const char *name)
static UT_VoxelTileCompress< T > * getCompressionEngine (int index)
static void saveCompressionTypes (ostream &os)
 Stores a list of compresson engines to os.
static void loadCompressionTypes (UT_IStream &is, UT_IntArray &compressions)

Public Attributes

void * myData

Protected Member Functions

bool writeThrough (int x, int y, int z, T t)

Friends

class UT_VoxelTileCompress< T >
class UT_VoxelProbe


Detailed Description

template<typename T>
class UT_VoxelTile< T >

UT_VoxelTile

A UT_VoxelArray is composed of a number of these tiles. This is done for two reasons: 1) Increased memory locality when processing neighbouring points. 2) Ability to compress or page out unneeded tiles. Currently, the only special ability is the ability to create constant tiles.

To the end user of the UT_VoxelArray, the UT_VoxelTile should be usually transparent. The only exception may be if they want to do a FOR_ALL_TILES in order to ensure an optimal traversal order.

Definition at line 257 of file UT_VoxelArray.h.


Member Enumeration Documentation

template<typename T>
enum UT_VoxelTile::CompressionType

Enumerator:
COMPRESS_RAW 
COMPRESS_RAWFULL 
COMPRESS_CONSTANT 
COMPRESS_FPREAL16 
COMPRESS_ENGINE 

Definition at line 269 of file UT_VoxelArray.h.


Constructor & Destructor Documentation

template<typename T >
UT_VoxelTile< T >::UT_VoxelTile ( int  xres,
int  yres,
int  zres 
) [inline]

Definition at line 81 of file UT_VoxelArray.C.

template<typename T >
UT_VoxelTile< T >::~UT_VoxelTile (  )  [inline, virtual]

Definition at line 98 of file UT_VoxelArray.C.

template<typename T>
UT_VoxelTile< T >::UT_VoxelTile ( const UT_VoxelTile< T > &  src  )  [inline]

Definition at line 104 of file UT_VoxelArray.C.


Member Function Documentation

template<typename T>
static fpreal UT_VoxelTile< T >::dist ( a,
b 
) [inline, static]

Return the "distance" of a & b. This is used for tolerance checks on equality comparisons.

Definition at line 443 of file UT_VoxelArray.h.

template<typename T>
static void UT_VoxelTile< T >::expandMinMax ( v,
T &  min,
T &  max 
) [inline, static]

Designed to be specialized according to T.

Update min & max to encompass T itself.

Definition at line 436 of file UT_VoxelArray.h.

template<typename T>
T * UT_VoxelTile< T >::fillCacheLine ( T *  cacheline,
int &  stride,
int  x,
int  y,
int  z,
bool  forcecopy,
bool  strideofone 
) const [inline]

Returns a cached line to our internal data, at local address x,y,z. cacheline is a caller allocated structure to fill out if we have to decompress. If forcecopy isn't set and we can, the result may be an internal pointer. stride is set to the update for moving one x position in the cache. strideofone should be set to true if you want to prevent 0 stride results for constant tiles.

Definition at line 385 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::findAverage ( T &  avg  )  const [inline]

Determines the average value of the tile.

Definition at line 715 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::findMinMax ( T &  min,
T &  max 
) const [inline]

Finds the minimum and maximum T values.

Definition at line 854 of file UT_VoxelArray.C.

template<typename T >
UT_VoxelTileCompress< T > * UT_VoxelTile< T >::getCompressionEngine ( int  index  )  [inline, static]

Definition at line 1342 of file UT_VoxelArray.C.

template<typename T >
int64 UT_VoxelTile< T >::getDataLength (  )  const [inline]

Returns the amount of data used by the tile myData pointer.

Definition at line 1119 of file UT_VoxelArray.C.

template<typename T >
int64 UT_VoxelTile< T >::getMemoryUsage ( void   )  const [inline]

Returns the amount of memory used by this tile.

Definition at line 1108 of file UT_VoxelArray.C.

template<typename T>
int UT_VoxelTile< T >::getRes ( int  dim  )  const [inline]

Definition at line 413 of file UT_VoxelArray.h.

template<typename T >
bool UT_VoxelTile< T >::hasNan (  )  const [inline]

Returns true if any NANs are in this tile.

Definition at line 928 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelTile< T >::isConstant (  )  const [inline]

Returns if this tile is constant.

Definition at line 352 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTile< T >::isRaw (  )  const [inline]

Returns if this tile is in raw format.

Definition at line 359 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTile< T >::isRawFull (  )  const [inline]

Returns if this tile is in raw full format.

Definition at line 363 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTile< T >::isSimpleCompression (  )  const [inline]

Returns true if this is a simple form of compression, either constant, raw, or a raw full that isn't padded

Definition at line 368 of file UT_VoxelArray.h.

template<typename T >
T UT_VoxelTile< T >::lerp ( int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const [inline]

Does a trilinear interpolation. x,y,z should be local to this as should x+1, y+1, and z+1. fx-fz should be 0..1.

Definition at line 201 of file UT_VoxelArray.C.

template<typename T>
static T UT_VoxelTile< T >::lerpValues ( v1,
v2,
fpreal32  bias 
) [inline, static]

Lerps two numbers, templated to work with T.

Definition at line 315 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelTile< T >::load ( UT_IStream is,
const UT_IntArray compression 
) [inline]

Loads tile data. Uses the compression index to map the saved compression types into the correct loading compression types.

Definition at line 1403 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::loadCompressionTypes ( UT_IStream is,
UT_IntArray compressions 
) [inline, static]

Builds a translation table from the given stream's compression types into our own valid compression types.

Definition at line 1496 of file UT_VoxelArray.C.

template<typename T >
int UT_VoxelTile< T >::lookupCompressionEngine ( const char *  name  )  [inline, static]

Definition at line 1322 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::makeConstant ( t  )  [inline]

Turns this tile into a constant tile of the given value.

Definition at line 1048 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::makeFpreal16 (  )  [inline]

Explicit compress to fpreal16. Lossy. No-op if already constant.

Definition at line 1062 of file UT_VoxelArray.C.

template<typename T>
int UT_VoxelTile< T >::numVoxels (  )  const [inline]

Definition at line 416 of file UT_VoxelArray.h.

template<typename T>
T UT_VoxelTile< T >::operator() ( int  x,
int  y,
int  z 
) const [inline]

Fetch a given local value. (x,y,z) should be local to this tile.

Definition at line 280 of file UT_VoxelArray.h.

template<typename T>
const UT_VoxelTile< T > & UT_VoxelTile< T >::operator= ( const UT_VoxelTile< T > &  src  )  [inline]

Definition at line 114 of file UT_VoxelArray.C.

template<typename T>
const T* UT_VoxelTile< T >::rawData (  )  const [inline]

Definition at line 404 of file UT_VoxelArray.h.

template<typename T>
T* UT_VoxelTile< T >::rawData (  )  [inline]

This only makes sense for simple compression. Use with extreme care.

Definition at line 402 of file UT_VoxelArray.h.

template<typename T>
T* UT_VoxelTile< T >::rawFullData (  )  [inline]

Returns the raw full data of the tile.

Definition at line 394 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelTile< T >::registerCompressionEngine ( UT_VoxelTileCompress< T > *  engine  )  [inline, static]

Definition at line 1303 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::save ( ostream &  os  )  [inline]

Saves this tile's data, in compressed form. May uncompress itself if the engine doesn't support saving.

Definition at line 1351 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::saveCompressionTypes ( ostream &  os  )  [inline, static]

Stores a list of compresson engines to os.

Definition at line 1472 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::setValue ( int  x,
int  y,
int  z,
t 
) [inline]

The setData is intentionally seperate so we can avoid expanding constant data when we write the same value to it.

Definition at line 517 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelTile< T >::tryCompress ( const UT_VoxelCompressOptions options  )  [inline]

Attempts to compress this tile. Returns true if any compression performed.

Definition at line 979 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::uncompress (  )  [inline]

Turns a compressed tile into a raw tile.

Definition at line 542 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTile< T >::uncompressFull (  )  [inline]

Turns a tile into a raw full tile.

Definition at line 678 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::weightedSum ( int  pstart[3],
int  pend[3],
float *  weights[3],
int  start[3],
T &  result 
) [inline]

A routine used by filtered evaluation to accumulated a partial filtered sum in this tile. pstart, pend - voxel bounds (in UT_VoxelArray coordinates) weights - weight array start - UT_VoxelArray coordinates at [0] in the weight array

Definition at line 1151 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTile< T >::writeCacheLine ( T *  cacheline,
int  y,
int  z 
) [inline]

Fills a cache line from an external buffer into our own data.

Definition at line 464 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelTile< T >::writeThrough ( int  x,
int  y,
int  z,
t 
) [inline, protected]

Definition at line 167 of file UT_VoxelArray.C.

template<typename T>
int UT_VoxelTile< T >::xres (  )  const [inline]

Read the current resolution.

Definition at line 409 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTile< T >::yres (  )  const [inline]

Definition at line 410 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTile< T >::zres (  )  const [inline]

Definition at line 411 of file UT_VoxelArray.h.


Friends And Related Function Documentation

template<typename T>
friend class UT_VoxelProbe [friend]

Definition at line 497 of file UT_VoxelArray.h.

template<typename T>
friend class UT_VoxelTileCompress< T > [friend]

Definition at line 495 of file UT_VoxelArray.h.


Member Data Documentation

template<typename T>
void* UT_VoxelTile< T >::myData

Definition at line 481 of file UT_VoxelArray.h.


The documentation for this class was generated from the following files:

Generated on Mon Jan 28 00:30:23 2013 for HDK by  doxygen 1.5.9