PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
nsearch::BaseNSearch Class Referenceabstract

A class for nearest neighbor search. More...

#include <nsearch.h>

Inheritance diagram for nsearch::BaseNSearch:
Collaboration diagram for nsearch::BaseNSearch:

Public Member Functions

 BaseNSearch (std::string name, size_t debug=0)
 Constructor.
 
virtual double updatePointCloud (const std::vector< util::Point > &x, bool parallel=true)=0
 Function to implement point cloud update.
 
virtual double setInputCloud ()=0
 Set input cloud.
 
virtual size_t radiusSearch (const util::Point &searchPoint, const double &search_r, std::vector< int > &neighs, std::vector< float > &sqr_dist)=0
 Perform radius search to find points in a point cloud within specified distance from a given point.
 
virtual size_t radiusSearch (const util::Point &searchPoint, const double &search_r, std::vector< size_t > &neighs, std::vector< double > &sqr_dist)=0
 Perform radius search to find points in a point cloud within specified distance from a given point. = 0
 
virtual size_t radiusSearchExcludeTag (const util::Point &searchPoint, const double &search_r, std::vector< size_t > &neighs, std::vector< double > &sqr_dist, const size_t &searchPointTag, const std::vector< size_t > &dataTags)=0
 Perform radius search to find points in a point cloud within specified distance from a given point. This function also checks the tag of potential point and only if the point has a different tag it will be added to the list. This is useful for getting neighbor lists for contact. In this case, tag of a point is the particle id (particle it belongs to).
 
virtual size_t radiusSearchExcludeTag (const util::Point &searchPoint, const double &search_r, std::vector< int > &neighs, std::vector< float > &sqr_dist, const size_t &searchPointTag, const std::vector< size_t > &dataTags)=0
 = 0
 
virtual size_t radiusSearchIncludeTag (const util::Point &searchPoint, const double &search_r, std::vector< size_t > &neighs, std::vector< double > &sqr_dist, const size_t &searchPointTag, const std::vector< size_t > &dataTags)=0
 Perform radius search to find points in a point cloud within specified distance from a given point. This function also checks the tag of potential point and only if the point has a same tag it will be added to the list. This is useful for getting neighbor lists for peridynamics. In this case, tag of a point is the particle id (particle it belongs to).
 
virtual size_t radiusSearchIncludeTag (const util::Point &searchPoint, const double &search_r, std::vector< int > &neighs, std::vector< float > &sqr_dist, const size_t &searchPointTag, const std::vector< size_t > &dataTags)=0
 = 0
 
virtual void closestPoint (const util::Point &searchPoint, size_t &neigh, double &sqrDistNeigh)=0
 Find the closest points to the specified point.
 

Data Fields

size_t d_debug
 control the verbosity
 
std::string d_treeType
 name of tree: nflann_kdtree
 

Detailed Description

A class for nearest neighbor search.

Definition at line 28 of file nsearch.h.

Constructor & Destructor Documentation

◆ BaseNSearch()

nsearch::BaseNSearch::BaseNSearch ( std::string  name,
size_t  debug = 0 
)
inline

Constructor.

Parameters
nameName of tree
debugDebug level to print information

Definition at line 36 of file nsearch.h.

37 : d_debug(debug), d_treeType(name) {}
std::string d_treeType
name of tree: nflann_kdtree
Definition nsearch.h:171
size_t d_debug
control the verbosity
Definition nsearch.h:168

Member Function Documentation

◆ closestPoint()

virtual void nsearch::BaseNSearch::closestPoint ( const util::Point searchPoint,
size_t &  neigh,
double &  sqrDistNeigh 
)
pure virtual

Find the closest points to the specified point.

Parameters
searchPointPoint near which we want neighbors
foundNeighIndex of point in neighborhood
sqrDistNeighSquared distance of neighboring point from search point

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearch() [1/2]

virtual size_t nsearch::BaseNSearch::radiusSearch ( const util::Point searchPoint,
const double &  search_r,
std::vector< int > &  neighs,
std::vector< float > &  sqr_dist 
)
pure virtual

Perform radius search to find points in a point cloud within specified distance from a given point.

Parameters
searchPointPoint near which we want neighbors
search_rSearch radius
neighsIndices of points in neighborhood
sqr_distSquared distance of neighboring points from search point
Returns
number Number of points in neighborhood

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearch() [2/2]

