Skip to content

Commit

Permalink
Move IndexablesGetter from Details to Experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Nov 8, 2024
1 parent 1b46953 commit d2f6ac9
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/cluster/ArborX_DBSCAN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives,
Box bounds;
Details::TreeConstruction::calculateBoundingBoxOfTheScene(
exec_space,
Details::Indexables{points, Details::DefaultIndexableGetter{}}, bounds);
Details::Indexables{points, Experimental::DefaultIndexableGetter{}},
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
5 changes: 3 additions & 2 deletions src/distributed/ArborX_DistributedTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class DistributedTreeBase
using BoundingVolume = typename BottomTree::bounding_volume_type;
using TopTree =
BoundingVolumeHierarchy<MemorySpace, PairValueIndex<BoundingVolume, int>,
Details::DefaultIndexableGetter, BoundingVolume>;
Experimental::DefaultIndexableGetter,
BoundingVolume>;

using bottom_tree_type = BottomTree;
using top_tree_type = TopTree;
Expand Down Expand Up @@ -119,7 +120,7 @@ class DistributedTreeBase
// NOTE: query() must be called as collective over all processes in the
// communicator passed to the constructor
template <typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename IndexableGetter = Experimental::DefaultIndexableGetter,
typename BoundingVolume = Box<
GeometryTraits::dimension_v<
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>>,
Expand Down
2 changes: 1 addition & 1 deletion src/spatial/ArborX_BruteForce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace ArborX
{

template <typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename IndexableGetter = Experimental::DefaultIndexableGetter,
typename BoundingVolume = Box<
GeometryTraits::dimension_v<
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>>,
Expand Down
4 changes: 2 additions & 2 deletions src/spatial/ArborX_LinearBVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct HappyTreeFriends;
} // namespace Details

template <typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename IndexableGetter = Experimental::DefaultIndexableGetter,
typename BoundingVolume = Box<
GeometryTraits::dimension_v<
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>>,
Expand Down Expand Up @@ -179,7 +179,7 @@ KOKKOS_FUNCTION
typename Details::AccessValues<Values, PrimitivesTag>::value_type>;

template <typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename IndexableGetter = Experimental::DefaultIndexableGetter,
typename BoundingVolume = Box<
GeometryTraits::dimension_v<
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>>,
Expand Down
14 changes: 12 additions & 2 deletions src/spatial/detail/ArborX_IndexableGetter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#include <detail/ArborX_AccessTraits.hpp>
#include <detail/ArborX_PairValueIndex.hpp>

namespace ArborX::Details
namespace ArborX
{

namespace Experimental
{

struct DefaultIndexableGetter
Expand Down Expand Up @@ -52,6 +55,11 @@ struct DefaultIndexableGetter
}
};

} // namespace Experimental

namespace Details
{

template <typename Values, typename IndexableGetter>
struct Indexables
{
Expand All @@ -76,6 +84,8 @@ KOKKOS_FUNCTION
#endif
Indexables(Values, IndexableGetter) -> Indexables<Values, IndexableGetter>;

} // namespace ArborX::Details
} // namespace Details

} // namespace ArborX

