UT_VoxelTileIterator< T > Class Template Reference

#include <UT_VoxelArray.h>

List of all members.

Public Member Functions

 UT_VoxelTileIterator ()
 UT_VoxelTileIterator (const UT_VoxelArrayIterator< T > &vit)
template<typename S >
 UT_VoxelTileIterator (const UT_VoxelArrayIterator< S > &vit, UT_VoxelArray< T > *array)
virtual ~UT_VoxelTileIterator ()
template<typename S >
void setTile (const UT_VoxelArrayIterator< S > &vit, UT_VoxelArray< T > *array)
void setTile (const UT_VoxelArrayIterator< T > &vit)
void rewind ()
 Resets the iterator to point to the first voxel.
bool atEnd () const
 Returns true if we have iterated over all of the voxels.
void advance ()
 Advances the iterator to point to the next voxel.
int x () const
int y () const
int z () const
int idx (int idx) const
getValue () const
void setValue (T t) const
 Sets the voxel we are currently pointing to the given value.
bool isTileConstant () const
 Returns true if the tile we are currently in is a constant tile.
bool isStartOfTile () const
 Returns true if we are at the start of a new tile.
UT_VoxelTile< T > * getTile () const
 Returns the VoxelTile we are currently processing.
void advanceTile ()
bool getCompressOnExit () const
void setCompressOnExit (bool shouldcompress)
template<typename OP >
bool reduceOperation (OP &op)
UT_VoxelArray< T > * getArray () const

Public Attributes

int myTileLocalPos [3]
 Our position within the current tile.
int myTileSize [3]
 The size of the current tile.

Protected Attributes

UT_VoxelTile< T > * myCurTile
 Current processing tile.
UT_VoxelArray< T > * myArray
int myPos [3]
 Absolute index into voxel array.
int myTileStart [3]
 Absolute index of start of tile.
bool myShouldCompressOnExit
bool myAtEnd


Detailed Description

template<typename T>
class UT_VoxelTileIterator< T >

Iterator for tiles inside Voxel Arrays

This class eliminates the need for having for (z = 0; z < zres; z++) ... for (x = 0; x < xres; x++) loops everywhere.

The iterator is similar in principal to an STL iterator, but somewhat simpler. The classic STL loop for ( it = begin(); it != end(); ++it ) is done using for ( it.rewind(); !it.atEnd(); it.advance() )

Definition at line 1197 of file UT_VoxelArray.h.


Constructor & Destructor Documentation

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

UT_VoxelTileIterator implementation

Definition at line 3564 of file UT_VoxelArray.C.

template<typename T >
UT_VoxelTileIterator< T >::UT_VoxelTileIterator ( const UT_VoxelArrayIterator< T > &  vit  )  [inline]

Definition at line 3573 of file UT_VoxelArray.C.

template<typename T >
template<typename S >
UT_VoxelTileIterator< T >::UT_VoxelTileIterator ( const UT_VoxelArrayIterator< S > &  vit,
UT_VoxelArray< T > *  array 
) [inline]

Definition at line 3584 of file UT_VoxelArray.C.

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

Definition at line 3594 of file UT_VoxelArray.C.


Member Function Documentation

template<typename T>
void UT_VoxelTileIterator< T >::advance (  )  [inline]

Advances the iterator to point to the next voxel.

Definition at line 1232 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelTileIterator< T >::advanceTile (  )  [inline]

Advances the iterator to point to the next tile. Since we are restricted to one tile, effectively just ends the iterator.

Definition at line 3627 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelTileIterator< T >::atEnd (  )  const [inline]

Returns true if we have iterated over all of the voxels.

Definition at line 1228 of file UT_VoxelArray.h.

template<typename T>
UT_VoxelArray<T>* UT_VoxelTileIterator< T >::getArray (  )  const [inline]

Definition at line 1329 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTileIterator< T >::getCompressOnExit (  )  const [inline]

Sets a flag which causes the iterator to tryCompress() tiles when it is done with them.

Definition at line 1318 of file UT_VoxelArray.h.

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

Returns the VoxelTile we are currently processing.

Definition at line 1307 of file UT_VoxelArray.h.

template<typename T>
T UT_VoxelTileIterator< T >::getValue (  )  const [inline]

Retrieves the value that we are currently pointing at. This is faster than an operator(x,y,z) as we already know our current tile and that bounds checking isn't needed.

Definition at line 1273 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::idx ( int  idx  )  const [inline]

Definition at line 1268 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTileIterator< T >::isStartOfTile (  )  const [inline]

Returns true if we are at the start of a new tile.

Definition at line 1301 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTileIterator< T >::isTileConstant (  )  const [inline]

Returns true if the tile we are currently in is a constant tile.

Definition at line 1293 of file UT_VoxelArray.h.

template<typename T >
template<typename OP >
bool UT_VoxelTileIterator< T >::reduceOperation ( OP &  op  )  [inline]

Reduction operators. op.reduce(T a) called for each voxel, *but*, op.reduceMany(T a, int n) called to reduce constant blocks. Early exits if op.reduce() returns false.

Definition at line 3643 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelTileIterator< T >::rewind (  )  [inline]

Resets the iterator to point to the first voxel.

Definition at line 3600 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelTileIterator< T >::setCompressOnExit ( bool  shouldcompress  )  [inline]

Definition at line 1319 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelTileIterator< T >::setTile ( const UT_VoxelArrayIterator< T > &  vit  )  [inline]

Definition at line 1219 of file UT_VoxelArray.h.

template<typename T>
template<typename S >
void UT_VoxelTileIterator< T >::setTile ( const UT_VoxelArrayIterator< S > &  vit,
UT_VoxelArray< T > *  array 
) [inline]

Definition at line 1208 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelTileIterator< T >::setValue ( t  )  const [inline]

Sets the voxel we are currently pointing to the given value.

Definition at line 1283 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::x ( void   )  const [inline]

Retrieve the current location of the iterator, in the containing voxel array, not in the tile.

Definition at line 1265 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::y ( void   )  const [inline]

Definition at line 1266 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::z ( void   )  const [inline]

Definition at line 1267 of file UT_VoxelArray.h.


Member Data Documentation

template<typename T>
UT_VoxelArray<T>* UT_VoxelTileIterator< T >::myArray [protected]

Definition at line 1334 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTileIterator< T >::myAtEnd [protected]

Since we want to allow multiple passes, we can't clear out myCurTile when we hit the end.

Definition at line 1347 of file UT_VoxelArray.h.

template<typename T>
UT_VoxelTile<T>* UT_VoxelTileIterator< T >::myCurTile [protected]

Current processing tile.

Definition at line 1333 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::myPos[3] [protected]

Absolute index into voxel array.

Definition at line 1337 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelTileIterator< T >::myShouldCompressOnExit [protected]

Flag determining if we should compress tiles whenever we advance out of them.

Definition at line 1343 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::myTileLocalPos[3]

Our position within the current tile.

Definition at line 1351 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::myTileSize[3]

The size of the current tile.

Definition at line 1354 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelTileIterator< T >::myTileStart[3] [protected]

Absolute index of start of tile.

Definition at line 1339 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