HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_VoxelTileIterator< T > Class Template Reference

#include <UT_VoxelArray.h>

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

Public Attributes

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

Protected Attributes

UT_VoxelTile< T > * myCurTile
 Current processing tile. More...
 
UT_VoxelArray< T > * myArray
 
int myPos [3]
 Absolute index into voxel array. More...
 
int myTileStart [3]
 Absolute index of start of tile. More...
 
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 1684 of file UT_VoxelArray.h.

Constructor & Destructor Documentation

template<typename T >
UT_VoxelTileIterator< T >::UT_VoxelTileIterator ( )

Definition at line 7027 of file UT_VoxelArray.C.

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

Definition at line 7036 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 
)

Definition at line 7047 of file UT_VoxelArray.C.

template<typename T >
UT_VoxelTileIterator< T >::~UT_VoxelTileIterator ( )
virtual

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

template<typename T >
void UT_VoxelTileIterator< T >::advanceTile ( )

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

Definition at line 7090 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 1727 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 1817 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 1806 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 1772 of file UT_VoxelArray.h.

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

Definition at line 1767 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 1800 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 1792 of file UT_VoxelArray.h.

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

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

template<typename T >
void UT_VoxelTileIterator< T >::rewind ( )

Resets the iterator to point to the first voxel.

Definition at line 7063 of file UT_VoxelArray.C.

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

Definition at line 1818 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelTileIterator< T >::setLinearTile ( exint  lineartilenum,
UT_VoxelArray< T > *  array 
)
inline

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

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

Definition at line 1706 of file UT_VoxelArray.h.

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

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

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

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

Definition at line 1765 of file UT_VoxelArray.h.

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

Definition at line 1766 of file UT_VoxelArray.h.

Member Data Documentation

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

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

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

Current processing tile.

Definition at line 1830 of file UT_VoxelArray.h.

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

Absolute index into voxel array.

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

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

Our position within the current tile.

Definition at line 1848 of file UT_VoxelArray.h.

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

The size of the current tile.

Definition at line 1851 of file UT_VoxelArray.h.

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

Absolute index of start of tile.

Definition at line 1836 of file UT_VoxelArray.h.


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