From: Bruno Turcksin Date: Fri, 20 Jun 2025 20:54:29 +0000 (-0400) Subject: Restrict AccessTraits specialization to deal.II types X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c8e7aedc20118a5900a980538fb4afc73dbcc86;p=dealii.git Restrict AccessTraits specialization to deal.II types --- diff --git a/include/deal.II/arborx/access_traits.h b/include/deal.II/arborx/access_traits.h index 764d793813..9e619554b0 100644 --- a/include/deal.II/arborx/access_traits.h +++ b/include/deal.II/arborx/access_traits.h @@ -749,7 +749,16 @@ namespace ArborX * This struct allows ArborX to use std::vector as primitive. */ template - struct AccessTraits> + struct AccessTraits< + std::vector, + std::enable_if_t< + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v, float>> || + std::is_same_v, double>>>> { using memory_space = Kokkos::HostSpace; diff --git a/include/deal.II/base/bounding_box.h b/include/deal.II/base/bounding_box.h index e5d95e4774..159bee7b42 100644 --- a/include/deal.II/base/bounding_box.h +++ b/include/deal.II/base/bounding_box.h @@ -135,6 +135,12 @@ template class BoundingBox { public: + /** + * Provide a way to get the dimension of an object without explicit + * knowledge of it's data type. + */ + static constexpr unsigned int dimension = spacedim; + /** * Standard constructor. Creates an object that corresponds to an empty box, * i.e. a degenerate box with both points being the origin. diff --git a/source/arborx/access_traits.cc b/source/arborx/access_traits.cc index bead71f741..bb14cd3ec3 100644 --- a/source/arborx/access_traits.cc +++ b/source/arborx/access_traits.cc @@ -504,7 +504,17 @@ namespace ArborX # else template std::size_t - AccessTraits>::size(const std::vector &v) + AccessTraits< + std::vector, + std::enable_if_t< + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v, float>> || + std::is_same_v, double>>>>:: + size(const std::vector &v) { return v.size(); } @@ -513,7 +523,17 @@ namespace ArborX template T - AccessTraits>::get(const std::vector &v, std::size_t i) + AccessTraits< + std::vector, + std::enable_if_t< + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v, float>> || + std::is_same_v, double>>>>:: + get(const std::vector &v, std::size_t i) { return v[i]; }