Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions examples/custom_distance/example_custom_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ KOKKOS_FUNCTION auto distance(CustomPoint const &point,
return distance(point, projected_point);
}

// Callback to store the result indices
struct ExtractIndex
{
template <typename Query, typename Value, typename Output>
KOKKOS_FUNCTION void operator()(Query const &, Value const &value,
Output const &out) const
{
out(value.index);
}
};

int main(int argc, char *argv[])
{
Kokkos::ScopeGuard guard(argc, argv);
Expand Down Expand Up @@ -116,7 +105,7 @@ int main(int argc, char *argv[])
Kokkos::View<int *, MemorySpace> offsets("Example::offsets", 0);
Kokkos::View<int *, MemorySpace> indices("Example::indices", 0);
bvh.query(space, ArborX::Experimental::make_nearest(query_points, 2),
ExtractIndex{}, indices, offsets);
ArborX::Experimental::ExtractIndex{}, indices, offsets);

auto offsets_host =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, offsets);
Expand Down
16 changes: 16 additions & 0 deletions src/spatial/detail/ArborX_PairValueIndex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ struct PairValueIndex
Index index;
};

namespace Experimental
{
// Callback to store the result indices
struct ExtractIndex
{
template <typename Query, typename Value, typename Index, typename Output>
KOKKOS_FUNCTION void operator()(Query const &,
PairValueIndex<Value, Index> const &pair,
Output const &out) const
{
out(pair.index);
}
};

} // namespace Experimental

namespace Details
{
template <typename T>
Expand Down
Loading