nearest¶
Defined in header <ArborX_Predicates.hpp>
-
template<typename Geometry>
KOKKOS_INLINE_FUNCTION auto nearest(Geometry const &geometry, int k = 1)¶ Generate a nearest predicate to perform a k-nearest neighbors search with in a spatial index’
query().- Template Parameters:
Geometry – The geometry type, e.g., ArborX::Point, ArborX::Box, or
ArborX::Sphere. See Geometries for the geometries provided by ArborX.- Parameters:
geometry – The geometry object from which distance is calculated.
k – The number of values to search for.
- Returns:
A predicate satisfied by the
kvalues stored in the index whose indexable is the closest togeometry. If the index stores fewer thankvalues, all of them are found. The type of the returned object is unspecified.
Example¶
auto nearest_five_to_origin_pred =
ArborX::nearest(ArborX::Point{0.f, 0.f, 0.f}, 5);
Helper functions¶
The helper function creates a set of predicates from a set of geometries
rather than from a single one.
The geometries are provided through AccessTraits, for instance as
a Kokkos::View.
The result is meant to be passed directly as the predicates argument of
query().
-
template<typename Primitives>
auto Experimental::make_nearest(Primitives const &primitives, int k)¶ Create a set of nearest predicates, one per geometry.
This is equivalent to creating the set of predicates
nearest(AccessTraits<Primitives>::get(primitives, i), k).- Parameters:
primitives – A set of geometries.
k – The number of values to search for, for each geometry.
using Geometries = Kokkos::View<Geometry*>; Geometries geometries("geometries", 5); int k = 3; auto predicates = ArborX::Experimental::make_nearest(geometries, k);