#endif
6 changes: 3 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost)
"using ArborX_Legacy_BVH_Box =\n"
" LegacyTree<ArborX::BoundingVolumeHierarchy<\n"
" MemorySpace, ArborX::PairValueIndex<ArborX::Box<3, float>>,\n"
" ArborX::Details::DefaultIndexableGetter, ArborX::Box<3, float>>>;\n"
" ArborX::Experimental::DefaultIndexableGetter, ArborX::Box<3, float>>>;\n"
"#define ARBORX_TEST_TREE_TYPES Tuple<ArborX_Legacy_BVH_Box>\n"
"#define ARBORX_TEST_DEVICE_TYPES std::tuple<${ARBORX_DEVICE_TYPES}>\n"
"#include <tstQueryTree${_test}.cpp>\n"
Expand All @@ -106,7 +106,7 @@ foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost)
"using ArborX_Legacy_BruteForce_Box =\n"
" LegacyTree<ArborX::BruteForce<\n"
" MemorySpace, ArborX::PairValueIndex<ArborX::Box<3, float>>,\n"
" ArborX::Details::DefaultIndexableGetter, ArborX::Box<3, float>>>;\n"
" ArborX::Experimental::DefaultIndexableGetter, ArborX::Box<3, float>>>;\n"
"#define ARBORX_TEST_TREE_TYPES Tuple<ArborX_Legacy_BruteForce_Box>\n"
"#define ARBORX_TEST_DEVICE_TYPES std::tuple<${ARBORX_DEVICE_TYPES}>\n"
"#define ARBORX_TEST_DISABLE_CALLBACK_EARLY_EXIT\n"
Expand All @@ -130,7 +130,7 @@ foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost)
"using ArborX_Legacy_BVH_${_bounding_volume} =\n"
" LegacyTree<ArborX::BoundingVolumeHierarchy<\n"
" MemorySpace, ArborX::PairValueIndex<${_bounding_volume}>,\n"
" ArborX::Details::DefaultIndexableGetter, ${_bounding_volume}>>;\n"
" ArborX::Experimental::DefaultIndexableGetter, ${_bounding_volume}>>;\n"
"#define ARBORX_TEST_TREE_TYPES Tuple<ArborX_Legacy_BVH_${_bounding_volume}>\n"
"#define ARBORX_TEST_DEVICE_TYPES std::tuple<${ARBORX_DEVICE_TYPES}>\n"
"#define ARBORX_TEST_DISABLE_NEAREST_QUERY\n"
Expand Down
7 changes: 3 additions & 4 deletions test/tstCompileOnlyTypeRequirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ void check_bounding_volume_and_predicate_geometry_type_requirements()
{
using ExecutionSpace = Kokkos::DefaultExecutionSpace;
using MemorySpace = ExecutionSpace::memory_space;
using Tree =
ArborX::BoundingVolumeHierarchy<MemorySpace, Test::PrimitivePointOrBox,
ArborX::Details::DefaultIndexableGetter,
Test::FakeBoundingVolume>;
using Tree = ArborX::BoundingVolumeHierarchy<
MemorySpace, Test::PrimitivePointOrBox,
ArborX::Experimental::DefaultIndexableGetter, Test::FakeBoundingVolume>;

Kokkos::View<Test::PrimitivePointOrBox *, MemorySpace> primitives(
"primitives", 0);
Expand Down
4 changes: 2 additions & 2 deletions test/tstDetailsTreeConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(assign_morton_codes, DeviceType,

LegacyValues<decltype(boxes), ArborX::Box<3>> values{boxes};
ArborX::Details::Indexables indexables{
values, ArborX::Details::DefaultIndexableGetter{}};
values, ArborX::Experimental::DefaultIndexableGetter{}};

// Test for a bug where missing move ref operator() in DefaultIndexableGetter
// results in a default initialized indexable used in scene box calucation.
Expand Down Expand Up @@ -171,7 +171,7 @@ void generateHierarchy(Primitives primitives, MortonCodes sorted_morton_codes,
BoundingVolume bounds;
ArborX::Details::TreeConstruction::generateHierarchy(
space, LegacyValues<Primitives, BoundingVolume>{primitives},
ArborX::Details::DefaultIndexableGetter{}, permutation_indices,
ArborX::Experimental::DefaultIndexableGetter{}, permutation_indices,
sorted_morton_codes, leaf_nodes, internal_nodes, bounds);
}

Expand Down
2 changes: 1 addition & 1 deletion test/tstIndexableGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(indexables, DeviceType, ARBORX_DEVICE_TYPES)

ArborX::Box scene_bounding_box{{-1.f, -1.f, -1.f}, {1.f, 1.f, 1.f}};

using IndexableGetter = ArborX::Details::DefaultIndexableGetter;
using IndexableGetter = ArborX::Experimental::DefaultIndexableGetter;
IndexableGetter indexable_getter;

{
Expand Down

0 comments on commit d2f6ac9

Please sign in to comment.