From d45022849a9f7d6ececced563e3d6bbad9103ff8 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Mon, 3 Feb 2025 22:52:11 -0500 Subject: [PATCH 1/3] Revert "Remove is_pair_v" This reverts commit 1492fdfbdbafe0d0694ff675422ee164bc58a75b. --- src/spatial/detail/ArborX_PairValueIndex.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/spatial/detail/ArborX_PairValueIndex.hpp b/src/spatial/detail/ArborX_PairValueIndex.hpp index 22ab2899c..13e244ff5 100644 --- a/src/spatial/detail/ArborX_PairValueIndex.hpp +++ b/src/spatial/detail/ArborX_PairValueIndex.hpp @@ -31,6 +31,21 @@ struct PairValueIndex Index index; }; +namespace Details +{ +template +struct is_pair_value_index : public std::false_type +{}; + +template +struct is_pair_value_index> : public std::true_type +{}; + +template +inline constexpr bool is_pair_value_index_v = is_pair_value_index::value; + +} // namespace Details + } // namespace ArborX #endif From ca28148186feb83c185595af1540489430425f4a Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Mon, 3 Feb 2025 22:52:40 -0500 Subject: [PATCH 2/3] Remove requirement on knowing geometry types in IndexableGetter --- src/spatial/detail/ArborX_IndexableGetter.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/spatial/detail/ArborX_IndexableGetter.hpp b/src/spatial/detail/ArborX_IndexableGetter.hpp index 9a660abcf..17067ad85 100644 --- a/src/spatial/detail/ArborX_IndexableGetter.hpp +++ b/src/spatial/detail/ArborX_IndexableGetter.hpp @@ -27,29 +27,30 @@ struct DefaultIndexableGetter KOKKOS_DEFAULTED_FUNCTION DefaultIndexableGetter() = default; - template >> + template KOKKOS_FUNCTION auto const &operator()(Geometry const &geometry) const { return geometry; } - template >> + template >>> KOKKOS_FUNCTION auto operator()(Geometry &&geometry) const { return geometry; } - template - KOKKOS_FUNCTION Value const & - operator()(PairValueIndex const &pair) const + template + KOKKOS_FUNCTION Geometry const & + operator()(PairValueIndex const &pair) const { return pair.value; } - template - KOKKOS_FUNCTION Value operator()(PairValueIndex &&pair) const + template + KOKKOS_FUNCTION Geometry + operator()(PairValueIndex &&pair) const { return pair.value; } From 6ffdcf2732edbca2b1e9cbf40e58d9f7ee443ba7 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Wed, 5 Feb 2025 10:34:25 -0500 Subject: [PATCH 3/3] Add compile-only test for bvh on custom type Co-authored-by: Damien L-G --- test/tstCompileOnlyTypeRequirements.cpp | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/tstCompileOnlyTypeRequirements.cpp b/test/tstCompileOnlyTypeRequirements.cpp index 205da644f..35e0375c7 100644 --- a/test/tstCompileOnlyTypeRequirements.cpp +++ b/test/tstCompileOnlyTypeRequirements.cpp @@ -91,3 +91,37 @@ void check_bounding_volume_and_predicate_geometry_type_requirements() KOKKOS_LAMBDA(NearestPredicate, auto){}); #endif } + +namespace Test +{ + +// clang-format off +struct FakePrimitiveGeometry {}; + +KOKKOS_FUNCTION void expand(ArborX::Box<3> &, FakePrimitiveGeometry) {} +KOKKOS_FUNCTION ArborX::Point<3> returnCentroid(FakePrimitiveGeometry) { return {}; } +// clang-format on + +} // 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_hierarchy_for_custom_types() +{ + using ExecutionSpace = Kokkos::DefaultExecutionSpace; + using MemorySpace = ExecutionSpace::memory_space; + + Kokkos::View primitives( + "primitives", 0); + ArborX::BoundingVolumeHierarchy tree(ExecutionSpace{}, primitives); +}