virtual size_t nsearch::BaseNSearch::radiusSearch ( const util::Point searchPoint,
const double &  search_r,
std::vector< size_t > &  neighs,
std::vector< double > &  sqr_dist 
)
pure virtual

Perform radius search to find points in a point cloud within specified distance from a given point. = 0

Parameters
searchPointPoint near which we want neighbors
search_rSearch radius
neighsIndices of points in neighborhood
sqr_distSquared distance of neighboring points from search point
Returns
number Number of points in neighborhood = 0

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearchExcludeTag() [1/2]

virtual size_t nsearch::BaseNSearch::radiusSearchExcludeTag ( const util::Point searchPoint,
const double &  search_r,
std::vector< int > &  neighs,
std::vector< float > &  sqr_dist,
const size_t &  searchPointTag,
const std::vector< size_t > &  dataTags 
)
pure virtual

= 0

= 0

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearchExcludeTag() [2/2]

virtual size_t nsearch::BaseNSearch::radiusSearchExcludeTag ( const util::Point searchPoint,
const double &  search_r,
std::vector< size_t > &  neighs,
std::vector< double > &  sqr_dist,
const size_t &  searchPointTag,
const std::vector< size_t > &  dataTags 
)
pure virtual

Perform radius search to find points in a point cloud within specified distance from a given point. This function also checks the tag of potential point and only if the point has a different tag it will be added to the list. This is useful for getting neighbor lists for contact. In this case, tag of a point is the particle id (particle it belongs to).

Parameters
searchPointPoint near which we want neighbors
search_rSearch radius
neighsIndices of points in neighborhood
sqr_distSquared distance of neighboring points from search point
searchPointTagTag of a search point
dataTagsVector of tags for each point in the pointcloud
Returns
number Number of points in neighborhood

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearchIncludeTag() [1/2]

virtual size_t nsearch::BaseNSearch::radiusSearchIncludeTag ( const util::Point searchPoint,
const double &  search_r,
std::vector< int > &  neighs,
std::vector< float > &  sqr_dist,
const size_t &  searchPointTag,
const std::vector< size_t > &  dataTags 
)
pure virtual

= 0

= 0

Implemented in nsearch::NFlannSearchKd< dim >.

◆ radiusSearchIncludeTag() [2/2]

virtual size_t nsearch::BaseNSearch::radiusSearchIncludeTag ( const util::Point searchPoint,
const double &  search_r,
std::vector< size_t > &  neighs,
std::vector< double > &  sqr_dist,
const size_t &  searchPointTag,
const std::vector< size_t > &  dataTags 
)
pure virtual

Perform radius search to find points in a point cloud within specified distance from a given point. This function also checks the tag of potential point and only if the point has a same tag it will be added to the list. This is useful for getting neighbor lists for peridynamics. In this case, tag of a point is the particle id (particle it belongs to).

Parameters
searchPointPoint near which we want neighbors
search_rSearch radius
neighsIndices of points in neighborhood
sqr_distSquared distance of neighboring points from search point
searchPointTagTag of a search point
dataTagsVector of tags for each point in the pointcloud
Returns
number Number of points in neighborhood

Implemented in nsearch::NFlannSearchKd< dim >.

◆ setInputCloud()

virtual double nsearch::BaseNSearch::setInputCloud ( )
pure virtual

Set input cloud.

Returns
double Time taken to update the point cloud

Implemented in nsearch::NFlannSearchKd< dim >.

◆ updatePointCloud()

virtual double nsearch::BaseNSearch::updatePointCloud ( const std::vector< util::Point > &  x,
bool  parallel = true 
)
pure virtual

Function to implement point cloud update.

Parameters
xVector of positions of points
parallelSpecify if this is done in parallel
Returns
double Time taken to update the point cloud

Implemented in nsearch::NFlannSearchKd< dim >.

Field Documentation

◆ d_debug

size_t nsearch::BaseNSearch::d_debug

control the verbosity

Definition at line 168 of file nsearch.h.

◆ d_treeType

std::string nsearch::BaseNSearch::d_treeType

name of tree: nflann_kdtree

Definition at line 171 of file nsearch.h.


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