PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType > Class Template Reference

To collect results of nanoflann tree search. In this class, we check the tag of a potential point and add the point to search list if the tag matches the tag of a point for which neighbors are computed. This is useful when computing neighbor list for peridynamics. In this case, we want points from the same particle to be in the peridynamics neighbor lsit. Default result output of nanoflann search uses std::vector<std::pair<size_t, double>>. We prefer to get the index and distance in a separate list. More...

#include <nflannSetup.h>

Collaboration diagram for nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >:

Public Types

typedef _DistanceType DistanceType
 Distance type (double, float, etc)
 
typedef _IndexType IndexType
 Index type (int, size_t, etc)
 

Public Member Functions

 TreeSearchCheckIDIncludeResult (DistanceType radius_, std::vector< IndexType > &indices, std::vector< DistanceType > &dists, const IndexType &searchPointTag, const std::vector< IndexType > &dataTags)
 Constructor.
 
void init ()
 Initialize the data (clear)
 
void clear ()
 Clear the data.
 
size_t size () const
 Get the size of currently stored (found so far) indices.
 
bool full () const
 Check (not implemented)
 
bool addPoint (DistanceType dist, IndexType index)
 Called during search to add an element matching the criteria.
 
DistanceType worstDist () const
 Return maximum distance for search.
 
std::pair< IndexType, DistanceTypeworst_item () const
 Find the worst result (furtherest neighbor) without copying or sorting Pre-conditions: size() > 0.
 

Data Fields

const DistanceType d_r
 Define search radius. Note this should be square of radius, where radius is a distance within which we are searching for points.
 
const IndexTyped_tag
 Tag of the point we are searching for neighboring points.
 
std::vector< IndexType > & d_indices
 Indices within the search radius.
 
std::vector< DistanceType > & d_dists
 Distance of points found within the search radius.
 
const std::vector< IndexType > & d_dataTags
 Tag of point data that we want to check with given point to be added to the search result.
 

Detailed Description

template<typename _DistanceType, typename _IndexType = size_t>
class nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >

To collect results of nanoflann tree search. In this class, we check the tag of a potential point and add the point to search list if the tag matches the tag of a point for which neighbors are computed. This is useful when computing neighbor list for peridynamics. In this case, we want points from the same particle to be in the peridynamics neighbor lsit. Default result output of nanoflann search uses std::vector<std::pair<size_t, double>>. We prefer to get the index and distance in a separate list.

Definition at line 314 of file nflannSetup.h.

Member Typedef Documentation

◆ DistanceType

template<typename _DistanceType , typename _IndexType = size_t>
typedef _DistanceType nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::DistanceType

Distance type (double, float, etc)

Definition at line 317 of file nflannSetup.h.

◆ IndexType

template<typename _DistanceType , typename _IndexType = size_t>
typedef _IndexType nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::IndexType

Index type (int, size_t, etc)

Definition at line 320 of file nflannSetup.h.

Constructor & Destructor Documentation

◆ TreeSearchCheckIDIncludeResult()

template<typename _DistanceType , typename _IndexType = size_t>
nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::TreeSearchCheckIDIncludeResult ( DistanceType  radius_,
std::vector< IndexType > &  indices,
std::vector< DistanceType > &  dists,
const IndexType searchPointTag,
const std::vector< IndexType > &  dataTags 
)
inline

Constructor.

Parameters
radius_Search radius (square of radius)
indicesReference to index vector
distsReference to distance vector
searchPointTagTag of a search point
dataTagsVector of tags for each point in the pointcloud

Definition at line 348 of file nflannSetup.h.

353 : d_r(radius_),
354 d_tag(searchPointTag),
355 d_indices(indices),
356 d_dists(dists),
357 d_dataTags(dataTags) {
358 init();
359 }
const IndexType & d_tag
Tag of the point we are searching for neighboring points.
const DistanceType d_r
Define search radius. Note this should be square of radius, where radius is a distance within which w...
const std::vector< IndexType > & d_dataTags
Tag of point data that we want to check with given point to be added to the search result.
std::vector< IndexType > & d_indices
Indices within the search radius.
std::vector< DistanceType > & d_dists
Distance of points found within the search radius.
void init()
Initialize the data (clear)

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::init().

