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)
bool isMatching (const UT_VoxelArray< T > &src) const
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
bool hasNan () const
 Returns true if any element of the voxel array is NAN.
operator() (UT_Vector3D pos) const
operator() (UT_Vector3F 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, float filterwidthscale=1.0f)
 THREADED_METHOD3_CONST (UT_VoxelArray< T >, numTiles() > 16, flatten, T *, flatarray, int, ystride, int, zstride) void flattenPartial(T *flatarray
 THREADED_METHOD3 (UT_VoxelArray< T >, numTiles() > 16, extractFromFlattened, const T *, flatarray, int, ystride, int, zstride) void extractFromFlattenedPartial(const T *flatarray
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_Vector3F &pos) const
bool indexToPos (int x, int y, int z, UT_Vector3D &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)
void setBorderScale (T scalex, T scaley, T scalez)
UT_VoxelBorderType getBorder () const
getBorderValue () const
getBorderScale (int axis) const
void collapseAllTiles ()
void expandAllTiles ()
void expandAllNonConstTiles ()
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 indexToLinearTile (int x, int y, int z) const
int getTileRes (int dim) const
int numTiles () const
int64 numVoxels () const
void setCompressionOptions (const UT_VoxelCompressOptions &options)
const UT_VoxelCompressOptionsgetCompressionOptions () const
void setCompressionTolerance (fpreal tol)
fpreal getCompressionTolerance () const
void saveData (ostream &os)
void loadData (UT_IStream &is)
 Load an array, requires you have already size()d this array.

Public Attributes

int ystride
int int zstride
int int const UT_JobInfo &info const
int int const UT_JobInfoinfo


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 510 of file UT_VoxelArray.h.


Constructor & Destructor Documentation

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

Definition at line 1537 of file UT_VoxelArray.C.

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

Definition at line 1556 of file UT_VoxelArray.C.

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

Copy constructor:.

Definition at line 1562 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 621 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 2486 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 1724 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 2172 of file UT_VoxelArray.C.

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

Uncompresses all tiles, but leaves constant tiles alone. Useful for cleaning out any non-standard compression algorithm that some external program can't handle.

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

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

Definition at line 718 of file UT_VoxelArray.h.

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

Definition at line 720 of file UT_VoxelArray.h.

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

Definition at line 719 of file UT_VoxelArray.h.

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

Definition at line 772 of file UT_VoxelArray.h.

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

Definition at line 777 of file UT_VoxelArray.h.

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

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

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

Definition at line 541 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 742 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 764 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 657 of file UT_VoxelArray.h.

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

Definition at line 538 of file UT_VoxelArray.h.

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

Definition at line 539 of file UT_VoxelArray.h.

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

Definition at line 540 of file UT_VoxelArray.h.

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

Returns true if any element of the voxel array is NAN.

Definition at line 1776 of file UT_VoxelArray.C.

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

Definition at line 759 of file UT_VoxelArray.h.

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

Definition at line 2444 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::indexToPos ( int  x,
int  y,
int  z,
UT_Vector3F 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 2419 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 1737 of file UT_VoxelArray.C.

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

Definition at line 531 of file UT_VoxelArray.h.

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 629 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 746 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 2560 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 1687 of file UT_VoxelArray.C.

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

Examples:
SIM/SIM_GasAdd.h.

Definition at line 765 of file UT_VoxelArray.h.

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

Definition at line 767 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 638 of file UT_VoxelArray.h.

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

Definition at line 1794 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::operator() ( UT_Vector3D  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 1927 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 1578 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 2392 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 2371 of file UT_VoxelArray.C.

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

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

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

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

Definition at line 2469 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setBorderScale ( scalex,
scaley,
scalez 
) [inline]

Definition at line 2477 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setCompressionOptions ( const UT_VoxelCompressOptions options  )  [inline]

Definition at line 770 of file UT_VoxelArray.h.

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

Definition at line 775 of file UT_VoxelArray.h.

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

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

template<typename T>
UT_VoxelArray< T >::THREADED_METHOD3 ( UT_VoxelArray< T >  ,
numTiles()  ,
16  ,
extractFromFlattened  ,
const T *  ,
flatarray  ,
int  ,
ystride  ,
int  ,
zstride   
) const

Fills this from a flattened array. Z major, then Y, then X. setValue(x,y,z, flatarray[x + y * ystride + z * zstride];

template<typename T>
UT_VoxelArray< T >::THREADED_METHOD3_CONST ( UT_VoxelArray< T >  ,
numTiles()  ,
16  ,
flatten  ,
T *  ,
flatarray  ,
int  ,
ystride  ,
int  ,
zstride   
)

Flattens this into an array. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);

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

Definition at line 756 of file UT_VoxelArray.h.


Member Data Documentation

template<typename T>
int int const UT_JobInfo& info UT_VoxelArray< T >::const

Definition at line 591 of file UT_VoxelArray.h.

template<typename T>
int int const UT_JobInfo& UT_VoxelArray< T >::info

Definition at line 602 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelArray< T >::ystride

Definition at line 591 of file UT_VoxelArray.h.

template<typename T>
int int UT_VoxelArray< T >::zstride

Definition at line 591 of file UT_VoxelArray.h.


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

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