Compadre  1.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Compadre::PointCloudSearch< view_type > Class Template Reference

PointCloudSearch generates neighbor lists and window sizes for each target site. More...

Detailed Description

template<typename view_type>
class Compadre::PointCloudSearch< view_type >

PointCloudSearch generates neighbor lists and window sizes for each target site.

Search methods can be run in dry-run mode, or not.

When in dry-run mode:

neighbors_list will be populated with number of neighbors found for each target site.

This allows a user to know memory allocation needed before storage of neighbor indices.

When not in dry-run mode:

neighbors_list_offsets will be populated with offsets for values (dependent on method) determined by neighbor_list. If a 2D view for neighbors_list is used, then $ N(i,j+1) $ will store the $ j^{th} $ neighbor of $ i $, and $ N(i,0) $ will store the number of neighbors for target $ i $.

Definition at line 143 of file Compadre_PointCloudSearch.hpp.

#include <Compadre_PointCloudSearch.hpp>

Public Types

typedef
nanoflann::KDTreeSingleIndexAdaptor
< nanoflann::L2_Simple_Adaptor
< double, PointCloudSearch
< view_type >
>, PointCloudSearch
< view_type >, 1 > 
tree_type_1d
 
typedef
nanoflann::KDTreeSingleIndexAdaptor
< nanoflann::L2_Simple_Adaptor
< double, PointCloudSearch
< view_type >
>, PointCloudSearch
< view_type >, 2 > 
tree_type_2d
 
typedef
nanoflann::KDTreeSingleIndexAdaptor
< nanoflann::L2_Simple_Adaptor
< double, PointCloudSearch
< view_type >
>, PointCloudSearch
< view_type >, 3 > 
tree_type_3d
 

Public Member Functions

 PointCloudSearch (view_type src_pts_view, const local_index_type dimension=-1, const local_index_type max_leaf=-1)
 
 ~PointCloudSearch ()
 
template<class BBOX >
bool kdtree_get_bbox (BBOX &bb) const
 Bounding box query method required by Nanoflann. More...
 
int kdtree_get_point_count () const
 Returns the number of source sites. More...
 
double kdtree_get_pt (const int idx, int dim) const
 Returns the coordinate value of a point. More...
 
double kdtree_distance (const double *queryPt, const int idx, long long sz) const
 Returns the distance between a point and a source site, given its index. More...
 
void generateKDTree ()
 
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t generate2DNeighborListsFromRadiusSearch (bool is_dry_run, trg_view_type trg_pts_view, neighbor_lists_view_type neighbor_lists, epsilons_view_type epsilons, const double uniform_radius=0.0, double max_search_radius=0.0)
 Generates neighbor lists of 2D view by performing a radius search where the radius to be searched is in the epsilons view. If uniform_radius is given, then this overrides the epsilons view radii sizes. Accepts 2D neighbor_lists without number_of_neighbors_list. More...
 
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t generateCRNeighborListsFromRadiusSearch (bool is_dry_run, trg_view_type trg_pts_view, neighbor_lists_view_type neighbor_lists, neighbor_lists_view_type number_of_neighbors_list, epsilons_view_type epsilons, const double uniform_radius=0.0, double max_search_radius=0.0)
 Generates compressed row neighbor lists by performing a radius search where the radius to be searched is in the epsilons view. If uniform_radius is given, then this overrides the epsilons view radii sizes. Accepts 1D neighbor_lists with 1D number_of_neighbors_list. More...
 
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t generate2DNeighborListsFromKNNSearch (bool is_dry_run, trg_view_type trg_pts_view, neighbor_lists_view_type neighbor_lists, epsilons_view_type epsilons, const int neighbors_needed, const double epsilon_multiplier=1.6, double max_search_radius=0.0)
 Generates neighbor lists as 2D view by performing a k-nearest neighbor search Only accepts 2D neighbor_lists without number_of_neighbors_list. More...
 
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t generateCRNeighborListsFromKNNSearch (bool is_dry_run, trg_view_type trg_pts_view, neighbor_lists_view_type neighbor_lists, neighbor_lists_view_type number_of_neighbors_list, epsilons_view_type epsilons, const int neighbors_needed, const double epsilon_multiplier=1.6, double max_search_radius=0.0)
 Generates compressed row neighbor lists by performing a k-nearest neighbor search Only accepts 1D neighbor_lists with 1D number_of_neighbors_list. More...
 

