Skip to content

Commit

Permalink
Switch the test to use expand
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed May 4, 2024
1 parent a1ba239 commit 8ed5cdc
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test/tstIndexableGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ struct ArborX::AccessTraits<PairPointIndexCloud<MemorySpace>,
using memory_space = MemorySpace;
};

template <typename Indexables, typename BoundingVolume>
struct SceneReductionFunctor
{
Indexables _indexables;

KOKKOS_FUNCTION void init(BoundingVolume &volume)
{
volume = BoundingVolume{};
}
KOKKOS_FUNCTION void operator()(int i, BoundingVolume &update) const
{
ArborX::Details::expand(update, _indexables(i));
}
KOKKOS_FUNCTION void join(BoundingVolume &result,
BoundingVolume const &update)
{
expand(result, update);
}
};

template <typename ExecutionSpace, typename Indexables, typename Box>
inline void calculateBoundingBoxOfTheScene(ExecutionSpace const &space,
Indexables const &indexables,
Expand All @@ -74,11 +94,10 @@ inline void calculateBoundingBoxOfTheScene(ExecutionSpace const &space,
Kokkos::parallel_reduce(
"ArborX::TreeConstruction::calculate_bounding_box_of_the_scene",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, indexables.size()),
KOKKOS_LAMBDA(int i, Box &update) { expand(update, indexables(i)); },
Kokkos::Sum<Box>{scene_bounding_box});
SceneReductionFunctor<Indexables, Box>{indexables}, scene_bounding_box);
}

BOOST_AUTO_TEST_SUITE(MortonCodes)
BOOST_AUTO_TEST_SUITE(IndexableGetterAccess)

BOOST_AUTO_TEST_CASE_TEMPLATE(indexables, DeviceType, ARBORX_DEVICE_TYPES)
{
Expand Down

0 comments on commit 8ed5cdc

Please sign in to comment.