From a94a72efe6558ecfb989bbcf6578a68c5053cdf3 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Thu, 19 Jun 2025 15:59:32 -0400 Subject: [PATCH] Introduce to_arborx_point function --- include/deal.II/arborx/access_traits.h | 51 ++++++++------------------ 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/include/deal.II/arborx/access_traits.h b/include/deal.II/arborx/access_traits.h index 9ba7212d3a..3f5410e61d 100644 --- a/include/deal.II/arborx/access_traits.h +++ b/include/deal.II/arborx/access_traits.h @@ -312,23 +312,32 @@ namespace ArborXWrappers { template ArborX::Point - operator()(const ArborX::PairValueIndex, - unsigned int> &pair) const + to_arborx_point(const dealii::Point &p) const { if constexpr (dim == 1) { - return {pair.value[0]}; + return {p[0]}; } + if constexpr (dim == 2) { - return {pair.value[0], pair.value[1]}; + return {p[0], p[1]}; } + if constexpr (dim == 3) { - return {pair.value[0], pair.value[1], pair.value[2]}; + return {p[0], p[1], p[2]}; } } + template + ArborX::Point + operator()(const ArborX::PairValueIndex, + unsigned int> &pair) const + { + return to_arborx_point(pair.value); + } + template @@ -339,20 +348,7 @@ namespace ArborXWrappers const auto boundary_points = pair.value.get_boundary_points(); const dealii::Point min_corner = boundary_points.first; const dealii::Point max_corner = boundary_points.second; - if constexpr (dim == 1) - { - return {{min_corner[0]}, {max_corner[0]}}; - } - if constexpr (dim == 2) - { - return {{min_corner[0], min_corner[1]}, - {max_corner[0], max_corner[1]}}; - } - if constexpr (dim == 3) - { - return {{min_corner[0], min_corner[1], min_corner[2]}, - {max_corner[0], max_corner[1], max_corner[2]}}; - } + return {to_arborx_point(min_corner), to_arborx_point(max_corner)}; } @@ -363,22 +359,7 @@ namespace ArborXWrappers std::pair, Number>, unsigned int> &pair) const { - if constexpr (dim == 1) - { - return {{pair.value.first[0]}, pair.value.second}; - } - if constexpr (dim == 2) - { - return {{pair.value.first[0], pair.value.first[1]}, - pair.value.second}; - } - if constexpr (dim == 3) - { - return {{pair.value.first[0], - pair.value.first[1], - pair.value.first[2]}, - pair.value.second}; - } + return {to_arborx_point(pair.value.first), pair.value.second}; } }; -- 2.39.5