Skip to content

Commit

Permalink
Get rid of LegacyDefaultCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Nov 23, 2024
1 parent b933420 commit f124970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
15 changes: 0 additions & 15 deletions src/spatial/detail/ArborX_Callbacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ struct DefaultCallback
}
};

struct LegacyDefaultCallback
{
template <typename Query, typename Value, typename Index,
typename OutputFunctor>
KOKKOS_FUNCTION void operator()(Query const &,
PairValueIndex<Value, Index> const &value,
OutputFunctor const &output) const
{
// APIv1 callback has the signature operator()(Query, int)
// As we store PairValueIndex with potentially non int index (like
// unsigned), we explicitly cast it here.
output((int)value.index);
}
};

// archetypal alias for a 'tag' type member in user callbacks
template <typename Callback>
using CallbackTagArchetypeAlias = typename Callback::tag;
Expand Down
8 changes: 6 additions & 2 deletions test/ArborXTest_LegacyTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class LegacyTree : public Tree
query(ExecutionSpace const &space, Predicates const &predicates, View &&view,
Args &&...args) const
{
Tree::query(space, predicates, ArborX::Details::LegacyDefaultCallback{},
Tree::query(space, predicates,
LegacyCallbackWrapper<ArborX::Details::DefaultCallback>{
ArborX::Details::DefaultCallback{}},
std::forward<View>(view), std::forward<Args>(args)...);
}

Expand All @@ -159,7 +161,9 @@ class LegacyTree : public Tree
{
Kokkos::View<int *, typename Tree::memory_space> indices(
"Testing::indices", 0);
Tree::query(space, predicates, ArborX::Details::LegacyDefaultCallback{},
Tree::query(space, predicates,
LegacyCallbackWrapper<ArborX::Details::DefaultCallback>{
ArborX::Details::DefaultCallback{}},
indices, std::forward<OffsetView>(offset),
std::forward<Args>(args)...);
callback(predicates, std::forward<OffsetView>(offset), indices,
Expand Down

0 comments on commit f124970

Please sign in to comment.