Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a02204.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a02204.php on line 2
The ARGoS Website

argos::CSpaceHashNative< Element, Updater > Class Template Reference

A space hash implementation that does not rely on std::map or std::tr1:unordered_map. More...

#include <space_hash_native.h>

Inheritance diagram for argos::CSpaceHashNative< Element, Updater >:
Collaboration diagram for argos::CSpaceHashNative< Element, Updater >:

Public Member Functions

 CSpaceHashNative ()
 Class constructor. More...
 
 ~CSpaceHashNative ()
 Class destructor. More...
 
void Clear ()
 Empties all the buckets in the space hash. More...
 
virtual void SetSize (size_t un_size)
 Sets the size of the space hash. More...
 
virtual void Update ()
 Updates the entire space hash. More...
 
virtual void UpdateCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, Element &c_element)
 Adds an element to a cell of the space hash. More...
 
virtual bool CheckCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, typename CSpaceHash< Element, Updater >::TElementList &t_elements)
 Looks for elements to process in a cell. More...
 
virtual void Dump (CARGoSLog &c_os)
 
- Public Member Functions inherited from argos::CAbstractSpaceHash< Element >
 CAbstractSpaceHash ()
 Class constructor. More...
 
virtual ~CAbstractSpaceHash ()
 Class destructor. More...
 
virtual void AddEntity (Element &c_entity)
 Adds an entity to the space hash. More...
 
TEntityListGetEntities ()
 Returns the list of entities held by this space hash. More...
 
virtual void RemoveEntity (Element &c_entity)
 Remove an entity from the space hash. More...
 
size_t GetSize ()
 Returns the size of the space hash. More...
 
CVector3GetCellSize ()
 Returns the size of the cells of the space hash. More...
 
CVector3GetInvCellSize ()
 Returns the inverse size of the cells of the space hash. More...
 
virtual void SetCellSize (const CVector3 &c_cell_size)
 Sets the size of the cells of the space hash. More...
 
virtual SInt32 SpaceToHashTable (Real f_coord, UInt32 un_axis)
 Converts a single space coordinate into a space hash cell coordinate. More...
 
virtual void SpaceToHashTable (SInt32 &n_i, SInt32 &n_j, SInt32 &n_k, const CVector3 &c_pos)
 Converts a space position into a space hash cell The values are written into n_i, n_j, and n_k. More...
 
virtual Real HashTableToSpace (SInt32 n_coord, UInt32 un_axis)
 Converts a single space hash cell coordinate into a space coordinate. More...
 
virtual bool CheckCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, TEntityList &t_entities)=0
 Looks for entities to process in a cell. More...
 
- Public Member Functions inherited from argos::CPositionalIndex< Element >
 CPositionalIndex ()
 
virtual ~CPositionalIndex ()
 
virtual void Init (TConfigurationNode &t_tree)=0
 Initializes the resource. More...
 
virtual void Reset ()=0
 Resets the resource. More...
 
virtual void Destroy ()=0
 Undoes whatever was done by Init(). More...
 
virtual void GetEntitiesAt (CSet< Element *, SEntityComparator > &c_entities, const CVector3 &c_position) const=0
 Puts the entities located at the given point in the passed buffer. More...
 
virtual void ForAllEntities (COperation &c_operation)=0
 Executes an operation on all the indexed entities. More...
 
virtual void ForEntitiesInSphereRange (const CVector3 &c_center, Real f_radius, COperation &c_operation)=0
 Executes an operation on all entities within the specified sphere range. More...
 
virtual void ForEntitiesInBoxRange (const CVector3 &c_center, const CVector3 &c_half_size, COperation &c_operation)=0
 Executes an operation on all entities within the specified box range. More...
 
virtual void ForEntitiesInCircleRange (const CVector3 &c_center, Real f_radius, COperation &c_operation)=0
 Executes an operation on all entities within the specified circle range. More...
 
