CubbyFlow::PointHashGridSearcher< N > Class Template Referencefinal

Hash grid-based N-D point searcher. More...

#include <Core/Searcher/PointHashGridSearcher.hpp>

Inheritance diagram for CubbyFlow::PointHashGridSearcher< N >:
CubbyFlow::PointNeighborSearcher< N > CubbyFlow::Serializable

Classes

class  Builder
 Front-end to create PointHashGridSearcher objects step by step. More...
 

Public Member Functions

 PointHashGridSearcher (const Vector< size_t, N > &resolution, double gridSpacing)
 Constructs hash grid with given resolution and grid spacing. More...
 
 ~PointHashGridSearcher () override=default
 Default virtual destructor. More...
 
 PointHashGridSearcher (const PointHashGridSearcher &other)
 Copy constructor. More...
 
 PointHashGridSearcher (PointHashGridSearcher &&other) noexcept
 Move constructor. More...
 
PointHashGridSearcheroperator= (const PointHashGridSearcher &other)
 Copy assignment operator. More...
 
PointHashGridSearcheroperator= (PointHashGridSearcher &&other) noexcept
 Move assignment operator. More...
 
void Build (const ConstArrayView1< Vector< double, N >> &points, double maxSearchRadius) override
 
void ForEachNearbyPoint (const Vector< double, N > &origin, double radius, const ForEachNearbyPointFunc &callback) const override
 
bool HasNearbyPoint (const Vector< double, N > &origin, double radius) const override
 
void Add (const Vector< double, N > &point)
 Adds a single point to the hash grid. More...
 
const Array1< Array1< size_t > > & Buckets () const
 Returns the internal bucket. More...
 
std::shared_ptr< PointNeighborSearcher< N > > Clone () const override
 Creates a new instance of the object with same properties than original. More...
 
void Set (const PointHashGridSearcher &other)
 Copy from the other instance. More...
 
void Serialize (std::vector< uint8_t > *buffer) const override
 Serializes the neighbor searcher into the buffer. More...
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes the neighbor searcher from the buffer. More...
 
- Public Member Functions inherited from CubbyFlow::PointNeighborSearcher< N >
 PointNeighborSearcher ()=default
 Default constructor. More...
 
 ~PointNeighborSearcher () override=default
 Default virtual destructor. More...
 
 PointNeighborSearcher (const PointNeighborSearcher &other)=default
 Default copy constructor. More...
 
 PointNeighborSearcher (PointNeighborSearcher &&other) noexcept=default
 Default move constructor. More...
 
PointNeighborSearcheroperator= (const PointNeighborSearcher &other)=default
 Default copy assignment operator. More...
 
PointNeighborSearcheroperator= (PointNeighborSearcher &&other) noexcept=default
 Default move assignment operator. More...
 
virtual std::string TypeName () const =0
 Returns the type name of the derived class. More...
 
virtual void Build (const ConstArrayView1< Vector< double, N >> &points)
 Builds internal acceleration structure for given points list. More...
 
- Public Member Functions inherited from CubbyFlow::Serializable
 Serializable ()=default
 Default constructor. More...
 
 Serializable (const Serializable &)=default
 Default copy constructor. More...
 
 Serializable (Serializable &&) noexcept=default
 Default move constructor. More...
 
virtual ~Serializable ()=default
 Default virtual destructor. More...
 
Serializableoperator= (const Serializable &)=default
 Default copy assignment operator. More...
 
Serializableoperator= (Serializable &&) noexcept=default
 Default move assignment operator. More...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder fox PointHashGridSearcher. More...
 

Additional Inherited Members

- Public Types inherited from CubbyFlow::PointNeighborSearcher< N >
using ForEachNearbyPointFunc = std::function< void(size_t, const Vector< double, N > &)>
 

Detailed Description

template<size_t N>
class CubbyFlow::PointHashGridSearcher< N >

Hash grid-based N-D point searcher.

This class implements N-D point searcher by using hash grid for its internal acceleration data structure. Each point is recorded to its corresponding bucket where the hashing function is N-D grid mapping.

Constructor & Destructor Documentation

◆ PointHashGridSearcher() [1/3]

template<size_t N>
CubbyFlow::PointHashGridSearcher< N >::PointHashGridSearcher ( const Vector< size_t, N > &  resolution,
double  gridSpacing 
)

