From 2f317e634370c239c8bda7b64c5b458989a3b5a8 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Fri, 22 Dec 2023 18:47:47 -0500 Subject: [PATCH] Move AttachIndices to Experimental and add attach_indices --- .../brute_force_vs_bvh_timpl.hpp | 4 ++-- benchmarks/dbscan/ArborX_DBSCANVerification.hpp | 2 +- .../triangle_intersection.cpp | 3 +-- src/ArborX_DBSCAN.hpp | 5 ++--- src/details/ArborX_MinimumSpanningTree.hpp | 2 +- src/details/ArborX_PairValueIndex.hpp | 15 ++++++++++++--- .../ArborX_InterpMovingLeastSquares.hpp | 2 +- test/tstDetailsMutualReachabilityDistance.cpp | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/benchmarks/brute_force_vs_bvh/brute_force_vs_bvh_timpl.hpp b/benchmarks/brute_force_vs_bvh/brute_force_vs_bvh_timpl.hpp index e3f3b9149..5a6018651 100644 --- a/benchmarks/brute_force_vs_bvh/brute_force_vs_bvh_timpl.hpp +++ b/benchmarks/brute_force_vs_bvh/brute_force_vs_bvh_timpl.hpp @@ -91,7 +91,7 @@ static void run_fp(int nprimitives, int nqueries, int nrepeats) Kokkos::Timer timer; ArborX::BoundingVolumeHierarchy> - bvh{space, ArborX::AttachIndices{primitives}}; + bvh{space, ArborX::Experimental::attach_indices(primitives)}; Kokkos::View indices("Benchmark::indices_ref", 0); Kokkos::View offset("Benchmark::offset_ref", 0); @@ -110,7 +110,7 @@ static void run_fp(int nprimitives, int nqueries, int nrepeats) { Kokkos::Timer timer; ArborX::BruteForce> brute{ - space, ArborX::AttachIndices{primitives}}; + space, ArborX::Experimental::attach_indices(primitives)}; Kokkos::View indices("Benchmark::indices", 0); Kokkos::View offset("Benchmark::offset", 0); diff --git a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp index a23a272d3..6fc52868c 100644 --- a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp +++ b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp @@ -312,7 +312,7 @@ bool verifyDBSCAN(ExecutionSpace exec_space, Primitives const &primitives, static_assert(GeometryTraits::is_point{}); ArborX::BoundingVolumeHierarchy> - bvh(exec_space, ArborX::AttachIndices{points}); + bvh(exec_space, ArborX::Experimental::attach_indices(points)); auto const predicates = Details::PrimitivesWithRadius{points, eps}; diff --git a/examples/triangle_intersection/triangle_intersection.cpp b/examples/triangle_intersection/triangle_intersection.cpp index 6b65f5c42..30b7fdba1 100644 --- a/examples/triangle_intersection/triangle_intersection.cpp +++ b/examples/triangle_intersection/triangle_intersection.cpp @@ -323,8 +323,7 @@ int main() // Create BVH tree ArborX::BoundingVolumeHierarchy> const - tree(execution_space, - ArborX::AttachIndices{triangles}); + tree(execution_space, ArborX::Experimental::attach_indices(triangles)); // Create the points used for queries Points points(execution_space); diff --git a/src/ArborX_DBSCAN.hpp b/src/ArborX_DBSCAN.hpp index 0ab5faf66..a76f8d63d 100644 --- a/src/ArborX_DBSCAN.hpp +++ b/src/ArborX_DBSCAN.hpp @@ -279,7 +279,7 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, // Build the tree Kokkos::Profiling::pushRegion("ArborX::DBSCAN::tree_construction"); BoundingVolumeHierarchy> bvh( - exec_space, AttachIndices{points}); + exec_space, Experimental::attach_indices(points)); Kokkos::Profiling::popRegion(); // Initialize labels after the hierarchy construction to lower memory high @@ -421,8 +421,7 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, permute}; BoundingVolumeHierarchy> bvh( - exec_space, - AttachIndices{mixed_primitives}); + exec_space, Experimental::attach_indices(mixed_primitives)); Kokkos::Profiling::popRegion(); diff --git a/src/details/ArborX_MinimumSpanningTree.hpp b/src/details/ArborX_MinimumSpanningTree.hpp index 8fab5dc90..aedee5f04 100644 --- a/src/details/ArborX_MinimumSpanningTree.hpp +++ b/src/details/ArborX_MinimumSpanningTree.hpp @@ -58,7 +58,7 @@ struct MinimumSpanningTree Kokkos::Profiling::pushRegion("ArborX::MST::construction"); BoundingVolumeHierarchy> bvh( - space, AttachIndices{points}); + space, Experimental::attach_indices(points)); Kokkos::Profiling::popRegion(); if (k > 1) diff --git a/src/details/ArborX_PairValueIndex.hpp b/src/details/ArborX_PairValueIndex.hpp index 88e205ae3..65d074096 100644 --- a/src/details/ArborX_PairValueIndex.hpp +++ b/src/details/ArborX_PairValueIndex.hpp @@ -31,7 +31,9 @@ struct PairValueIndex Index index; }; -template +namespace Experimental +{ +template class AttachIndices { private: @@ -54,13 +56,20 @@ class AttachIndices auto size() const { return _data.size(); } }; +template +auto attach_indices(Values const &values) +{ + return AttachIndices{values}; +} +} // namespace Experimental + } // namespace ArborX template -struct ArborX::AccessTraits, +struct ArborX::AccessTraits, ArborX::PrimitivesTag> { - using Self = ArborX::AttachIndices; + using Self = ArborX::Experimental::AttachIndices; using memory_space = typename Self::memory_space; diff --git a/src/interpolation/ArborX_InterpMovingLeastSquares.hpp b/src/interpolation/ArborX_InterpMovingLeastSquares.hpp index 9bd1ecda4..6ac8dacdd 100644 --- a/src/interpolation/ArborX_InterpMovingLeastSquares.hpp +++ b/src/interpolation/ArborX_InterpMovingLeastSquares.hpp @@ -130,7 +130,7 @@ class MovingLeastSquares // Organize the source points as a tree BoundingVolumeHierarchy> - source_tree(space, ArborX::AttachIndices{source_points}); + source_tree(space, ArborX::Experimental::attach_indices(source_points)); // Create the predicates Details::MLSTargetPointsPredicateWrapper predicates{ diff --git a/test/tstDetailsMutualReachabilityDistance.cpp b/test/tstDetailsMutualReachabilityDistance.cpp index 1b3458250..486d710db 100644 --- a/test/tstDetailsMutualReachabilityDistance.cpp +++ b/test/tstDetailsMutualReachabilityDistance.cpp @@ -34,7 +34,7 @@ auto compute_core_distances(ExecutionSpace exec_space, using MemorySpace = typename ExecutionSpace::memory_space; ArborX::BoundingVolumeHierarchy> - bvh{exec_space, ArborX::AttachIndices{points}}; + bvh{exec_space, ArborX::Experimental::attach_indices(points)}; Kokkos::View distances( Kokkos::view_alloc(Kokkos::WithoutInitializing, "Test::core_distances"), bvh.size());