iMSTK
Interactive Medical Simulation Toolkit
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::SpatialHashTableSeparateChaining Class Reference

Implementation of SpatialHashTable using separate chaining. More...

#include <imstkSpatialHashTableSeparateChaining.h>

Inheritance diagram for imstk::SpatialHashTableSeparateChaining:
Inheritance graph
[legend]
Collaboration diagram for imstk::SpatialHashTableSeparateChaining:
Collaboration graph
[legend]

Public Member Functions

 SpatialHashTableSeparateChaining ()
 Default constructor.
 
void insertPoints (const VecDataArray< double, 3 > &points)
 Insert an array of points. More...
 
void insertPoint (const Vec3d &point)
 Insert an array of points. More...
 
void setLoadFactorMax (float loadFactorMax)
 Sets the max load factor. More...
 
std::vector< size_t > getPointsInAABB (const Vec3d &corner1, const Vec3d &corner2)
 Finds IDs of all points in an AABB. More...
 
void getPointsInAABB (std::vector< size_t > &result, const Vec3d &corner1, const Vec3d &corner2)
 Finds IDs of all points in an AABB. More...
 
std::vector< size_t > getPointsInSphere (const Vec3d &ppos, double radius)
 Find IDs of all points in a sphere centered at ppos and having given radius. More...
 
void getPointsInSphere (std::vector< size_t > &result, const Vec3d &ppos, const double radius)
 Find IDs of all points in a sphere centered at ppos and having given radius. More...
 
void clear ()
 Clears the table.
 
virtual void setCellSize (double x, double y, double z) override
 Protected constructor. More...
 
void recomputePointHash ()
 Update cell size for all points and rehash. This is called after changing the cell dimensions.
 

Protected Member Functions

virtual void rehash () override
 Rehash the hash table.
 
- Protected Member Functions inherited from imstk::SpatialHashTable
 SpatialHashTable ()
 Protected constructor.
 

Protected Attributes

float m_loadFactorMax = 10.0f
 
unsigned long m_currentID = 0
 
std::shared_ptr< std::unordered_set< PointEntry > > m_table
 
- Protected Attributes inherited from imstk::SpatialHashTable
double m_cellSize [3]
 

Detailed Description

Implementation of SpatialHashTable using separate chaining.

Definition at line 73 of file imstkSpatialHashTableSeparateChaining.h.

Member Function Documentation

◆ getPointsInAABB() [1/2]

std::vector< size_t > imstk::SpatialHashTableSeparateChaining::getPointsInAABB ( const Vec3d &  corner1,
const Vec3d &  corner2 
)

Finds IDs of all points in an AABB.

Parameters
corner1One corner to the box
corner2The other corner to the box

Definition at line 47 of file imstkSpatialHashTableSeparateChaining.cpp.

Here is the caller graph for this function:

◆ getPointsInAABB() [2/2]

void imstk::SpatialHashTableSeparateChaining::getPointsInAABB ( std::vector< size_t > &  result,
const Vec3d &  corner1,
const Vec3d &  corner2 
)

Finds IDs of all points in an AABB.

Parameters
resultThe list to contain search result
corner1One corner to the box
corner2The other corner to the box

Definition at line 55 of file imstkSpatialHashTableSeparateChaining.cpp.

◆ getPointsInSphere() [1/2]

std::vector< size_t > imstk::SpatialHashTableSeparateChaining::getPointsInSphere ( const Vec3d &  ppos,
double  radius 
)

Find IDs of all points in a sphere centered at ppos and having given radius.

Parameters
posPostision of the given point
radiusThe search radius

Definition at line 108 of file imstkSpatialHashTableSeparateChaining.cpp.

◆ getPointsInSphere() [2/2]

void imstk::SpatialHashTableSeparateChaining::getPointsInSphere ( std::vector< size_t > &  result,
const Vec3d &  ppos,
const double  radius 
)

Find IDs of all points in a sphere centered at ppos and having given radius.

Parameters
resultThe list to contain search result
posPostision of the given point
radiusThe search radius

Definition at line 116 of file imstkSpatialHashTableSeparateChaining.cpp.

◆ insertPoint()

void imstk::SpatialHashTableSeparateChaining::insertPoint ( const Vec3d &  point)

Insert an array of points.

Parameters
pointA point

Definition at line 28 of file imstkSpatialHashTableSeparateChaining.cpp.

Here is the caller graph for this function:

◆ insertPoints()

void imstk::SpatialHashTableSeparateChaining::insertPoints ( const VecDataArray< double, 3 > &  points)

Insert an array of points.

Parameters
pointsAn array of point

Definition at line 19 of file imstkSpatialHashTableSeparateChaining.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCellSize()

void imstk::SpatialHashTableSeparateChaining::setCellSize ( double  x,
double  y,
double  z 
)
overridevirtual

Protected constructor.

Parameters
x,y,zDimensions for each cell

Implements imstk::SpatialHashTable.

Definition at line 180 of file imstkSpatialHashTableSeparateChaining.cpp.

Here is the call graph for this function:

◆ setLoadFactorMax()

void imstk::SpatialHashTableSeparateChaining::setLoadFactorMax ( float  loadFactorMax)

Sets the max load factor.

Parameters
loadFactorMaxThe new capacity after a rehash

Definition at line 172 of file imstkSpatialHashTableSeparateChaining.cpp.


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