UT_VoxelArray< T > Class Template Reference

#include <UT_VoxelArray.h>

List of all members.

Public Member Functions

 UT_VoxelArray ()
virtual ~UT_VoxelArray ()
 UT_VoxelArray (const UT_VoxelArray< T > &src)
 Copy constructor:.
const UT_VoxelArray< T > & operator= (const UT_VoxelArray< T > &src)
 Assignment operator:.
void size (int xres, int yres, int zres)
void match (const UT_VoxelArray< T > &src)
int getXRes () const
int getYRes () const
int getZRes () const
int getRes (int axis) const
int64 getMemoryUsage () const
 Return the amount of memory used by this array.
void constant (T t)
bool isConstant (T *cval=0) const
operator() (UT_Vector3 pos) const
evaluate (const UT_Vector3 &pos, const UT_Filter &filter, fpreal radius) const
void resample (const UT_VoxelArray< T > &src, UT_FilterType filtertype=UT_FILTER_POINT)
bool posToIndex (UT_Vector3 pos, int &x, int &y, int &z) const
bool posToIndex (UT_Vector3 pos, UT_Vector3 &ipos) const
bool indexToPos (int x, int y, int z, UT_Vector3 &pos) const
void clampIndex (int &x, int &y, int &z) const
bool isValidIndex (int x, int y, int z) const
 Returns true if the given x, y, z values lie inside the valid index.
operator() (int x, int y, int z) const
void setValue (int x, int y, int z, T t)
getValue (int x, int y, int z) const
void setBorder (UT_VoxelBorderType type, T t)
UT_VoxelBorderType getBorder () const
getBorderValue () const
void collapseAllTiles ()
void expandAllTiles ()
UT_VoxelTile< T > * getTile (int tx, int ty, int tz) const
UT_VoxelTile< T > * getLinearTile (int idx) const
void linearTileToXYZ (int idx, int &x, int &y, int &z) const
int xyzTileToLinear (int x, int y, int z) const
int getTileRes (int dim) const
int numTiles () const
int numVoxels () const
fpreal getCompressionTolerance () const
void setCompressionTolerance (fpreal tol)
void saveData (ostream &os)
void loadData (UT_IStream &is)
 Load an array, requires you have already size()d this array.


Detailed Description

template<typename T>
class UT_VoxelArray< T >

UT_VoxelArray

This provides data structure to hold a three dimmensional array of data. The data should be some simple arithmatic type, such as uint8, fpreal16, or UT_Vector3.

Some operations, such as gradiants, may make less sense with uint8.

Definition at line 436 of file UT_VoxelArray.h.


Constructor & Destructor Documentation

template<typename T >
UT_VoxelArray< T >::UT_VoxelArray (  )  [inline]

Definition at line 1102 of file UT_VoxelArray.C.

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

Definition at line 1120 of file UT_VoxelArray.C.

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

Copy constructor:.

Definition at line 1126 of file UT_VoxelArray.C.


Member Function Documentation

template<typename T>
void UT_VoxelArray< T >::clampIndex ( int &  x,
int &  y,
int &  z 
) const [inline]

Clamps the given x, y, and z values to lie inside the valid index range.

Definition at line 513 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelArray< T >::collapseAllTiles (  )  [inline]

This tries to compress or collapse each tile. This can be expensive (ie, converting a tile to constant), so should be saved until modifications are complete.

Definition at line 1813 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::constant ( t  )  [inline]

Sets this voxel array to the given constant value. All tiles are turned into constant tiles.

Definition at line 1279 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::evaluate ( const UT_Vector3 pos,
const UT_Filter filter,
fpreal  radius 
) const [inline]

Filtered evaluation of the voxel array. This operation should exhibit the same behavior as IMG3D_Channel::evaluate. Borders evaluate to 0 and the border type is ignored. radius is measured in voxels.

Definition at line 1583 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelArray< T >::expandAllTiles (  )  [inline]

Uncompresses all tiles into non-constant tiles. Useful if you have a multithreaded algorithm that may need to both read and write, if you write to a collapsed tile while someone else reads from it, bad stuff happens. Instead, you can expandAllTiles. This may have serious consequences in memory use, however.

Definition at line 1826 of file UT_VoxelArray.C.

template<typename T>
UT_VoxelBorderType UT_VoxelArray< T >::getBorder (  )  const [inline]

Definition at line 598 of file UT_VoxelArray.h.

template<typename T>
T UT_VoxelArray< T >::getBorderValue (  )  const [inline]

Definition at line 599 of file UT_VoxelArray.h.

template<typename T>
fpreal UT_VoxelArray< T >::getCompressionTolerance (  )  const [inline]

Definition at line 641 of file UT_VoxelArray.h.

