32# if ARBORX_VERSION_MAJOR < 2
43 template <
int dim,
typename Number>
55 const ::Point<3, float> &
56 get(
unsigned int i)
const;
59 std::vector<::Point<3, float>>
points;
77 template <
int dim,
typename Number>
102 template <
int dim,
typename Number>
133 template <
int dim,
typename Number>
146 const ::BoundingBox<3, float> &
147 get(
unsigned int i)
const;
168 template <
int dim,
typename Number>
192 template <
int dim,
typename Number>
224 template <
int dim,
typename Number>
238 const std::pair<::Point<3, float>,
float> &
239 get(
unsigned int)
const;
242 std::vector<std::pair<::Point<3, float>,
float>>
spheres;
260 template <
int dim,
typename Number>
286 template <
int dim,
typename Number>
307 template <
int dim,
typename Number>
308 ArborX::Point<dim, Number>
309 to_arborx_point(const ::Point<dim, Number> &p)
311 if constexpr (dim == 1)
316 if constexpr (dim == 2)
318 return {{p[0], p[1]}};
321 if constexpr (dim == 3)
323 return {{p[0], p[1], p[2]}};
331 struct IndexableGetter
333 template <
int dim,
typename Number>
334 ArborX::Point<dim, Number>
336 unsigned int> &pair)
const
338 return to_arborx_point(pair.value);
343 template <
int dim,
typename Number>
344 ArborX::Box<dim, Number>
346 unsigned int> &pair)
const
348 const auto boundary_points = pair.value.get_boundary_points();
349 const ::Point<dim, Number> min_corner = boundary_points.first;
350 const ::Point<dim, Number> max_corner = boundary_points.second;
351 return {to_arborx_point(min_corner), to_arborx_point(max_corner)};
356 template <
int dim,
typename Number>
357 ArborX::Sphere<dim, Number>
360 unsigned int> &pair)
const
362 return {to_arborx_point(pair.value.first), pair.value.second};
373 template <
typename Query,
typename Value,
typename Output>
375 operator()(
const Query &,
const Value &value,
const Output &out)
const
387 struct ExtractIndexRank
391 template <
typename Predicate,
typename Value,
typename Output>
394 const ArborX::PairValueIndex<Value> &value,
395 const Output &out)
const
397 out({
value.index, rank});
409 template <
int dim,
typename Number>
410 class PointIntersectPredicate
429 const ::Point<dim, Number> &
430 get(
unsigned int i)
const;
435 static constexpr bool is_nearest =
false;
438 std::vector<::Point<dim, Number>>
points;
448 template <
int dim,
typename Number>
449 class PointNearestPredicate
474 const ::Point<dim, Number> &
475 get(
unsigned int i)
const;
481 static constexpr bool is_nearest =
true;
484 std::vector<::Point<dim, Number>>
points;
495 template <
int dim,
typename Number>
496 class BoundingBoxIntersectPredicate
515 const ::BoundingBox<dim, Number> &
516 get(
unsigned int i)
const;
521 static constexpr bool is_nearest =
false;
534 template <
int dim,
typename Number>
535 class BoundingBoxNearestPredicate
562 const ::BoundingBox<dim, Number> &
563 get(
unsigned int i)
const;
568 static constexpr bool is_nearest =
true;
582 template <
int dim,
typename Number>
583 class SphereIntersectPredicate
603 const std::pair<::Point<dim, Number>,
Number> &
604 get(
unsigned int)
const;
609 static constexpr bool is_nearest =
false;
612 std::vector<std::pair<::Point<dim, Number>,
Number>>
spheres;
622 template <
int dim,
typename Number>
623 class SphereNearestPredicate
650 const std::pair<::Point<dim, Number>,
Number> &
651 get(
unsigned int)
const;
656 static constexpr bool is_nearest =
true;
659 std::vector<std::pair<::Point<dim, Number>,
Number>>
spheres;
675# if ARBORX_VERSION_MAJOR < 2
680 template <
int dim,
typename Number>
681 struct AccessTraits<
std::vector<::Point<dim, Number>>, PrimitivesTag>
704 template <
int dim,
typename Number>
705 struct AccessTraits<
std::vector<::BoundingBox<dim, Number>>,
729 template <
int dim,
typename Number>
731 std::vector<std::pair<::Point<dim, Number>, Number>>,
754 template <
typename T>
758 std::is_same_v<T, ::Point<T::dimension, float>> ||
759 std::is_same_v<T, ::Point<T::dimension, double>> ||
760 std::is_same_v<T, ::BoundingBox<T::dimension, float>> ||
761 std::is_same_v<T, ::BoundingBox<T::dimension, double>> ||
762 std::is_same_v<T, std::pair<::Point<T::dimension, float>, float>> ||
764 std::pair<::Point<T::dimension, double>, double>>>>
766 using memory_space = Kokkos::HostSpace;
772 size(
const std::vector<T> &v);
778 get(
const std::vector<T> &v, std::size_t i);
784# if ARBORX_VERSION_MAJOR < 2
798 size(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect);
805 get(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect,
824 size(const ::ArborXWrappers::PointNearestPredicate &pt_nearest);
832 get(const ::ArborXWrappers::PointNearestPredicate &pt_nearest,
852 size(const ::ArborXWrappers::BoundingBoxIntersectPredicate
861 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect,
881 size(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest);
889 get(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest,
909 size(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect);
916 get(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect,
935 size(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest);
943 get(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest,
950 template <
int dim,
typename Number>
954 using memory_space = Kokkos::HostSpace;
960 size(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
968 get(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
978 template <
int dim,
typename Number>
982 using memory_space = Kokkos::HostSpace;
988 size(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
997 get(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
1008 template <
int dim,
typename Number>
1009 struct AccessTraits<
1012 using memory_space = Kokkos::HostSpace;
1019 const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1027 get(const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1038 template <
int dim,
typename Number>
1039 struct AccessTraits<
1042 using memory_space = Kokkos::HostSpace;
1048 size(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1057 get(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1068 template <
int dim,
typename Number>
1069 struct AccessTraits<
1072 using memory_space = Kokkos::HostSpace;
1078 size(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1086 get(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1096 template <
int dim,
typename Number>
1097 struct AccessTraits<
1100 using memory_space = Kokkos::HostSpace;
1106 size(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1115 get(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1127# if ARBORX_VERSION_MAJOR < 2
1129 AccessTraits<::ArborXWrappers::PointIntersectPredicate, PredicatesTag>::
1130 size(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect)
1132 return pt_intersect.size();
1138 AccessTraits<::ArborXWrappers::PointIntersectPredicate, PredicatesTag>::
1139 get(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect,
1142 const auto dealii_point = pt_intersect.get(i);
1143 return intersects(
Point{dealii_point[0], dealii_point[1], dealii_point[2]});
1149 AccessTraits<::ArborXWrappers::PointNearestPredicate, PredicatesTag>::
1150 size(const ::ArborXWrappers::PointNearestPredicate &pt_nearest)
1152 return pt_nearest.size();
1158 AccessTraits<::ArborXWrappers::PointNearestPredicate, PredicatesTag>::
1159 get(const ::ArborXWrappers::PointNearestPredicate &pt_nearest,
1162 const auto dealii_point = pt_nearest.get(i);
1163 return nearest(
Point{dealii_point[0], dealii_point[1], dealii_point[2]},
1164 pt_nearest.get_n_nearest_neighbors());
1173 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect)
1175 return bb_intersect.
size();
1184 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect,
1188 const ::Point<3, float> min_corner = boundary_points.first;
1189 const ::Point<3, float> max_corner = boundary_points.second;
1191 return intersects(Box{{min_corner[0], min_corner[1], min_corner[2]},
1192 {max_corner[0], max_corner[1], max_corner[2]}});
1200 size(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest)
1202 return bb_nearest.
size();
1209 get(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest,
1213 const ::Point<3, float> min_corner = boundary_points.first;
1214 const ::Point<3, float> max_corner = boundary_points.second;
1216 return nearest(Box{{min_corner[0], min_corner[1], min_corner[2]},
1217 {max_corner[0], max_corner[1], max_corner[2]}},
1218 bb_nearest.get_n_nearest_neighbors());
1223 inline std::size_t AccessTraits<
1225 PredicatesTag>
::size(const ::ArborXWrappers::SphereIntersectPredicate
1228 return sph_intersect.
size();
1235 get(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect,
1238 const auto sphere = sph_intersect.
get(i);
1240 Sphere{{sphere.first[0], sphere.first[1], sphere.first[2]},
1247 AccessTraits<::ArborXWrappers::SphereNearestPredicate, PredicatesTag>::
1248 size(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest)
1250 return sph_nearest.size();
1256 AccessTraits<::ArborXWrappers::SphereNearestPredicate, PredicatesTag>::
1257 get(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest,
1260 const auto sphere = sph_nearest.get(i);
1261 return nearest(Sphere{{sphere.first[0], sphere.first[1], sphere.first[2]},
1263 sph_nearest.get_n_nearest_neighbors());
1266 template <
int dim,
typename Number>
1268 AccessTraits<::ArborXWrappers::PointIntersectPredicate<dim, Number>>
::
1269 size(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
1272 return pt_intersect.size();
1277 template <
int dim,
typename Number>
1279 AccessTraits<::ArborXWrappers::PointIntersectPredicate<dim, Number>>::
1280 get(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
1285 ::ArborXWrappers::internal::to_arborx_point(pt_intersect.get(i)));
1290 template <
int dim,
typename Number>
1292 AccessTraits<::ArborXWrappers::PointNearestPredicate<dim, Number>>
::
1293 size(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
1296 return pt_nearest.size();
1301 template <
int dim,
typename Number>
1303 AccessTraits<::ArborXWrappers::PointNearestPredicate<dim, Number>>::get(
1304 const ::ArborXWrappers::PointNearestPredicate<dim, Number>
1308 return nearest(::ArborXWrappers::internal::to_arborx_point(
1310 pt_nearest.get_n_nearest_neighbors());
1315 template <
int dim,
typename Number>
1316 inline std::size_t AccessTraits<
1319 const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1322 return bb_intersect.
size();
1327 template <
int dim,
typename Number>
1328 inline auto AccessTraits<
1330 get(const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1335 const ::Point<dim, Number> min_corner = boundary_points.first;
1336 const ::Point<dim, Number> max_corner = boundary_points.second;
1339 Box{::ArborXWrappers::internal::to_arborx_point(min_corner),
1340 ::ArborXWrappers::internal::to_arborx_point(max_corner)});
1345 template <
int dim,
typename Number>
1346 inline std::size_t AccessTraits<
1348 size(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1351 return bb_nearest.
size();
1356 template <
int dim,
typename Number>
1357 inline auto AccessTraits<
1359 get(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1364 const ::Point<dim, Number> min_corner = boundary_points.first;
1365 const ::Point<dim, Number> max_corner = boundary_points.second;
1368 Box{::ArborXWrappers::internal::to_arborx_point(min_corner),
1369 ::ArborXWrappers::internal::to_arborx_point(max_corner)},
1370 bb_nearest.get_n_nearest_neighbors());
1375 template <
int dim,
typename Number>
1377 AccessTraits<::ArborXWrappers::SphereIntersectPredicate<dim, Number>>
::
1378 size(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1381 return sph_intersect.size();
1386 template <
int dim,
typename Number>
1388 AccessTraits<::ArborXWrappers::SphereIntersectPredicate<dim, Number>>::
1389 get(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1393 const auto sphere = sph_intersect.get(i);
1395 Sphere{::ArborXWrappers::internal::to_arborx_point(sphere.first),
1401 template <
int dim,
typename Number>
1403 AccessTraits<::ArborXWrappers::SphereNearestPredicate<dim, Number>>
::
1404 size(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1407 return sph_nearest.size();
1412 template <
int dim,
typename Number>
1414 AccessTraits<::ArborXWrappers::SphereNearestPredicate<dim, Number>>::
1415 get(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1419 const auto sphere = sph_nearest.get(i);
1420 return nearest(Sphere{::ArborXWrappers::internal::to_arborx_point(
1423 sph_nearest.get_n_nearest_neighbors());