Static Public Member Functions

static int getEstimatedNumberNeighborsUpperBound (int unisolvency_size, const int dimension, const double epsilon_multiplier)
 Returns a liberal estimated upper bound on number of neighbors to be returned by a neighbor search for a given choice of dimension, basis size, and epsilon_multiplier. More...
 

Protected Attributes

view_type _src_pts_view
 source site coordinates More...
 
const local_index_type _dim
 
const local_index_type _max_leaf
 
std::shared_ptr< tree_type_1d_tree_1d
 
std::shared_ptr< tree_type_2d_tree_2d
 
std::shared_ptr< tree_type_3d_tree_3d
 

Member Typedef Documentation

template<typename view_type>
typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >, PointCloudSearch<view_type>, 1> Compadre::PointCloudSearch< view_type >::tree_type_1d

Definition at line 148 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >, PointCloudSearch<view_type>, 2> Compadre::PointCloudSearch< view_type >::tree_type_2d

Definition at line 150 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >, PointCloudSearch<view_type>, 3> Compadre::PointCloudSearch< view_type >::tree_type_3d

Definition at line 152 of file Compadre_PointCloudSearch.hpp.

Constructor & Destructor Documentation

template<typename view_type>
Compadre::PointCloudSearch< view_type >::PointCloudSearch ( view_type  src_pts_view,
const local_index_type  dimension = -1,
const local_index_type  max_leaf = -1 
)
inline

Definition at line 167 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
Compadre::PointCloudSearch< view_type >::~PointCloudSearch ( )
inline

Definition at line 176 of file Compadre_PointCloudSearch.hpp.

Member Function Documentation

template<typename view_type>
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t Compadre::PointCloudSearch< view_type >::generate2DNeighborListsFromKNNSearch ( bool  is_dry_run,
trg_view_type  trg_pts_view,
neighbor_lists_view_type  neighbor_lists,
epsilons_view_type  epsilons,
const int  neighbors_needed,
const double  epsilon_multiplier = 1.6,
double  max_search_radius = 0.0 
)
inline

Generates neighbor lists as 2D view by performing a k-nearest neighbor search Only accepts 2D neighbor_lists without number_of_neighbors_list.

