HDK
|
#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) | |
~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... | |
int | getLinearTileNum () const |
void | advanceTile () |
bool | getCompressOnExit () const |
void | setCompressOnExit (bool shouldcompress) |
template<typename OP > | |
void | applyOperation (const OP &op) |
template<typename OP , typename S > | |
void | applyOperation (const OP &op, const UT_VoxelArray< S > &a) |
template<typename OP > | |
void | applyOperation (const OP &op, T a) |
template<typename OP , typename S , typename R > | |
void | applyOperation (const OP &op, const UT_VoxelArray< S > &a, const UT_VoxelArray< R > &b) |
template<typename OP , typename S , typename R , typename Q > | |
void | applyOperation (const OP &op, const UT_VoxelArray< S > &a, const UT_VoxelArray< R > &b, const UT_VoxelArray< Q > &c) |
template<typename OP , typename S > | |
void | assignOperation (const OP &op, const UT_VoxelArray< S > &a) |
template<typename OP , typename S , typename R > | |
void | assignOperation (const OP &op, const UT_VoxelArray< S > &a, const UT_VoxelArray< R > &b) |
template<typename OP , typename S , typename R , typename Q > | |
void | assignOperation (const OP &op, const UT_VoxelArray< S > &a, const UT_VoxelArray< R > &b, const UT_VoxelArray< Q > &c) |
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 | myLinearTileNum |
Current's tile linear number. More... | |
int | myPos [3] |
Absolute index into voxel array. More... | |
int | myTileStart [3] |
Absolute index of start of tile. More... | |
bool | myShouldCompressOnExit |
bool | myAtEnd |
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 1983 of file UT_VoxelArray.h.
UT_VoxelTileIterator< T >::UT_VoxelTileIterator | ( | ) |
Definition at line 7785 of file UT_VoxelArray.C.
UT_VoxelTileIterator< T >::UT_VoxelTileIterator | ( | const UT_VoxelArrayIterator< T > & | vit | ) |
Definition at line 7795 of file UT_VoxelArray.C.
UT_VoxelTileIterator< T >::UT_VoxelTileIterator | ( | const UT_VoxelArrayIterator< S > & | vit, |
UT_VoxelArray< T > * | array | ||
) |
Definition at line 7807 of file UT_VoxelArray.C.
UT_VoxelTileIterator< T >::~UT_VoxelTileIterator | ( | ) |
Definition at line 7818 of file UT_VoxelArray.C.
|
inline |
Advances the iterator to point to the next voxel.
Definition at line 2032 of file UT_VoxelArray.h.
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 7851 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::applyOperation | ( | const OP & | op | ) |
These templated algorithms are designed to apply simple operations across all of the voxels with as little overhead as possible. The iterator should already point to a voxel array and if multithreaded had its partial range set. The source arrays must be matching size. The operator should support a () operator, and the result is vit.setValue( op(vit.getValue(), a->getValue(vit), ...); Passing T instead of UT_VoxelArray will treat it as a constant source Note if both source and destination tiles are constant, only a single operation is invoked.
Definition at line 7867 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::applyOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a | ||
) |
Definition at line 7876 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::applyOperation | ( | const OP & | op, |
T | a | ||
) |
void UT_VoxelTileIterator< T >::applyOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a, | ||
const UT_VoxelArray< R > & | b | ||
) |
Definition at line 7888 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::applyOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a, | ||
const UT_VoxelArray< R > & | b, | ||
const UT_VoxelArray< Q > & | c | ||
) |
Definition at line 7902 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::assignOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a | ||
) |
Assign operation works like apply operation, but *this is written to without reading, so there is one less parameter to the () callback. This can optimize constant tile writes as the constant() status of the destination doesn't matter.
Definition at line 7918 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::assignOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a, | ||
const UT_VoxelArray< R > & | b | ||
) |
Definition at line 7930 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::assignOperation | ( | const OP & | op, |
const UT_VoxelArray< S > & | a, | ||
const UT_VoxelArray< R > & | b, | ||
const UT_VoxelArray< Q > & | c | ||
) |
Definition at line 7944 of file UT_VoxelArray.C.
|
inline |
Returns true if we have iterated over all of the voxels.
Definition at line 2028 of file UT_VoxelArray.h.
|
inline |
Sets a flag which causes the iterator to tryCompress() tiles when it is done with them.
Definition at line 2123 of file UT_VoxelArray.h.
|
inline |
Definition at line 2111 of file UT_VoxelArray.h.
|
inline |
Returns the VoxelTile we are currently processing.
Definition at line 2107 of file UT_VoxelArray.h.
|
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 2073 of file UT_VoxelArray.h.
|
inline |
Definition at line 2068 of file UT_VoxelArray.h.
|
inline |
Returns true if we are at the start of a new tile.
Definition at line 2101 of file UT_VoxelArray.h.
|
inline |
Returns true if the tile we are currently in is a constant tile.
Definition at line 2093 of file UT_VoxelArray.h.
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 7960 of file UT_VoxelArray.C.
void UT_VoxelTileIterator< T >::rewind | ( | ) |
Resets the iterator to point to the first voxel.
Definition at line 7824 of file UT_VoxelArray.C.
|
inline |
Definition at line 2124 of file UT_VoxelArray.h.
|
inline |
Definition at line 2011 of file UT_VoxelArray.h.
|
inline |
Definition at line 1994 of file UT_VoxelArray.h.
|
inline |
Definition at line 2006 of file UT_VoxelArray.h.
|
inline |
Sets the voxel we are currently pointing to the given value.
Definition at line 2083 of file UT_VoxelArray.h.
|
inline |
Retrieve the current location of the iterator, in the containing voxel array, not in the tile.
Definition at line 2065 of file UT_VoxelArray.h.
|
inline |
Definition at line 2066 of file UT_VoxelArray.h.
|
inline |
Definition at line 2067 of file UT_VoxelArray.h.
|
protected |
Definition at line 2175 of file UT_VoxelArray.h.
|
protected |
Since we want to allow multiple passes, we can't clear out myCurTile when we hit the end.
Definition at line 2191 of file UT_VoxelArray.h.
|
protected |
Current processing tile.
Definition at line 2174 of file UT_VoxelArray.h.
|
protected |
Current's tile linear number.
Definition at line 2178 of file UT_VoxelArray.h.
|
protected |
Absolute index into voxel array.
Definition at line 2181 of file UT_VoxelArray.h.
|
protected |
Flag determining if we should compress tiles whenever we advance out of them.
Definition at line 2187 of file UT_VoxelArray.h.
int UT_VoxelTileIterator< T >::myTileLocalPos[3] |
Our position within the current tile.
Definition at line 2195 of file UT_VoxelArray.h.
int UT_VoxelTileIterator< T >::myTileSize[3] |
The size of the current tile.
Definition at line 2198 of file UT_VoxelArray.h.
|
protected |
Absolute index of start of tile.
Definition at line 2183 of file UT_VoxelArray.h.