Here is the call graph for this function:

Member Function Documentation

◆ addPoint()

template<typename _DistanceType , typename _IndexType = size_t>
bool nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::addPoint ( DistanceType  dist,
IndexType  index 
)
inline

Called during search to add an element matching the criteria.

Parameters
distDistance of point from the search point
indexId of point
Returns
True True if continue the search further

Definition at line 394 of file nflannSetup.h.

394 {
395 if (dist < d_r) {
396 if (d_dataTags[index] == d_tag) {
397 d_indices.push_back(index);
398 d_dists.push_back(dist);
399 }
400 }
401 return true;
402 }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_dataTags, nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_dists, nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_indices, nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_r, and nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_tag.

◆ clear()

template<typename _DistanceType , typename _IndexType = size_t>
void nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::clear ( )
inline

Clear the data.

Definition at line 369 of file nflannSetup.h.

369 {
370 d_indices.clear();
371 d_dists.clear();
372 }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_dists, and nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_indices.

Referenced by nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::init().

Here is the caller graph for this function:

◆ full()

template<typename _DistanceType , typename _IndexType = size_t>
bool nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::full ( ) const
inline

Check (not implemented)

Returns
bool Status

Definition at line 385 of file nflannSetup.h.

385{ return true; }

◆ init()

template<typename _DistanceType , typename _IndexType = size_t>
void nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::init ( )
inline

Initialize the data (clear)

Definition at line 364 of file nflannSetup.h.

364{ clear(); }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::clear().

Referenced by nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::TreeSearchCheckIDIncludeResult().

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

◆ size()

template<typename _DistanceType , typename _IndexType = size_t>
size_t nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::size ( ) const
inline

Get the size of currently stored (found so far) indices.

Returns
size Size of indices data

Definition at line 379 of file nflannSetup.h.

379{ return d_indices.size(); }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_indices.

◆ worst_item()

template<typename _DistanceType , typename _IndexType = size_t>
std::pair< IndexType, DistanceType > nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::worst_item ( ) const
inline

Find the worst result (furtherest neighbor) without copying or sorting Pre-conditions: size() > 0.

Currently, we return pair(0, 0.)

Returns
Pair Pair of id and max distanced point

Definition at line 418 of file nflannSetup.h.

418 {
419 if (d_indices.empty())
420 throw std::runtime_error("Cannot invoke RadiusResultSet::worst_item() on "
421 "an empty list of results.");
422 return std::make_pair(0, 0.);
423 }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_indices.

◆ worstDist()

template<typename _DistanceType , typename _IndexType = size_t>
DistanceType nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::worstDist ( ) const
inline

Return maximum distance for search.

Returns
Radius Maximum distance for search

Definition at line 408 of file nflannSetup.h.

408{ return d_r; }

References nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_r.

Field Documentation

◆ d_dataTags

template<typename _DistanceType , typename _IndexType = size_t>
const std::vector<IndexType>& nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_dataTags

Tag of point data that we want to check with given point to be added to the search result.

Definition at line 337 of file nflannSetup.h.

Referenced by nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::addPoint().

◆ d_dists

template<typename _DistanceType , typename _IndexType = size_t>
std::vector<DistanceType>& nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_dists

◆ d_indices

◆ d_r

template<typename _DistanceType , typename _IndexType = size_t>
const DistanceType nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_r

Define search radius. Note this should be square of radius, where radius is a distance within which we are searching for points.

Definition at line 325 of file nflannSetup.h.

Referenced by nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::addPoint(), and nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::worstDist().

◆ d_tag

template<typename _DistanceType , typename _IndexType = size_t>
const IndexType& nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::d_tag

Tag of the point we are searching for neighboring points.

Definition at line 328 of file nflannSetup.h.

Referenced by nsearch::TreeSearchCheckIDIncludeResult< _DistanceType, _IndexType >::addPoint().


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