Parameters
is_dry_run[in] - whether to do a dry-run (find neighbors, but don't store)
trg_pts_view[in] - target coordinates from which to seek neighbors
neighbor_lists[out] - 2D view of neighbor lists to be populated from search
epsilons[in/out] - radius to search, overwritten if uniform_radius != 0
neighbors_needed[in] - k neighbors needed as a minimum
epsilon_multiplier[in] - distance to kth neighbor multiplied by epsilon_multiplier for follow-on radius search
max_search_radius[in] - largest valid search (useful only for MPI jobs if halo size exists)

Definition at line 515 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t Compadre::PointCloudSearch< view_type >::generate2DNeighborListsFromRadiusSearch ( bool  is_dry_run,
trg_view_type  trg_pts_view,
neighbor_lists_view_type  neighbor_lists,
epsilons_view_type  epsilons,
const double  uniform_radius = 0.0,
double  max_search_radius = 0.0 
)
inline

Generates neighbor lists of 2D view by performing a radius search where the radius to be searched is in the epsilons view. If uniform_radius is given, then this overrides the epsilons view radii sizes. Accepts 2D neighbor_lists without number_of_neighbors_list.

Parameters
is_dry_run[in] - whether to do a dry-run (find neighbors, but don't store)
trg_pts_view[in] - target coordinates from which to seek neighbors
neighbor_lists[out] - 2D view of neighbor lists to be populated from search
epsilons[in/out] - radius to search, overwritten if uniform_radius != 0
uniform_radius[in] - double != 0 determines whether to overwrite all epsilons for uniform search
max_search_radius[in] - largest valid search (useful only for MPI jobs if halo size exists)

Definition at line 232 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t Compadre::PointCloudSearch< view_type >::generateCRNeighborListsFromKNNSearch ( bool  is_dry_run,
trg_view_type  trg_pts_view,
neighbor_lists_view_type  neighbor_lists,
neighbor_lists_view_type  number_of_neighbors_list,
epsilons_view_type  epsilons,
const int  neighbors_needed,
const double  epsilon_multiplier = 1.6,
double  max_search_radius = 0.0 
)
inline

Generates compressed row neighbor lists by performing a k-nearest neighbor search Only accepts 1D neighbor_lists with 1D number_of_neighbors_list.

Parameters
is_dry_run[in] - whether to do a dry-run (find neighbors, but don't store)
trg_pts_view[in] - target coordinates from which to seek neighbors
neighbor_lists[out] - 1D view of neighbor lists to be populated from search
number_of_neighbors_list[in/out] - number of neighbors for each target site
epsilons[in/out] - radius to search, overwritten if uniform_radius != 0
neighbors_needed[in] - k neighbors needed as a minimum
epsilon_multiplier[in] - distance to kth neighbor multiplied by epsilon_multiplier for follow-on radius search
max_search_radius[in] - largest valid search (useful only for MPI jobs if halo size exists)

Definition at line 657 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
template<typename trg_view_type , typename neighbor_lists_view_type , typename epsilons_view_type >
size_t Compadre::PointCloudSearch< view_type >::generateCRNeighborListsFromRadiusSearch ( bool  is_dry_run,
trg_view_type  trg_pts_view,
neighbor_lists_view_type  neighbor_lists,
neighbor_lists_view_type  number_of_neighbors_list,
epsilons_view_type  epsilons,
const double  uniform_radius = 0.0,
double  max_search_radius = 0.0 
)
inline

Generates compressed row neighbor lists by performing a radius search where the radius to be searched is in the epsilons view. If uniform_radius is given, then this overrides the epsilons view radii sizes. Accepts 1D neighbor_lists with 1D number_of_neighbors_list.

Parameters
is_dry_run[in] - whether to do a dry-run (find neighbors, but don't store)
trg_pts_view[in] - target coordinates from which to seek neighbors
neighbor_lists[out] - 1D view of neighbor lists to be populated from search
number_of_neighbors_list[in/out] - number of neighbors for each target site
epsilons[in/out] - radius to search, overwritten if uniform_radius != 0
uniform_radius[in] - double != 0 determines whether to overwrite all epsilons for uniform search
max_search_radius[in] - largest valid search (useful only for MPI jobs if halo size exists)

Definition at line 366 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
void Compadre::PointCloudSearch< view_type >::generateKDTree ( )
inline

Definition at line 207 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
static int Compadre::PointCloudSearch< view_type >::getEstimatedNumberNeighborsUpperBound ( int  unisolvency_size,
const int  dimension,
const double  epsilon_multiplier 
)
inlinestatic

Returns a liberal estimated upper bound on number of neighbors to be returned by a neighbor search for a given choice of dimension, basis size, and epsilon_multiplier.

Assumes quasiuniform distribution of points. This result can be used to size a preallocated neighbor_lists kokkos view.

Definition at line 181 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
double Compadre::PointCloudSearch< view_type >::kdtree_distance ( const double *  queryPt,
const int  idx,
long long  sz 
) const
inline

Returns the distance between a point and a source site, given its index.

Definition at line 197 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
template<class BBOX >
bool Compadre::PointCloudSearch< view_type >::kdtree_get_bbox ( BBOX &  bb) const
inline

Bounding box query method required by Nanoflann.

Definition at line 188 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
int Compadre::PointCloudSearch< view_type >::kdtree_get_point_count ( ) const
inline

Returns the number of source sites.

Definition at line 191 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
double Compadre::PointCloudSearch< view_type >::kdtree_get_pt ( const int  idx,
int  dim 
) const
inline

Returns the coordinate value of a point.

Definition at line 194 of file Compadre_PointCloudSearch.hpp.

Member Data Documentation

template<typename view_type>
const local_index_type Compadre::PointCloudSearch< view_type >::_dim
protected

Definition at line 158 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
const local_index_type Compadre::PointCloudSearch< view_type >::_max_leaf
protected

Definition at line 159 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
view_type Compadre::PointCloudSearch< view_type >::_src_pts_view
protected

source site coordinates

Definition at line 157 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
std::shared_ptr<tree_type_1d> Compadre::PointCloudSearch< view_type >::_tree_1d
protected

Definition at line 161 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
std::shared_ptr<tree_type_2d> Compadre::PointCloudSearch< view_type >::_tree_2d
protected

Definition at line 162 of file Compadre_PointCloudSearch.hpp.

template<typename view_type>
std::shared_ptr<tree_type_3d> Compadre::PointCloudSearch< view_type >::_tree_3d
protected

Definition at line 163 of file Compadre_PointCloudSearch.hpp.


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