Constructs hash grid with given resolution and grid spacing.

This constructor takes hash grid resolution and its grid spacing as its input parameters. The grid spacing must be 2x or greater than search radius.

Parameters
[in]resolutionThe resolution.
[in]gridSpacingThe grid spacing.

◆ ~PointHashGridSearcher()

template<size_t N>
CubbyFlow::PointHashGridSearcher< N >::~PointHashGridSearcher ( )
overridedefault

Default virtual destructor.

◆ PointHashGridSearcher() [2/3]

template<size_t N>
CubbyFlow::PointHashGridSearcher< N >::PointHashGridSearcher ( const PointHashGridSearcher< N > &  other)

Copy constructor.

◆ PointHashGridSearcher() [3/3]

template<size_t N>
CubbyFlow::PointHashGridSearcher< N >::PointHashGridSearcher ( PointHashGridSearcher< N > &&  other)
noexcept

Move constructor.

Member Function Documentation

◆ Add()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::Add ( const Vector< double, N > &  point)

Adds a single point to the hash grid.

This function adds a single point to the hash grid for future queries. It can be used for a hash grid that is already built by calling function PointHashGridSearcher::build.

Parameters
[in]pointThe point to be added.

◆ Buckets()

template<size_t N>
const Array1<Array1<size_t> >& CubbyFlow::PointHashGridSearcher< N >::Buckets ( ) const

Returns the internal bucket.

A bucket is a list of point indices that has same hash value. This function returns the (immutable) internal bucket structure.

Returns
List of buckets.

◆ Build()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::Build ( const ConstArrayView1< Vector< double, N >> &  points,
double  maxSearchRadius 
)
overridevirtual

Builds internal acceleration structure for given points list and max search radius.

Implements CubbyFlow::PointNeighborSearcher< N >.

◆ Clone()

template<size_t N>
std::shared_ptr<PointNeighborSearcher<N> > CubbyFlow::PointHashGridSearcher< N >::Clone ( ) const
overridevirtual

Creates a new instance of the object with same properties than original.

Returns
Copy of this object.

Implements CubbyFlow::PointNeighborSearcher< N >.

◆ Deserialize()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::Deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Deserializes the neighbor searcher from the buffer.

Implements CubbyFlow::Serializable.

◆ ForEachNearbyPoint()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::ForEachNearbyPoint ( const Vector< double, N > &  origin,
double  radius,
const ForEachNearbyPointFunc callback 
) const
overridevirtual

Invokes the callback function for each nearby point around the origin within given radius.

Parameters
[in]originThe origin position.
[in]radiusThe search radius.
[in]callbackThe callback function.

Implements CubbyFlow::PointNeighborSearcher< N >.

◆ GetBuilder()

template<size_t N>
static Builder CubbyFlow::PointHashGridSearcher< N >::GetBuilder ( )
static

Returns builder fox PointHashGridSearcher.

◆ HasNearbyPoint()

template<size_t N>
bool CubbyFlow::PointHashGridSearcher< N >::HasNearbyPoint ( const Vector< double, N > &  origin,
double  radius 
) const
overridevirtual

Returns true if there are any nearby points for given origin within radius.

Parameters
[in]originThe origin.
[in]radiusThe radius.
Returns
True if has nearby point, false otherwise.

Implements CubbyFlow::PointNeighborSearcher< N >.

◆ operator=() [1/2]

template<size_t N>
PointHashGridSearcher& CubbyFlow::PointHashGridSearcher< N >::operator= ( const PointHashGridSearcher< N > &  other)

Copy assignment operator.

◆ operator=() [2/2]

template<size_t N>
PointHashGridSearcher& CubbyFlow::PointHashGridSearcher< N >::operator= ( PointHashGridSearcher< N > &&  other)
noexcept

Move assignment operator.

◆ Serialize()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::Serialize ( std::vector< uint8_t > *  buffer) const
overridevirtual

Serializes the neighbor searcher into the buffer.

Implements CubbyFlow::Serializable.

◆ Set()

template<size_t N>
void CubbyFlow::PointHashGridSearcher< N >::Set ( const PointHashGridSearcher< N > &  other)

Copy from the other instance.


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