/**************************************************************************** * Copyright (c) 2017-2022 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 * ****************************************************************************/ #include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES #include #include #include #include #include #include "Search_UnitTestHelpers.hpp" BOOST_AUTO_TEST_CASE_TEMPLATE(intersects_kdop, DeviceType, ARBORX_DEVICE_TYPES) { using ExecutionSpace = typename DeviceType::execution_space; using MemorySpace = typename DeviceType::memory_space; using Tree = ArborX::BVH; using ArborX::Point; std::vector primitives = { {{0, 0, 0}}, // 0 {{1, 1, 1}}, // 1 {{2, 2, 2}}, // 2 {{3, 3, 3}}, // 3 {{1, 0, 0}}, // 4 {{2, 0, 0}}, // 5 {{3, 0, 0}}, // 6 {{0, 1, 0}}, // 7 {{0, 2, 0}}, // 8 {{0, 3, 0}}, // 9 {{0, 0, 1}}, // 10 {{0, 0, 2}}, // 11 {{0, 0, 3}}, // 12 }; Tree const tree( ExecutionSpace{}, Kokkos::create_mirror_view_and_copy( MemorySpace{}, Kokkos::View( primitives.data(), primitives.size()))); // (0,0,0)->(1,2,3) box with (0,0,0)--(0,0,3) edge cut off ArborX::Experimental::KDOP<3, 18> x; // bottom expand(x, ArborX::Point{0.25, 0, 0}); expand(x, ArborX::Point{1, 0, 0}); expand(x, ArborX::Point{1, 2, 0}); expand(x, ArborX::Point{0, 2, 0}); expand(x, ArborX::Point{0, 0.25, 0}); // top expand(x, ArborX::Point{0.25, 0, 3}); expand(x, ArborX::Point{1, 0, 3}); expand(x, ArborX::Point{1, 2, 3}); expand(x, ArborX::Point{0, 2, 3}); expand(x, ArborX::Point{0, 0.25, 3}); using IntersectsKDop = decltype(ArborX::intersects(x)); std::vector predicates = {ArborX::intersects(x)}; ARBORX_TEST_QUERY_TREE(ExecutionSpace{}, tree, makeIntersectsBoxQueries({}), make_reference_solution({}, {0})); ARBORX_TEST_QUERY_TREE( ExecutionSpace{}, tree, Kokkos::create_mirror_view_and_copy( MemorySpace{}, Kokkos::View( predicates.data(), predicates.size())), make_reference_solution({1, 4, 7, 8}, {0, 4})); }