Skip to content

Commit

Permalink
Add CTAD for Indexables
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Oct 12, 2024
1 parent 1389d25 commit b877e85
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/cluster/ArborX_DBSCAN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives,
Box bounds;
Details::TreeConstruction::calculateBoundingBoxOfTheScene(
exec_space,
Details::Indexables<Points, Experimental::Indexable<Point>>{points, {}},
bounds);
Details::Indexables{points, Experimental::Indexable<Point>{}}, bounds);

// The cell length is chosen to be eps/sqrt(dimension), so that any two
// points within the same cell are within eps distance of each other.
Expand Down
4 changes: 1 addition & 3 deletions src/spatial/ArborX_BruteForce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ void BruteForce<MemorySpace, Value, IndexableGetter, BoundingVolume>::query(

Details::BruteForceImpl::query(
Tag{}, space, predicates, _values,
Details::Indexables<decltype(_values), IndexableGetter>{
_values, _indexable_getter},
callback);
Details::Indexables{_values, _indexable_getter}, callback);
}

} // namespace ArborX
Expand Down
3 changes: 1 addition & 2 deletions src/spatial/ArborX_LinearBVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ BoundingVolumeHierarchy<MemorySpace, Value, IndexableGetter, BoundingVolume>::
return;
}

Details::Indexables<Values, IndexableGetter> indexables{values,
indexable_getter};
Details::Indexables indexables{values, indexable_getter};

Kokkos::Profiling::pushRegion(
"ArborX::BVH::BVH::calculate_scene_bounding_box");
Expand Down
8 changes: 8 additions & 0 deletions src/spatial/detail/ArborX_Indexable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ struct Indexables
KOKKOS_FUNCTION auto size() const { return _values.size(); }
};

template <typename Values, typename IndexableGetter>
#if KOKKOS_VERSION >= 40400
KOKKOS_DEDUCTION_GUIDE
#else
KOKKOS_FUNCTION
#endif
Indexables(Values, IndexableGetter) -> Indexables<Values, IndexableGetter>;

} // namespace Details

} // namespace ArborX
Expand Down
5 changes: 2 additions & 3 deletions test/tstDetailsTreeConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(assign_morton_codes, DeviceType,

using Values = LegacyValues<decltype(boxes), ArborX::Box<3>>;
Values values{boxes};
ArborX::Details::Indexables<
Values, ArborX::Experimental::Indexable<typename Values::value_type>>
indexables{values, {}};
ArborX::Details::Indexables indexables{
values, ArborX::Experimental::Indexable<typename Values::value_type>{}};

// Test for a bug where missing move ref operator() in default Indexable
// results in a default initialized indexable used in scene box calucation.
Expand Down
6 changes: 2 additions & 4 deletions test/tstIndexableGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(indexables, DeviceType, ARBORX_DEVICE_TYPES)

Primitives primitives(points_cloud);

ArborX::Details::Indexables<Primitives, IndexableGetter> indexables{
primitives, IndexableGetter{}};
ArborX::Details::Indexables indexables{primitives, IndexableGetter{}};

ArborX::Box<3> box;
calculateBoundingBoxOfTheScene(ExecutionSpace{}, indexables, box);
Expand All @@ -130,8 +129,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(indexables, DeviceType, ARBORX_DEVICE_TYPES)
ArborX::Experimental::Indexable<typename Primitives::value_type>;
Primitives primitives(points_cloud);

ArborX::Details::Indexables<Primitives, IndexableGetter> indexables{
primitives, IndexableGetter{}};
ArborX::Details::Indexables indexables{primitives, IndexableGetter{}};

ArborX::Box<3> box;
calculateBoundingBoxOfTheScene(ExecutionSpace{}, indexables, box);
Expand Down

0 comments on commit b877e85

Please sign in to comment.