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_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.
bool isConstant () const
 Returns if this tile is constant.
bool isRaw () const
 Returns if this tile is in raw format.
bool isRawFull () const
 Returns if this tile is in raw full format.
bool tryCompress (fpreal tolerance)
void makeConstant (T t)
 Turns this tile into a constant tile of the given value.
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.
int xres () const
 Read the current resolution.
int yres () const
int zres () const
int getRes (int dim) 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 223 of file UT_VoxelArray.h.


Member Enumeration Documentation

template<typename T>
enum UT_VoxelTile::CompressionType

Enumerator:
COMPRESS_RAW 
COMPRESS_RAWFULL 
COMPRESS_CONSTANT 
COMPRESS_ENGINE 

Definition at line 235 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 57 of file UT_VoxelArray.C.

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

Definition at line 74 of file UT_VoxelArray.C.

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

Definition at line 80 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 369 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 362 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 323 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 614 of file UT_VoxelArray.C.

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

Definition at line 921 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 734 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 723 of file UT_VoxelArray.C.

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

Definition at line 342 of file UT_VoxelArray.h.

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

Returns if this tile is constant.

Definition at line 306 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 310 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 314 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 168 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 272 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 977 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 1063 of file UT_VoxelArray.C.

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

Definition at line 901 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 709 of file UT_VoxelArray.C.

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 245 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 90 of file UT_VoxelArray.C.

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

Returns the raw full data of the tile.

Definition at line 331 of file UT_VoxelArray.h.

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

Definition at line 882 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 930 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 1040 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 442 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelTile< T >::tryCompress ( fpreal  tolerance  )  [inline]

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

Definition at line 672 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 467 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 576 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 763 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 389 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 137 of file UT_VoxelArray.C.

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

Read the current resolution.

Definition at line 338 of file UT_VoxelArray.h.

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

Definition at line 339 of file UT_VoxelArray.h.

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

Definition at line 340 of file UT_VoxelArray.h.


Friends And Related Function Documentation

template<typename T>
friend class UT_VoxelProbe [friend]

Definition at line 423 of file UT_VoxelArray.h.

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

Definition at line 421 of file UT_VoxelArray.h.


Member Data Documentation

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

Definition at line 407 of file UT_VoxelArray.h.


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

Generated on Fri May 25 00:10:56 2012 for HDK by  doxygen 1.5.9