template<typename T>
UT_VoxelTile<T>* UT_VoxelArray< T >::getLinearTile ( int  idx  )  const [inline]

Definition at line 618 of file UT_VoxelArray.h.

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

Return the amount of memory used by this array.

Definition at line 1265 of file UT_VoxelArray.C.

template<typename T>
int UT_VoxelArray< T >::getRes ( int  axis  )  const [inline]

Definition at line 460 of file UT_VoxelArray.h.

template<typename T>
UT_VoxelTile<T>* UT_VoxelArray< T >::getTile ( int  tx,
int  ty,
int  tz 
) const [inline]

The direct tile access methods are to make TBF writing a bit more efficient.

Definition at line 616 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelArray< T >::getTileRes ( int  dim  )  const [inline]

Number of tiles along that axis. Not to be confused with the resolution of the individual tiles.

Definition at line 635 of file UT_VoxelArray.h.

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

This will clamp the bounds to fit within the voxel array, using the border type to resolve out of range values.

Definition at line 549 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelArray< T >::getXRes (  )  const [inline]

Definition at line 457 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelArray< T >::getYRes (  )  const [inline]

Definition at line 458 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelArray< T >::getZRes (  )  const [inline]

Definition at line 459 of file UT_VoxelArray.h.

template<typename T >
bool UT_VoxelArray< T >::indexToPos ( int  x,
int  y,
int  z,
UT_Vector3 pos 
) const [inline]

Converts an index into a position. Returns false if the source index was out of range, in which case pos will be outside [0..1]^3

Definition at line 1780 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelArray< T >::isConstant ( T *  cval = 0  )  const [inline]

If this voxel array is all constant tiles, returns true. The optional pointer is initialized to the constant value iff the array is constant. (Note by constant we mean made of constant tiles of the same value - if some tiles are uncompressed but constant, it will still return false)

Definition at line 1292 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelArray< T >::isValidIndex ( int  x,
int  y,
int  z 
) const [inline]

Returns true if the given x, y, z values lie inside the valid index.

Definition at line 521 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelArray< T >::linearTileToXYZ ( int  idx,
int &  x,
int &  y,
int &  z 
) const [inline]

Definition at line 620 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelArray< T >::loadData ( UT_IStream is  )  [inline]

Load an array, requires you have already size()d this array.

Definition at line 1873 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::match ( const UT_VoxelArray< T > &  src  )  [inline]

This will ensure this voxel array matches the given voxel array in terms of dimensions & border conditions. It may invoke a size() and hence reset the field to 0.

Definition at line 1248 of file UT_VoxelArray.C.

template<typename T>
int UT_VoxelArray< T >::numTiles (  )  const [inline]

Examples:
SIM/SIM_GasAdd.h.

Definition at line 636 of file UT_VoxelArray.h.

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

Definition at line 638 of file UT_VoxelArray.h.

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

This allows you to read & write the raw data. Out of bound reads are illegal.

Definition at line 530 of file UT_VoxelArray.h.

template<typename T >
T UT_VoxelArray< T >::operator() ( UT_Vector3  pos  )  const [inline]

This convience function lets you sample the voxel array. pos is in the range [0..1]^3. T value trilinearly interpolated. Edges are determined by the border mode. The cells are sampled at the center of the voxels.

Definition at line 1331 of file UT_VoxelArray.C.

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

Assignment operator:.

Definition at line 1142 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3  pos,
UT_Vector3 ipos 
) const [inline]

Convertes a 3d position in [0..1]^3 into the equivalent in the integer cell space. Does not clamp to the closest value.

Definition at line 1753 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3  pos,
int &  x,
int &  y,
int &  z 
) const [inline]

Converts a 3d position in range [0..1]^3 into the closest index value. Returns false if the resulting index was out of range. The index will still be set.

Definition at line 1732 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::resample ( const UT_VoxelArray< T > &  src,
UT_FilterType  filtertype = UT_FILTER_POINT 
) [inline]

Fills this by resampling the given voxel array. Uses evaluate internally, so the same caveats apply regarding border behaviour.

Definition at line 1681 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelArray< T >::saveData ( ostream &  os  )  [inline]

Saves only the data of this array to the given stream. To reload it you will have to have a matching array in tiles dimensions and size. Not consta as unsupported compression engines will be uncompressed.

Definition at line 1839 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setBorder ( UT_VoxelBorderType  type,
t 
) [inline]

Definition at line 1805 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setCompressionTolerance ( fpreal  tol  )  [inline]

Definition at line 643 of file UT_VoxelArray.h.

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

Definition at line 538 of file UT_VoxelArray.h.

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

This sets the voxelarray to have the given resolution, resetting all elements to 0.

Definition at line 1190 of file UT_VoxelArray.C.

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

Definition at line 630 of file UT_VoxelArray.h.


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

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