/**************************************************************************** * 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 #include #include #include namespace Test { // NOTE only supporting Point and Box using PrimitivePointOrBox = ArborX::Point; // using PrimitivePointOrBox = ArborX::Box; // clang-format off struct FakeBoundingVolume { }; KOKKOS_FUNCTION void expand(FakeBoundingVolume, FakeBoundingVolume) {} KOKKOS_FUNCTION void expand(FakeBoundingVolume, PrimitivePointOrBox) {} template KOKKOS_FUNCTION void expand(ArborX::ExperimentalHyperGeometry::Box &, FakeBoundingVolume) { } 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 { template KOKKOS_FUNCTION void operator()(Predicate, Value) const {} }; } // namespace Test template <> struct ArborX::GeometryTraits::dimension { static constexpr int value = 3; }; template <> struct ArborX::GeometryTraits::coordinate_type { using type = float; }; // Compile-only void check_bounding_volume_and_predicate_geometry_type_requirements() { using ExecutionSpace = Kokkos::DefaultExecutionSpace; using MemorySpace = ExecutionSpace::memory_space; using Tree = ArborX::BoundingVolumeHierarchy; Kokkos::View primitives( "primitives", 0); Tree tree(ExecutionSpace{}, primitives); using SpatialPredicate = decltype(ArborX::intersects(Test::FakePredicateGeometry{})); Kokkos::View spatial_predicates( "spatial_predicates", 0); tree.query(ExecutionSpace{}, spatial_predicates, Test::PoorManLambda{}); #ifndef __NVCC__ tree.query(ExecutionSpace{}, spatial_predicates, KOKKOS_LAMBDA(SpatialPredicate, auto){}); #endif using NearestPredicate = decltype(ArborX::nearest(Test::FakePredicateGeometry{})); Kokkos::View nearest_predicates( "nearest_predicates", 0); tree.query(ExecutionSpace{}, nearest_predicates, Test::PoorManLambda{}); #ifndef __NVCC__ tree.query(ExecutionSpace{}, nearest_predicates, KOKKOS_LAMBDA(NearestPredicate, auto){}); #endif }