virtual void ForEntitiesInRectangleRange (const CVector3 &c_center, const CVector2 &c_half_size, COperation &c_operation)=0
 Executes an operation on all entities within the specified rectangle range. More...
 
virtual void ForEntitiesAlongRay (const CRay3 &c_ray, COperation &c_operation, bool b_stop_at_closest_match=false)=0
 Executes an operation on all entities that intersect the given ray. More...
 

Additional Inherited Members

- Public Types inherited from argos::CAbstractSpaceHash< Element >
typedef CSet< Element * > TEntityList
 Type definition for the list of entities held by the space hash. More...
 
- Protected Member Functions inherited from argos::CAbstractSpaceHash< Element >
UInt32 CoordinateHash (SInt32 n_i, SInt32 n_j, SInt32 n_k)
 Calculates the hash of a space hash coordinate. More...
 

Detailed Description

template<class Element, class Updater>
class argos::CSpaceHashNative< Element, Updater >

A space hash implementation that does not rely on std::map or std::tr1:unordered_map.

It is much more performant than the standard hash table implementations.

Definition at line 19 of file space_hash_native.h.

Constructor & Destructor Documentation

◆ CSpaceHashNative()

template<class Element , class Updater >
argos::CSpaceHashNative< Element, Updater >::CSpaceHashNative ( )
inline

Class constructor.

The size of the space hash (the number of buckets) is set to zero. To be able to use the space hash, you first must set the size to an appropriate value.

See also
SetSize()

Definition at line 166 of file space_hash_native.h.

◆ ~CSpaceHashNative()

template<class Element , class Updater >
argos::CSpaceHashNative< Element, Updater >::~CSpaceHashNative ( )
inline

Class destructor.

Definition at line 173 of file space_hash_native.h.

Member Function Documentation

◆ CheckCell()

template<class Element , class Updater >
virtual bool argos::CSpaceHashNative< Element, Updater >::CheckCell ( SInt32  n_i,
SInt32  n_j,
SInt32  n_k,
typename CSpaceHash< Element, Updater >::TElementList &  t_elements 
)
inlinevirtual

Looks for elements to process in a cell.

Parameters
n_iThe X coordinate of the space hash cell.
n_jThe Y coordinate of the space hash cell.
n_kThe Z coordinate of the space hash cell.
Thelist of elements to process.

Definition at line 249 of file space_hash_native.h.

◆ Clear()

template<class Element , class Updater >
void argos::CSpaceHashNative< Element, Updater >::Clear ( )
inline

Empties all the buckets in the space hash.

Definition at line 181 of file space_hash_native.h.

◆ Dump()

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::Dump ( CARGoSLog c_os)
inlinevirtual

Implements argos::CAbstractSpaceHash< Element >.

Definition at line 282 of file space_hash_native.h.

◆ SetSize()

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::SetSize ( size_t  un_size)
inlinevirtual

Sets the size of the space hash.

The size corresponds to the number of buckets.

Parameters
un_sizeThe size of the space hash.

Reimplemented from argos::CAbstractSpaceHash< Element >.

Definition at line 192 of file space_hash_native.h.

◆ Update()

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::Update ( )
inlinevirtual

Updates the entire space hash.

It calls the updater for all the elements held by the space hash.

See also
CSpaceHashUpdater

Reimplemented from argos::CSpaceHash< Element, Updater >.

Definition at line 203 of file space_hash_native.h.

◆ UpdateCell()

template<class Element , class Updater >
virtual void argos::CSpaceHashNative< Element, Updater >::UpdateCell ( SInt32  n_i,
SInt32  n_j,
SInt32  n_k,
Element &  c_element 
)
inlinevirtual

Adds an element to a cell of the space hash.

Parameters
n_xThe x coordinate of the cell.
n_yThe y coordinate of the cell.
n_zThe z coordinate of the cell.
c_elementThe element to add.

Implements argos::CAbstractSpaceHash< Element >.

Definition at line 217 of file space_hash_native.h.