Particle Universe  1.2
ParticleUniverse::SpatialHashTable< T > Class Template Reference

#include <ParticleUniverseSpatialHashTable.h>

Public Types

typedef std::vector< T > HashTableCell
 
typedef std::vector< HashTableCellHashTableContent
 

Public Member Functions

 SpatialHashTable (void)
 
 SpatialHashTable (unsigned int tableSize, unsigned short cellDimension, unsigned short cellOverlap=0.0f)
 
virtual ~SpatialHashTable (void)
 
void clear (void)
 
unsigned int size (void) const
 
unsigned int put (const Vector3 &position, T object)
 
unsigned int put (const unsigned int cellIndex, T object)
 
HashTableCellgetCell (const Vector3 &position)
 
unsigned int getCellIndex (const Vector3 &position)
 

Protected Member Functions

unsigned int _calculateIndex (const Vector3 &position)
 
void _initialise (void)
 

Protected Attributes

SpatialHashTable::HashTableContent mHashTable
 
unsigned short mCellDimension
 
unsigned short mCellOverlap
 
unsigned int mTableSize
 

Detailed Description

template<typename T>
class ParticleUniverse::SpatialHashTable< T >

The SpatialHashTable is used to determine particles that are 'near' each other and discard particles that are further away. This way only a few particles are taken into account for certain calculations.

Member Typedef Documentation

template<typename T>
typedef std::vector<T> ParticleUniverse::SpatialHashTable< T >::HashTableCell
template<typename T>
typedef std::vector<HashTableCell> ParticleUniverse::SpatialHashTable< T >::HashTableContent

Constructor & Destructor Documentation

template<typename T>
ParticleUniverse::SpatialHashTable< T >::SpatialHashTable ( void  )
inline

Todo.

template<typename T>
ParticleUniverse::SpatialHashTable< T >::SpatialHashTable ( unsigned int  tableSize,
unsigned short  cellDimension,
unsigned short  cellOverlap = 0.0f 
)
inline

Todo.

template<typename T>
virtual ParticleUniverse::SpatialHashTable< T >::~SpatialHashTable ( void  )
inlinevirtual

Destructor.

Member Function Documentation

template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::_calculateIndex ( const Vector3 position)
inlineprotected

Todo.

template<typename T>
void ParticleUniverse::SpatialHashTable< T >::_initialise ( void  )
inlineprotected

Todo.

template<typename T>
void ParticleUniverse::SpatialHashTable< T >::clear ( void  )
inline

Clearing the hashtable means that every cell must be cleared, but not mHashTable itself. It still needs mTableSize vectors. Clearing mHashTable would implicate that all cells are removed, so you have to initialise again.

template<typename T>
HashTableCell& ParticleUniverse::SpatialHashTable< T >::getCell ( const Vector3 position)
inline

Todo.

template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::getCellIndex ( const Vector3 position)
inline

Todo.

template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::put ( const Vector3 position,
object 
)
inline

Todo.

If cell overlap is defined, take that into account. This means that the same object can be put into multiple cells.

template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::put ( const unsigned int  cellIndex,
object 
)
inline

If you have multiple objects for which you already know the cellIndex, you can use this convenience function to save time.

template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::size ( void  ) const
inline

Todo.

Member Data Documentation

template<typename T>
unsigned short ParticleUniverse::SpatialHashTable< T >::mCellDimension
protected
template<typename T>
unsigned short ParticleUniverse::SpatialHashTable< T >::mCellOverlap
protected
template<typename T>
SpatialHashTable::HashTableContent ParticleUniverse::SpatialHashTable< T >::mHashTable
protected
template<typename T>
unsigned int ParticleUniverse::SpatialHashTable< T >::mTableSize
protected

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