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 51d66f1ea..7fe63d569 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 @@ -83,6 +83,7 @@ static void run_fp(int nprimitives, int nqueries, int nrepeats) Placeholder primitives{nprimitives}; Placeholder predicates{nqueries}; + using Point = ArborX::ExperimentalHyperGeometry::Point; using Box = ArborX::ExperimentalHyperGeometry::Box; for (int i = 0; i < nrepeats; i++) @@ -91,8 +92,9 @@ static void run_fp(int nprimitives, int nqueries, int nrepeats) { Kokkos::Timer timer; ArborX::BasicBoundingVolumeHierarchy< - MemorySpace, ArborX::Details::PairIndexVolume> - bvh{space, primitives}; + MemorySpace, ArborX::Details::PairIndexVolume> + bvh{space, ArborX::Details::LegacyValues{ + primitives}}; Kokkos::View indices("Benchmark::indices_ref", 0); Kokkos::View offset("Benchmark::offset_ref", 0); diff --git a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp index 8b3879487..e87515da3 100644 --- a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp +++ b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp @@ -302,12 +302,14 @@ bool verifyDBSCAN(ExecutionSpace exec_space, Primitives const &primitives, ARBORX_ASSERT(eps > 0); ARBORX_ASSERT(core_min_size >= 2); - constexpr int dim = GeometryTraits::dimension_v< - typename Details::AccessTraitsHelper::type>; + using Point = typename Details::AccessTraitsHelper::type; + static_assert(GeometryTraits::is_point{}); + constexpr int dim = GeometryTraits::dimension_v; using Box = ExperimentalHyperGeometry::Box; ArborX::BasicBoundingVolumeHierarchy> - bvh(exec_space, primitives); + bvh(exec_space, + ArborX::Details::LegacyValues{primitives}); auto const predicates = Details::PrimitivesWithRadius{primitives, eps}; diff --git a/examples/triangle_intersection/triangle_intersection.cpp b/examples/triangle_intersection/triangle_intersection.cpp index 008f923f7..690521b76 100644 --- a/examples/triangle_intersection/triangle_intersection.cpp +++ b/examples/triangle_intersection/triangle_intersection.cpp @@ -36,6 +36,7 @@ constexpr float hx = Lx / (nx - 1); constexpr float hy = Ly / (ny - 1); using Point = ArborX::ExperimentalHyperGeometry::Point<2>; +using Box = ArborX::ExperimentalHyperGeometry::Box<2>; using Triangle = ArborX::ExperimentalHyperGeometry::Triangle<2>; #ifdef PRECOMPUTE_MAPPING @@ -319,9 +320,9 @@ int main() // Create BVH tree ArborX::BasicBoundingVolumeHierarchy< - MemorySpace, ArborX::Details::PairIndexVolume< - ArborX::ExperimentalHyperGeometry::Box<2>>> const - tree(execution_space, triangles); + MemorySpace, ArborX::Details::PairIndexVolume> const + tree(execution_space, + ArborX::Details::LegacyValues{triangles}); // Create the points used for queries Points points(execution_space); diff --git a/src/ArborX_BruteForce.hpp b/src/ArborX_BruteForce.hpp index ab020ec1b..b621daa27 100644 --- a/src/ArborX_BruteForce.hpp +++ b/src/ArborX_BruteForce.hpp @@ -91,7 +91,9 @@ BruteForce::BruteForce( { static_assert( KokkosExt::is_accessible_from::value); - Details::check_valid_access_traits(PrimitivesTag{}, primitives); + // FIXME for now, do not check the return type of get() + Details::check_valid_access_traits( + PrimitivesTag{}, primitives, Details::DoNotCheckGetReturnType()); using Access = AccessTraits; static_assert(KokkosExt::is_accessible_from::value, diff --git a/src/ArborX_DBSCAN.hpp b/src/ArborX_DBSCAN.hpp index b80944e88..c9bc48961 100644 --- a/src/ArborX_DBSCAN.hpp +++ b/src/ArborX_DBSCAN.hpp @@ -60,15 +60,14 @@ struct WithinRadiusGetter { float _r; - template - KOKKOS_FUNCTION auto operator()(Box const &box) const + template + KOKKOS_FUNCTION auto operator()(Point const &point) const { - static_assert(GeometryTraits::is_box::value); + static_assert(GeometryTraits::is_point::value); - constexpr int dim = GeometryTraits::dimension_v; + constexpr int dim = GeometryTraits::dimension_v; auto const &hyper_point = - reinterpret_cast const &>( - box.minCorner()); + reinterpret_cast const &>(point); using ArborX::intersects; return intersects(ExperimentalHyperGeometry::Sphere{hyper_point, _r}); } @@ -98,6 +97,22 @@ struct MixedBoxPrimitives Permutation _permute; }; +template +struct PrimitivesIndexables +{ + Primitives _primitives; + + using Access = AccessTraits; + using memory_space = typename Access::memory_space; + + KOKKOS_FUNCTION decltype(auto) operator()(int i) const + { + return Access::get(_primitives, i); + } + + KOKKOS_FUNCTION auto size() const { return Access::size(_primitives); } +}; + } // namespace Details template @@ -266,8 +281,9 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, using UnionFind = Details::UnionFind; #endif - constexpr int dim = GeometryTraits::dimension_v< - typename Details::AccessTraitsHelper::type>; + using Point = typename Details::AccessTraitsHelper::type; + static_assert(GeometryTraits::is_point{}); + constexpr int dim = GeometryTraits::dimension_v; using Box = ExperimentalHyperGeometry::Box; bool const is_special_case = (core_min_size == 2); @@ -290,8 +306,8 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, // Build the tree Kokkos::Profiling::pushRegion("ArborX::DBSCAN::tree_construction"); ArborX::BasicBoundingVolumeHierarchy> - bvh(exec_space, primitives); + Details::PairIndexVolume> + bvh(exec_space, Details::LegacyValues{primitives}); Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion("ArborX::DBSCAN::clusters"); @@ -352,7 +368,8 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, Kokkos::Profiling::pushRegion("ArborX::DBSCAN::dense_cells"); Box bounds; Details::TreeConstruction::calculateBoundingBoxOfTheScene( - exec_space, Details::Indexables{primitives}, bounds); + exec_space, Details::PrimitivesIndexables{primitives}, + 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. @@ -411,14 +428,16 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, // Build the tree Kokkos::Profiling::pushRegion("ArborX::DBSCAN::tree_construction"); + Details::MixedBoxPrimitives + mixed_primitives{primitives, grid, + dense_cell_offsets, num_points_in_dense_cells, + sorted_cell_indices, permute}; + ArborX::BasicBoundingVolumeHierarchy> - bvh(exec_space, - Details::MixedBoxPrimitives< - Primitives, decltype(dense_cell_offsets), - decltype(cell_indices), decltype(permute)>{ - primitives, grid, dense_cell_offsets, num_points_in_dense_cells, - sorted_cell_indices, permute}); + bvh(exec_space, Details::LegacyValues{ + mixed_primitives}); Kokkos::Profiling::popRegion(); diff --git a/src/ArborX_LinearBVH.hpp b/src/ArborX_LinearBVH.hpp index de148d632..7e93d46e9 100644 --- a/src/ArborX_LinearBVH.hpp +++ b/src/ArborX_LinearBVH.hpp @@ -61,10 +61,11 @@ class BasicBoundingVolumeHierarchy BasicBoundingVolumeHierarchy() = default; // build an empty tree - template BasicBoundingVolumeHierarchy( - ExecutionSpace const &space, Primitives const &primitives, + ExecutionSpace const &space, Values const &values, + IndexableGetter const &indexable_getter = IndexableGetter(), SpaceFillingCurve const &curve = SpaceFillingCurve()); KOKKOS_FUNCTION @@ -131,6 +132,8 @@ class BoundingVolumeHierarchy public: using legacy_tree = void; + using bounding_volume_type = typename base_type::bounding_volume_type; + BoundingVolumeHierarchy() = default; // build an empty tree template { + primitives}), + Details::DefaultIndexableGetter(), curve) {} template @@ -170,28 +179,32 @@ using BVH = BoundingVolumeHierarchy; template -template +template BasicBoundingVolumeHierarchy:: BasicBoundingVolumeHierarchy(ExecutionSpace const &space, - Primitives const &primitives, + Values const &user_values, + IndexableGetter const &indexable_getter, SpaceFillingCurve const &curve) - : _size(AccessTraits::size(primitives)) + : _size(AccessTraits::size(user_values)) , _leaf_nodes(Kokkos::view_alloc(space, Kokkos::WithoutInitializing, "ArborX::BVH::leaf_nodes"), _size) , _internal_nodes(Kokkos::view_alloc(space, Kokkos::WithoutInitializing, "ArborX::BVH::internal_nodes"), _size > 1 ? _size - 1 : 0) + , _indexable_getter(indexable_getter) { static_assert( KokkosExt::is_accessible_from::value); - Details::check_valid_access_traits(PrimitivesTag{}, primitives); - using Access = AccessTraits; + // FIXME redo with RangeTraits + Details::check_valid_access_traits( + PrimitivesTag{}, user_values, Details::DoNotCheckGetReturnType()); + using Access = AccessTraits; static_assert(KokkosExt::is_accessible_from::value, - "Primitives must be accessible from the execution space"); + "Values must be accessible from the execution space"); + constexpr int DIM = GeometryTraits::dimension_v; Details::check_valid_space_filling_curve(curve); @@ -203,14 +216,18 @@ BasicBoundingVolumeHierarchy values{user_values}; + if (size() == 1) { Details::TreeConstruction::initializeSingleLeafTree( - space, Details::LegacyValues{primitives}, - _indexable_getter, _leaf_nodes, _bounds); + space, values, _indexable_getter, _leaf_nodes, _bounds); return; } + Details::Indexables indexables{ + values, indexable_getter}; + Kokkos::Profiling::pushRegion( "ArborX::BVH::BVH::calculate_scene_bounding_box"); @@ -218,24 +235,21 @@ BasicBoundingVolumeHierarchy::type> bbox{}; - Details::TreeConstruction::calculateBoundingBoxOfTheScene( - space, Details::Indexables{primitives}, bbox); - + Details::TreeConstruction::calculateBoundingBoxOfTheScene(space, indexables, + bbox); Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion("ArborX::BVH::BVH::compute_linear_ordering"); // Map indexables from multidimensional domain to one-dimensional interval using LinearOrderingValueType = Kokkos::detected_t< Details::SpaceFillingCurveProjectionArchetypeExpression, - SpaceFillingCurve, decltype(bbox), - std::decay_t>; + SpaceFillingCurve, decltype(bbox), indexable_type>; Kokkos::View linear_ordering_indices( Kokkos::view_alloc(space, Kokkos::WithoutInitializing, "ArborX::BVH::BVH::linear_ordering"), size()); Details::TreeConstruction::projectOntoSpaceFillingCurve( - space, Details::Indexables{primitives}, curve, bbox, - linear_ordering_indices); + space, indexables, curve, bbox, linear_ordering_indices); Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion("ArborX::BVH::BVH::sort_linearized_order"); @@ -249,9 +263,8 @@ BasicBoundingVolumeHierarchy{primitives}, - _indexable_getter, permutation_indices, linear_ordering_indices, - _leaf_nodes, _internal_nodes, _bounds); + space, values, _indexable_getter, permutation_indices, + linear_ordering_indices, _leaf_nodes, _internal_nodes, _bounds); Kokkos::Profiling::popRegion(); } diff --git a/src/details/ArborX_AccessTraits.hpp b/src/details/ArborX_AccessTraits.hpp index 745b72a3c..bafb1caed 100644 --- a/src/details/ArborX_AccessTraits.hpp +++ b/src/details/ArborX_AccessTraits.hpp @@ -153,8 +153,12 @@ void check_valid_access_traits(PredicatesTag, Predicates const &) "Invalid tag for the predicates"); } -template -void check_valid_access_traits(PrimitivesTag, Primitives const &) +struct DoNotCheckGetReturnType : std::false_type +{}; + +template +void check_valid_access_traits(PrimitivesTag, Primitives const &, + CheckGetReturnType = {}) { using Access = AccessTraits; static_assert( @@ -187,11 +191,32 @@ void check_valid_access_traits(PrimitivesTag, Primitives const &) "member function"); using T = std::decay_t>; - static_assert(GeometryTraits::is_point{} || GeometryTraits::is_box{}, - "AccessTraits::get() return type " - "must decay to a point or a box type"); + if constexpr (CheckGetReturnType()) + { + static_assert(GeometryTraits::is_point{} || GeometryTraits::is_box{}, + "AccessTraits::get() return type " + "must decay to a point or a box type"); + } } +template +class AccessValues +{ +private: + using Access = AccessTraits; + +public: + Values _values; + + using memory_space = typename Access::memory_space; + + KOKKOS_FUNCTION + decltype(auto) operator()(int i) const { return Access::get(_values, i); } + + KOKKOS_FUNCTION + auto size() const { return Access::size(_values); } +}; + } // namespace Details namespace Traits diff --git a/src/details/ArborX_DetailsLegacy.hpp b/src/details/ArborX_DetailsLegacy.hpp index 370dedb1b..e5dc0e6f1 100644 --- a/src/details/ArborX_DetailsLegacy.hpp +++ b/src/details/ArborX_DetailsLegacy.hpp @@ -36,7 +36,7 @@ class LegacyValues {} KOKKOS_FUNCTION - decltype(auto) operator()(size_type i) const + auto operator()(size_type i) const { if constexpr (std::is_same_v::type>) @@ -70,4 +70,25 @@ struct LegacyCallbackWrapper } // namespace ArborX::Details +template +struct ArborX::AccessTraits< + ArborX::Details::LegacyValues, + ArborX::PrimitivesTag> +{ + using Values = ArborX::Details::LegacyValues; + + using memory_space = typename Values::memory_space; + using size_type = typename Values::size_type; + using value_type = typename Values::value_type; + + KOKKOS_FUNCTION static size_type size(Values const &values) + { + return values.size(); + } + KOKKOS_FUNCTION static decltype(auto) get(Values const &values, size_type i) + { + return values(i); + } +}; + #endif diff --git a/src/details/ArborX_IndexableGetter.hpp b/src/details/ArborX_IndexableGetter.hpp index 829b43046..d109ba655 100644 --- a/src/details/ArborX_IndexableGetter.hpp +++ b/src/details/ArborX_IndexableGetter.hpp @@ -24,9 +24,9 @@ struct DefaultIndexableGetter KOKKOS_DEFAULTED_FUNCTION DefaultIndexableGetter() = default; - template {} || - GeometryTraits::is_box{}>> + template {} || + GeometryTraits::is_box{}>> KOKKOS_FUNCTION auto const &operator()(Geometry const &geometry) const { return geometry; @@ -38,21 +38,28 @@ struct DefaultIndexableGetter { return pair.bounding_volume; } + + template + KOKKOS_FUNCTION Geometry operator()(PairIndexVolume &&pair) const + { + return pair.bounding_volume; + } }; -template +template struct Indexables { - Primitives _primitives; - using Access = AccessTraits; - using memory_space = typename Access::memory_space; + Values _values; + IndexableGetter _indexable_getter; + + using memory_space = typename Values::memory_space; KOKKOS_FUNCTION decltype(auto) operator()(int i) const { - return Access::get(_primitives, i); + return _indexable_getter(_values(i)); } - KOKKOS_FUNCTION auto size() const { return Access::size(_primitives); } + KOKKOS_FUNCTION auto size() const { return _values.size(); } }; } // namespace ArborX::Details diff --git a/src/details/ArborX_MinimumSpanningTree.hpp b/src/details/ArborX_MinimumSpanningTree.hpp index 24afcba81..007fb77a8 100644 --- a/src/details/ArborX_MinimumSpanningTree.hpp +++ b/src/details/ArborX_MinimumSpanningTree.hpp @@ -709,15 +709,13 @@ struct MinimumSpanningTree Kokkos::Profiling::pushRegion("ArborX::MST::MST"); using Access = AccessTraits; - constexpr int dim = GeometryTraits::dimension_v< - typename Details::AccessTraitsHelper::type>; - using Box = ExperimentalHyperGeometry::Box; + using Point = typename AccessTraitsHelper::type; auto const n = AccessTraits::size(primitives); Kokkos::Profiling::pushRegion("ArborX::MST::construction"); - BasicBoundingVolumeHierarchy> bvh( - space, primitives); + BasicBoundingVolumeHierarchy> bvh( + space, Details::LegacyValues{primitives}); Kokkos::Profiling::popRegion(); if (k > 1) diff --git a/test/ArborXTest_LegacyTree.hpp b/test/ArborXTest_LegacyTree.hpp new file mode 100644 index 000000000..a18bf8461 --- /dev/null +++ b/test/ArborXTest_LegacyTree.hpp @@ -0,0 +1,32 @@ +/**************************************************************************** + * Copyright (c) 2023 by the ArborX authors * + * All rights reserved. * + * * + * This file is part of the ArborX library. ArborX is * + * distributed under a BSD 3-clause license. For the licensing terms see * + * the LICENSE file in the top-level directory. * + * * + * SPDX-License-Identifier: BSD-3-Clause * + ****************************************************************************/ + +#ifndef ARBORX_TEST_LEGACY_TREE_HPP +#define ARBORX_TEST_LEGACY_TREE_HPP + +#include + +template +class LegacyTree : public Tree +{ +public: + LegacyTree() = default; + + template + LegacyTree(ExecutionSpace const &space, Primitives const &primitives) + : Tree(space, + ArborX::Details::LegacyValues{ + primitives}) + {} +}; + +#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 85dbc5dfa..8f9415750 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -77,7 +77,13 @@ set(ARBORX_TEST_QUERY_TREE_SOURCES) foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/tstQueryTree${_test}_BVH.cpp.tmp" "#include \n" - "#define ARBORX_TEST_TREE_TYPES Tuple\n" + "#include \"ArborXTest_LegacyTree.hpp\"\n" + "template \n" + "using ArborX_Legacy_BasicBVH_Box =\n" + " LegacyTree,\n" + " ArborX::Details::DefaultIndexableGetter, ArborX::Box>>;\n" + "#define ARBORX_TEST_TREE_TYPES Tuple\n" "#define ARBORX_TEST_DEVICE_TYPES std::tuple<${ARBORX_DEVICE_TYPES}>\n" "#include \n" ) @@ -105,12 +111,17 @@ foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/tstQueryTree${_test}_BVH_${_bounding_volume}.cpp.tmp" "#include \n" "#include \n" + "#include \"ArborXTest_LegacyTree.hpp\"\n" "using KDOP6 = ArborX::Experimental::KDOP<6>;\n" "using KDOP14 = ArborX::Experimental::KDOP<14>;\n" "using KDOP18 = ArborX::Experimental::KDOP<18>;\n" "using KDOP26 = ArborX::Experimental::KDOP<26>;\n" - "template using ArborX__BoundingVolumeHierarchy_${_bounding_volume} = ArborX::BasicBoundingVolumeHierarchy, ArborX::Details::DefaultIndexableGetter, ${_bounding_volume}>;\n" - "#define ARBORX_TEST_TREE_TYPES Tuple\n" + "template \n" + "using ArborX_Legacy_BasicBVH_${_bounding_volume} =\n" + " LegacyTree,\n" + " ArborX::Details::DefaultIndexableGetter, ${_bounding_volume}>>;\n" + "#define ARBORX_TEST_TREE_TYPES Tuple\n" "#define ARBORX_TEST_DEVICE_TYPES std::tuple<${ARBORX_DEVICE_TYPES}>\n" "#define ARBORX_TEST_DISABLE_NEAREST_QUERY\n" "#define ARBORX_TEST_DISABLE_SPATIAL_QUERY_INTERSECTS_SPHERE\n" @@ -123,6 +134,8 @@ foreach(_test Callbacks Degenerate ManufacturedSolution ComparisonWithBoost) list(APPEND ARBORX_TEST_QUERY_TREE_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/tstQueryTree${_test}_BVH_${_bounding_volume}.cpp") endforeach() endforeach() + + list(APPEND ARBORX_TEST_QUERY_TREE_SOURCES tstQueryTreeRay.cpp tstQueryTreeTraversalPolicy.cpp diff --git a/test/tstCompileOnlyTypeRequirements.cpp b/test/tstCompileOnlyTypeRequirements.cpp index 52bd382fc..53348c495 100644 --- a/test/tstCompileOnlyTypeRequirements.cpp +++ b/test/tstCompileOnlyTypeRequirements.cpp @@ -34,6 +34,8 @@ struct FakePredicateGeometry {}; KOKKOS_FUNCTION ArborX::Point returnCentroid(FakePredicateGeometry) { return {}; } KOKKOS_FUNCTION bool intersects(FakePredicateGeometry, FakeBoundingVolume) { return true; } KOKKOS_FUNCTION float distance(FakePredicateGeometry, FakeBoundingVolume) { return 0.f; } +KOKKOS_FUNCTION bool intersects(FakePredicateGeometry, PrimitivePointOrBox) { return true; } +KOKKOS_FUNCTION float distance(FakePredicateGeometry, PrimitivePointOrBox) { return 0.f; } // clang-format on struct PoorManLambda @@ -61,7 +63,7 @@ void check_bounding_volume_and_predicate_geometry_type_requirements() using ExecutionSpace = Kokkos::DefaultExecutionSpace; using MemorySpace = ExecutionSpace::memory_space; using Tree = ArborX::BasicBoundingVolumeHierarchy< - MemorySpace, ArborX::Details::PairIndexVolume, + MemorySpace, Test::PrimitivePointOrBox, ArborX::Details::DefaultIndexableGetter, Test::FakeBoundingVolume>; Kokkos::View primitives( diff --git a/test/tstDetailsMutualReachabilityDistance.cpp b/test/tstDetailsMutualReachabilityDistance.cpp index 25ef1cbc8..e18df4531 100644 --- a/test/tstDetailsMutualReachabilityDistance.cpp +++ b/test/tstDetailsMutualReachabilityDistance.cpp @@ -33,8 +33,10 @@ auto compute_core_distances(ExecutionSpace exec_space, ARBORX_ASSERT(points.extent_int(0) >= k); using MemorySpace = typename ExecutionSpace::memory_space; ArborX::BasicBoundingVolumeHierarchy< - MemorySpace, ArborX::Details::PairIndexVolume> - bvh{exec_space, points}; + MemorySpace, ArborX::Details::PairIndexVolume> + bvh{exec_space, + ArborX::Details::LegacyValues{ + points}}; Kokkos::View distances( Kokkos::view_alloc(Kokkos::WithoutInitializing, "Test::core_distances"), bvh.size()); diff --git a/test/tstDetailsTreeConstruction.cpp b/test/tstDetailsTreeConstruction.cpp index 80c388d84..16331e5af 100644 --- a/test/tstDetailsTreeConstruction.cpp +++ b/test/tstDetailsTreeConstruction.cpp @@ -79,6 +79,19 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(assign_morton_codes, DeviceType, BOOST_TEST(ArborX::Details::equals( scene_host, {{{0.0, 0.0, 0.0}}, {{(float)N, (float)N, (float)N}}})); + ArborX::Details::LegacyValues values{boxes}; + ArborX::Details::Indexables + indexables{values, ArborX::Details::DefaultIndexableGetter{}}; + + // Test for a bug where missing move ref operator() in DefaultIndexableGetter + // results in a default initialized indexable used in scene box calucation. + scene_host = ArborX::Box{}; + ArborX::Details::TreeConstruction::calculateBoundingBoxOfTheScene( + space, indexables, scene_host); + BOOST_TEST(ArborX::Details::equals( + scene_host, {{{0.0, 0.0, 0.0}}, {{(float)N, (float)N, (float)N}}})); + Kokkos::View morton_codes("morton_codes", n); ArborX::Details::TreeConstruction::projectOntoSpaceFillingCurve( diff --git a/test/tstQueryTreeDegenerate.cpp b/test/tstQueryTreeDegenerate.cpp index 416a1b137..15e1fd1a4 100644 --- a/test/tstQueryTreeDegenerate.cpp +++ b/test/tstQueryTreeDegenerate.cpp @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(not_exceeding_stack_capacity_spatial_predicate, TreeTypeTraits, TreeTypeTraitsList) { // FIXME This unit test might make little sense for other trees than BVH - // using Tree = typename TreeTypeTraits::type; + using Tree = typename TreeTypeTraits::type; using ExecutionSpace = typename TreeTypeTraits::execution_space; using DeviceType = typename TreeTypeTraits::device_type; @@ -355,8 +355,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(not_exceeding_stack_capacity_spatial_predicate, boxes.push_back({{{a, a, a}}, {{b, b, b}}}); } ExecutionSpace space; - auto const bvh = - make>(space, boxes); + auto const bvh = make(space, boxes); Kokkos::View indices("indices", 0); Kokkos::View offset("offset", 0); @@ -375,7 +374,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(not_exceeding_stack_capacity_nearest_predicate, TreeTypeTraits, TreeTypeTraitsList) { // FIXME This unit test might make little sense for other trees than BVH - // using Tree = typename TreeTypeTraits::type; + using Tree = typename TreeTypeTraits::type; using ExecutionSpace = typename TreeTypeTraits::execution_space; using DeviceType = typename TreeTypeTraits::device_type; @@ -389,8 +388,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(not_exceeding_stack_capacity_nearest_predicate, boxes.push_back({{{a, a, a}}, {{b, b, b}}}); } ExecutionSpace space; - auto const bvh = - make>(space, boxes); + auto const bvh = make(space, boxes); Kokkos::View indices("indices", 0); Kokkos::View offset("offset", 0);