1 #ifndef _COMPADRE_POINTCLOUDSEARCH_HPP_
2 #define _COMPADRE_POINTCLOUDSEARCH_HPP_
6 #include "nanoflann.hpp"
7 #include <Kokkos_Core.hpp>
23 template <
typename _DistanceType,
typename _IndexType =
size_t>
50 bool full()
const {
return true; }
104 DistanceType best_distance = std::numeric_limits<DistanceType>::max();
108 if (
r_dist[i] < best_distance) {
109 best_distance =
r_dist[i];
110 best_distance_index =
i_dist[i];
115 if (best_index != 0) {
117 i_dist[0] = best_distance_index;
118 i_dist[best_index] = tmp_ind;
142 template <
typename view_type>
147 typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >,
149 typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >,
151 typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<double, PointCloudSearch<view_type> >,
170 _dim((dimension < 0) ? src_pts_view.extent(1) : dimension),
171 _max_leaf((max_leaf < 0) ? 10 : max_leaf) {
172 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename view_type::memory_space>::accessible==1)
173 &&
"Views passed to PointCloudSearch at construction should be accessible from the host.");
183 if (dimension==1) multiplier = 2;
184 return multiplier * 2.0 * unisolvency_size * pow(epsilon_multiplier, dimension) + 1;
197 inline double kdtree_distance(
const double* queryPt,
const int idx,
long long sz)
const {
200 for (
int i=0; i<
_dim; ++i) {
203 return std::sqrt(distance);
209 _tree_1d = std::make_shared<tree_type_1d>(1, *
this, nanoflann::KDTreeSingleIndexAdaptorParams(
_max_leaf));
211 }
else if (
_dim==2) {
212 _tree_2d = std::make_shared<tree_type_2d>(2, *
this, nanoflann::KDTreeSingleIndexAdaptorParams(
_max_leaf));
214 }
else if (
_dim==3) {
215 _tree_3d = std::make_shared<tree_type_3d>(3, *
this, nanoflann::KDTreeSingleIndexAdaptorParams(
_max_leaf));
231 template <
typename trg_view_type,
typename neighbor_lists_view_type,
typename epsilons_view_type>
233 neighbor_lists_view_type neighbor_lists, epsilons_view_type epsilons,
234 const double uniform_radius = 0.0,
double max_search_radius = 0.0) {
238 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename trg_view_type::memory_space>::accessible==1) &&
239 "Target coordinates view passed to generate2DNeighborListsFromRadiusSearch should be accessible from the host.");
241 "Target coordinates view passed to generate2DNeighborListsFromRadiusSearch must have \
242 second dimension as large as _dim.");
243 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename neighbor_lists_view_type::memory_space>::accessible==1) &&
244 "Views passed to generate2DNeighborListsFromRadiusSearch should be accessible from the host.");
245 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename epsilons_view_type::memory_space>::accessible==1) &&
246 "Views passed to generate2DNeighborListsFromRadiusSearch should be accessible from the host.");
257 && neighbor_lists.extent(1)>=1)
258 &&
"neighbor lists View does not have large enough dimensions");
262 &&
"epsilons View does not have the correct dimension");
264 typedef Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
267 typedef Kokkos::View<size_t*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
271 int team_scratch_size = 0;
272 team_scratch_size += scratch_double_view::shmem_size(neighbor_lists.extent(1));
273 team_scratch_size += scratch_int_view::shmem_size(neighbor_lists.extent(1));
274 team_scratch_size += scratch_double_view::shmem_size(
_dim);
277 size_t max_num_neighbors = 0;
280 Kokkos::parallel_reduce(
"radius search",
host_team_policy(num_target_sites, Kokkos::AUTO)
281 .set_scratch_size(0 , Kokkos::PerTeam(team_scratch_size)),
282 KOKKOS_LAMBDA(
const host_member_type& teamMember,
size_t& t_max_num_neighbors) {
285 scratch_double_view neighbor_distances(teamMember.team_scratch(0 ), neighbor_lists.extent(1));
286 scratch_int_view neighbor_indices(teamMember.team_scratch(0 ), neighbor_lists.extent(1));
287 scratch_double_view this_target_coord(teamMember.team_scratch(0 ),
_dim);
289 size_t neighbors_found = 0;
291 const int i = teamMember.league_rank();
294 if (uniform_radius > 0) epsilons(i) = uniform_radius;
297 compadre_kernel_assert_release((epsilons(i)<=max_search_radius || max_search_radius==0) &&
"max_search_radius given (generally derived from the size of a halo region), and search radius needed would exceed this max_search_radius.");
299 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, neighbor_lists.extent(1)), [&](
const int j) {
300 neighbor_indices(j) = 0;
301 neighbor_distances(j) = -1.0;
303 teamMember.team_barrier();
305 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
309 for (
int j=0; j<
_dim; ++j) {
310 this_target_coord(j) = trg_pts_view(i,j);
313 nanoflann::SearchParams sp;
316 neighbors_found =
_tree_1d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
317 }
else if (_dim==2) {
318 neighbors_found =
_tree_2d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
319 }
else if (_dim==3) {
320 neighbors_found =
_tree_3d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
323 t_max_num_neighbors = (neighbors_found > t_max_num_neighbors) ? neighbors_found : t_max_num_neighbors;
326 neighbor_lists(i,0) = neighbors_found;
330 teamMember.team_barrier();
333 int loop_bound = (neighbors_found < neighbor_lists.extent(1)-1) ? neighbors_found : neighbor_lists.extent(1)-1;
336 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, loop_bound), [&](
const int j) {
338 neighbor_lists(i,j+1) =
static_cast<typename std::remove_pointer<typename std::remove_pointer<typename neighbor_lists_view_type::data_type>::type
>::type>(neighbor_indices(j));
340 teamMember.team_barrier();
343 }, Kokkos::Max<size_t>(max_num_neighbors) );
348 &&
"neighbor_lists does not contain enough columns for the maximum number of neighbors needing to be stored.");
350 return max_num_neighbors;
365 template <
typename trg_view_type,
typename neighbor_lists_view_type,
typename epsilons_view_type>
367 neighbor_lists_view_type neighbor_lists, neighbor_lists_view_type number_of_neighbors_list,
368 epsilons_view_type epsilons,
const double uniform_radius = 0.0,
double max_search_radius = 0.0) {
372 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename trg_view_type::memory_space>::accessible==1) &&
373 "Target coordinates view passed to generateCRNeighborListsFromRadiusSearch should be accessible from the host.");
375 "Target coordinates view passed to generateCRNeighborListsFromRadiusSearch must have \
376 second dimension as large as _dim.");
377 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename neighbor_lists_view_type::memory_space>::accessible==1) &&
378 "Views passed to generateCRNeighborListsFromRadiusSearch should be accessible from the host.");
379 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename epsilons_view_type::memory_space>::accessible==1) &&
380 "Views passed to generateCRNeighborListsFromRadiusSearch should be accessible from the host.");
390 &&
"number_of_neighbors_list or neighbor lists View does not have large enough dimensions");
393 neighbor_lists_view_type row_offsets;
394 int max_neighbor_list_row_storage_size = 1;
397 max_neighbor_list_row_storage_size = nla.getMaxNumNeighbors();
398 Kokkos::resize(row_offsets, num_target_sites);
399 Kokkos::parallel_for(Kokkos::RangePolicy<host_execution_space>(0,num_target_sites), [&](
const int i) {
400 row_offsets(i) = nla.getRowOffsetHost(i);
406 &&
"epsilons View does not have the correct dimension");
408 typedef Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
411 typedef Kokkos::View<size_t*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
415 int team_scratch_size = 0;
416 team_scratch_size += scratch_double_view::shmem_size(max_neighbor_list_row_storage_size);
417 team_scratch_size += scratch_int_view::shmem_size(max_neighbor_list_row_storage_size);
418 team_scratch_size += scratch_double_view::shmem_size(
_dim);
422 Kokkos::parallel_for(
"radius search",
host_team_policy(num_target_sites, Kokkos::AUTO)
423 .set_scratch_size(0 , Kokkos::PerTeam(team_scratch_size)),
427 scratch_double_view neighbor_distances(teamMember.team_scratch(0 ), max_neighbor_list_row_storage_size);
428 scratch_int_view neighbor_indices(teamMember.team_scratch(0 ), max_neighbor_list_row_storage_size);
429 scratch_double_view this_target_coord(teamMember.team_scratch(0 ),
_dim);
431 size_t neighbors_found = 0;
433 const int i = teamMember.league_rank();
436 if (uniform_radius > 0) epsilons(i) = uniform_radius;
439 compadre_kernel_assert_release((epsilons(i)<=max_search_radius || max_search_radius==0) &&
"max_search_radius given (generally derived from the size of a halo region), and search radius needed would exceed this max_search_radius.");
441 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_neighbor_list_row_storage_size), [&](
const int j) {
442 neighbor_indices(j) = 0;
443 neighbor_distances(j) = -1.0;
445 teamMember.team_barrier();
447 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
451 for (
int j=0; j<
_dim; ++j) {
452 this_target_coord(j) = trg_pts_view(i,j);
455 nanoflann::SearchParams sp;
458 neighbors_found =
_tree_1d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
459 }
else if (_dim==2) {
460 neighbors_found =
_tree_2d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
461 }
else if (_dim==3) {
462 neighbors_found =
_tree_3d->template radiusSearchCustomCallback<Compadre::RadiusResultSet<double> >(this_target_coord.data(), rrs, sp) ;
467 number_of_neighbors_list(i) = neighbors_found;
470 &&
"Number of neighbors found changed since dry-run.");
475 teamMember.team_barrier();
478 int loop_bound = neighbors_found;
481 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, loop_bound), [&](
const int j) {
483 neighbor_lists(row_offsets(i)+j) =
static_cast<typename std::remove_pointer<typename std::remove_pointer<typename neighbor_lists_view_type::data_type>::type
>::type>(neighbor_indices(j));
485 teamMember.team_barrier();
491 int total_storage_size = 0;
492 Kokkos::parallel_reduce(
"total number of neighbors over all lists", Kokkos::RangePolicy<host_execution_space>(0, number_of_neighbors_list.extent(0)),
493 KOKKOS_LAMBDA(
const int i,
int& t_total_num_neighbors) {
494 t_total_num_neighbors += number_of_neighbors_list(i);
495 }, Kokkos::Sum<int>(total_storage_size));
497 return (
size_t)(total_storage_size);
499 return (
size_t)(number_of_neighbors_list(num_target_sites-1)+row_offsets(num_target_sites-1));
514 template <
typename trg_view_type,
typename neighbor_lists_view_type,
typename epsilons_view_type>
516 neighbor_lists_view_type neighbor_lists, epsilons_view_type epsilons,
517 const int neighbors_needed,
const double epsilon_multiplier = 1.6,
518 double max_search_radius = 0.0) {
522 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename trg_view_type::memory_space>::accessible==1) &&
523 "Target coordinates view passed to generate2DNeighborListsFromKNNSearch should be accessible from the host.");
525 "Target coordinates view passed to generate2DNeighborListsFromRadiusSearch must have \
526 second dimension as large as _dim.");
527 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename neighbor_lists_view_type::memory_space>::accessible==1) &&
528 "Views passed to generate2DNeighborListsFromKNNSearch should be accessible from the host.");
529 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename epsilons_view_type::memory_space>::accessible==1) &&
530 "Views passed to generate2DNeighborListsFromKNNSearch should be accessible from the host.");
541 (neighbor_lists.extent(0)==(size_t)num_target_sites
542 && neighbor_lists.extent(1)>=(size_t)(neighbors_needed+1)))
543 &&
"neighbor lists View does not have large enough dimensions");
547 &&
"epsilons View does not have the correct dimension");
549 typedef Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
552 typedef Kokkos::View<size_t*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
556 int team_scratch_size = 0;
557 team_scratch_size += scratch_double_view::shmem_size(neighbor_lists.extent(1));
558 team_scratch_size += scratch_int_view::shmem_size(neighbor_lists.extent(1));
559 team_scratch_size += scratch_double_view::shmem_size(
_dim);
562 size_t min_num_neighbors = 0;
570 Kokkos::parallel_reduce(
"knn search",
host_team_policy(num_target_sites, Kokkos::AUTO)
571 .set_scratch_size(0 , Kokkos::PerTeam(team_scratch_size)),
572 KOKKOS_LAMBDA(
const host_member_type& teamMember,
size_t& t_min_num_neighbors) {
575 scratch_double_view neighbor_distances(teamMember.team_scratch(0 ), neighbor_lists.extent(1));
576 scratch_int_view neighbor_indices(teamMember.team_scratch(0 ), neighbor_lists.extent(1));
577 scratch_double_view this_target_coord(teamMember.team_scratch(0 ),
_dim);
579 size_t neighbors_found = 0;
581 const int i = teamMember.league_rank();
583 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, neighbor_lists.extent(1)), [=](
const int j) {
584 neighbor_indices(j) = 0;
585 neighbor_distances(j) = -1.0;
588 teamMember.team_barrier();
589 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
593 for (
int j=0; j<
_dim; ++j) {
594 this_target_coord(j) = trg_pts_view(i,j);
598 neighbors_found =
_tree_1d->knnSearch(this_target_coord.data(), neighbors_needed,
599 neighbor_indices.data(), neighbor_distances.data()) ;
600 }
else if (_dim==2) {
601 neighbors_found =
_tree_2d->knnSearch(this_target_coord.data(), neighbors_needed,
602 neighbor_indices.data(), neighbor_distances.data()) ;
603 }
else if (_dim==3) {
604 neighbors_found =
_tree_3d->knnSearch(this_target_coord.data(), neighbors_needed,
605 neighbor_indices.data(), neighbor_distances.data()) ;
609 t_min_num_neighbors = (neighbors_found < t_min_num_neighbors) ? neighbors_found : t_min_num_neighbors;
612 epsilons(i) = (neighbor_distances(neighbors_found-1) > 0) ?
613 std::sqrt(neighbor_distances(neighbors_found-1))*(epsilon_multiplier+1e-14) : 1e-14*epsilon_multiplier;
621 &&
"Neighbors found exceeded storage capacity in neighbor list.");
623 &&
"max_search_radius given (generally derived from the size of a halo region), \
624 and search radius needed would exceed this max_search_radius.");
627 }, Kokkos::Min<size_t>(min_num_neighbors) );
632 if (num_target_sites==0) min_num_neighbors = neighbors_needed;
636 &&
"Neighbor search failed to find number of neighbors needed for unisolvency.");
640 epsilons, 0.0 , max_search_radius);
642 return max_num_neighbors;
656 template <
typename trg_view_type,
typename neighbor_lists_view_type,
typename epsilons_view_type>
658 neighbor_lists_view_type neighbor_lists, neighbor_lists_view_type number_of_neighbors_list,
659 epsilons_view_type epsilons,
const int neighbors_needed,
const double epsilon_multiplier = 1.6,
660 double max_search_radius = 0.0) {
664 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename trg_view_type::memory_space>::accessible==1) &&
665 "Target coordinates view passed to generateCRNeighborListsFromKNNSearch should be accessible from the host.");
667 "Target coordinates view passed to generateCRNeighborListsFromRadiusSearch must have \
668 second dimension as large as _dim.");
669 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename neighbor_lists_view_type::memory_space>::accessible==1) &&
670 "Views passed to generateCRNeighborListsFromKNNSearch should be accessible from the host.");
671 compadre_assert_release((Kokkos::SpaceAccessibility<host_execution_space, typename epsilons_view_type::memory_space>::accessible==1) &&
672 "Views passed to generateCRNeighborListsFromKNNSearch should be accessible from the host.");
683 &&
"number_of_neighbors_list or neighbor lists View does not have large enough dimensions");
686 int last_row_offset = 0;
688 int max_neighbor_list_row_storage_size = neighbors_needed;
691 max_neighbor_list_row_storage_size = nla.getMaxNumNeighbors();
692 last_row_offset = nla.getRowOffsetHost(num_target_sites-1);
696 &&
"epsilons View does not have the correct dimension");
698 typedef Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
701 typedef Kokkos::View<size_t*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
705 int team_scratch_size = 0;
706 team_scratch_size += scratch_double_view::shmem_size(max_neighbor_list_row_storage_size);
707 team_scratch_size += scratch_int_view::shmem_size(max_neighbor_list_row_storage_size);
708 team_scratch_size += scratch_double_view::shmem_size(
_dim);
711 size_t min_num_neighbors = 0;
719 Kokkos::parallel_reduce(
"knn search",
host_team_policy(num_target_sites, Kokkos::AUTO)
720 .set_scratch_size(0 , Kokkos::PerTeam(team_scratch_size)),
721 KOKKOS_LAMBDA(
const host_member_type& teamMember,
size_t& t_min_num_neighbors) {
724 scratch_double_view neighbor_distances(teamMember.team_scratch(0 ), max_neighbor_list_row_storage_size);
725 scratch_int_view neighbor_indices(teamMember.team_scratch(0 ), max_neighbor_list_row_storage_size);
726 scratch_double_view this_target_coord(teamMember.team_scratch(0 ),
_dim);
728 size_t neighbors_found = 0;
730 const int i = teamMember.league_rank();
732 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_neighbor_list_row_storage_size), [=](
const int j) {
733 neighbor_indices(j) = 0;
734 neighbor_distances(j) = -1.0;
737 teamMember.team_barrier();
738 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
742 for (
int j=0; j<
_dim; ++j) {
743 this_target_coord(j) = trg_pts_view(i,j);
747 neighbors_found =
_tree_1d->knnSearch(this_target_coord.data(), neighbors_needed,
748 neighbor_indices.data(), neighbor_distances.data()) ;
749 }
else if (_dim==2) {
750 neighbors_found =
_tree_2d->knnSearch(this_target_coord.data(), neighbors_needed,
751 neighbor_indices.data(), neighbor_distances.data()) ;
752 }
else if (_dim==3) {
753 neighbors_found =
_tree_3d->knnSearch(this_target_coord.data(), neighbors_needed,
754 neighbor_indices.data(), neighbor_distances.data()) ;
758 t_min_num_neighbors = (neighbors_found < t_min_num_neighbors) ? neighbors_found : t_min_num_neighbors;
761 epsilons(i) = (neighbor_distances(neighbors_found-1) > 0) ?
762 std::sqrt(neighbor_distances(neighbors_found-1))*(epsilon_multiplier+1e-14) : 1e-14*epsilon_multiplier;
769 &&
"max_search_radius given (generally derived from the size of a halo region), \
770 and search radius needed would exceed this max_search_radius.");
773 }, Kokkos::Min<size_t>(min_num_neighbors) );
778 if (num_target_sites==0) min_num_neighbors = neighbors_needed;
782 &&
"Neighbor search failed to find number of neighbors needed for unisolvency.");
786 number_of_neighbors_list, epsilons, 0.0 , max_search_radius);
789 int total_storage_size = 0;
790 Kokkos::parallel_reduce(
"total number of neighbors over all lists", Kokkos::RangePolicy<host_execution_space>(0, number_of_neighbors_list.extent(0)),
791 KOKKOS_LAMBDA(
const int i,
int& t_total_num_neighbors) {
792 t_total_num_neighbors += number_of_neighbors_list(i);
793 }, Kokkos::Sum<int>(total_storage_size));
795 return (
size_t)(total_storage_size);
797 return (
size_t)(number_of_neighbors_list(num_target_sites-1)+last_row_offset);
803 template <
typename view_type>
const DistanceType radius
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 neighbo...
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudSearch< view_type > >, PointCloudSearch< view_type >, 3 > tree_type_3d
import subprocess import os import re import math import sys import argparse d d num_target_sites
#define compadre_kernel_assert_release(condition)
compadre_kernel_assert_release is similar to compadre_assert_release, but is a call on the device...
int kdtree_get_point_count() const
Returns the number of source sites.
PointCloudSearch< view_type > CreatePointCloudSearch(view_type src_view, const local_index_type dimensions=-1, const local_index_type max_leaf=-1)
CreatePointCloudSearch allows for the construction of an object of type PointCloudSearch with templat...
RadiusResultSet(DistanceType radius_, DistanceType *r_dist_, IndexType *i_dist_, const IndexType max_size_)
DistanceType worstDist() const
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 nei...
bool kdtree_get_bbox(BBOX &bb) const
Bounding box query method required by Nanoflann.
Kokkos::TeamPolicy< host_execution_space > host_team_policy
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 ...
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...
std::pair< IndexType, DistanceType > worst_item() const
NeighborLists< view_type > CreateNeighborLists(view_type neighbor_lists, view_type number_of_neighbors_list)
CreateNeighborLists allows for the construction of an object of type NeighborLists with template dedu...
Custom RadiusResultSet for nanoflann that uses pre-allocated space for indices and radii instead of u...
PointCloudSearch(view_type src_pts_view, const local_index_type dimension=-1, const local_index_type max_leaf=-1)
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudSearch< view_type > >, PointCloudSearch< view_type >, 2 > tree_type_2d
bool addPoint(DistanceType dist, IndexType index)
std::shared_ptr< tree_type_3d > _tree_3d
_DistanceType DistanceType
std::shared_ptr< tree_type_2d > _tree_2d
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.
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 fo...
PointCloudSearch generates neighbor lists and window sizes for each target site.
host_team_policy::member_type host_member_type
const local_index_type _dim
std::shared_ptr< tree_type_1d > _tree_1d
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudSearch< view_type > >, PointCloudSearch< view_type >, 1 > tree_type_1d
double kdtree_get_pt(const int idx, int dim) const
Returns the coordinate value of a point.
view_type _src_pts_view
source site coordinates
#define compadre_assert_release(condition)
compadre_assert_release is used for assertions that should always be checked, but generally are not e...
#define compadre_kernel_assert_debug(condition)
const local_index_type _max_leaf