PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
nsearch::TreeSearchCheckIDExcludeResult< _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 does not match the tag of a point for which neighbors are computed. This is useful when computing neighbor list for contact. In this case, we do not want points from the same particle to be in the contact 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::TreeSearchCheckIDExcludeResult< _DistanceType, _IndexType >:

Public Types

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

Public Member Functions

 TreeSearchCheckIDExcludeResult (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::TreeSearchCheckIDExcludeResult< _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 does not match the tag of a point for which neighbors are computed. This is useful when computing neighbor list for contact. In this case, we do not want points from the same particle to be in the contact 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 192 of file nflannSetup.h.

Member Typedef Documentation

◆ DistanceType

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

Distance type (double, float, etc)

Definition at line 195 of file nflannSetup.h.

◆ IndexType

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

Index type (int, size_t, etc)

Definition at line 198 of file nflannSetup.h.

Constructor & Destructor Documentation

◆ TreeSearchCheckIDExcludeResult()

template<typename _DistanceType , typename _IndexType = size_t>
nsearch::TreeSearchCheckIDExcludeResult< _DistanceType, _IndexType >::TreeSearchCheckIDExcludeResult ( 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 226 of file nflannSetup.h.

231 : d_r(radius_),
232 d_tag(searchPointTag),
233 d_indices(indices),
234 d_dists(dists),
235 d_dataTags(dataTags) {
236 init();
237 }
void init()
Initialize the data (clear)
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< DistanceType > & d_dists
Distance of points found within the search radius.
const DistanceType d_r
Define search radius. Note this should be square of radius, where radius is a distance within which w...
std::vector< IndexType > & d_indices
Indices within the search radius.
const IndexType & d_tag
Tag of the point we are searching for neighboring points.

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

Here is the call graph for this function:

Member Function Documentation

◆ addPoint()

template<typename _DistanceType , typename _IndexType = size_t>
bool nsearch::TreeSearchCheckIDExcludeResult< _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 272 of file nflannSetup.h.

272 {
273 if (dist < d_r) {
274 if (d_dataTags[index] != d_tag) {
275 d_indices.push_back(index);
276 d_dists.push_back(dist);
277 }
278 }
279 return true;
280 }

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

◆ clear()

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

Clear the data.

Definition at line 247 of file nflannSetup.h.

247 {
248 d_indices.clear();
249 d_dists.clear();
250 }

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

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

Here is the caller graph for this function:

◆ full()

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

Check (not implemented)

Returns
bool Status

Definition at line 263 of file nflannSetup.h.

263{ return true; }

◆ init()

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

Initialize the data (clear)

Definition at line 242 of file nflannSetup.h.

242{ clear(); }

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

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

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::TreeSearchCheckIDExcludeResult< _DistanceType, _IndexType >::size ( ) const
inline

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

Returns
size Size of indices data

Definition at line 257 of file nflannSetup.h.

257{ return d_indices.size(); }

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

◆ worst_item()

template<typename _DistanceType , typename _IndexType = size_t>
std::pair< IndexType, DistanceType > nsearch::TreeSearchCheckIDExcludeResult< _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 296 of file nflannSetup.h.

296 {
297 if (d_indices.empty())
298 throw std::runtime_error("Cannot invoke RadiusResultSet::worst_item() on "
299 "an empty list of results.");
300 return std::make_pair(0, 0.);
301 }

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

◆ worstDist()

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

Return maximum distance for search.

Returns
Radius Maximum distance for search

Definition at line 286 of file nflannSetup.h.

286{ return d_r; }

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

Field Documentation

◆ d_dataTags

template<typename _DistanceType , typename _IndexType = size_t>
const std::vector<IndexType>& nsearch::TreeSearchCheckIDExcludeResult< _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 215 of file nflannSetup.h.

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

◆ d_dists

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

◆ d_indices

◆ d_r

template<typename _DistanceType , typename _IndexType = size_t>
const DistanceType nsearch::TreeSearchCheckIDExcludeResult< _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 203 of file nflannSetup.h.

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

◆ d_tag

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

Tag of the point we are searching for neighboring points.

Definition at line 206 of file nflannSetup.h.

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


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