deal.II version 9.7.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
access_traits.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_arborx_access_traits_h
16#define dealii_arborx_access_traits_h
17
18#include <deal.II/base/config.h>
19
20#ifdef DEAL_II_WITH_ARBORX
22
23# include <ArborX.hpp>
24
25# include <utility>
26
27
29
31{
32# if ARBORX_VERSION_MAJOR < 2
38 {
39 protected:
43 template <int dim, typename Number>
44 PointPredicate(const std::vector<::Point<dim, Number>> &points);
45
49 std::size_t
50 size() const;
51
55 const ::Point<3, float> &
56 get(unsigned int i) const;
57
58 private:
59 std::vector<::Point<3, float>> points;
60 };
61
62
63
71 {
72 public:
77 template <int dim, typename Number>
79 const std::vector<::Point<dim, Number>> &points);
80
81 // We need these since we inherit privately to avoid polymorphic use.
84 };
85
86
87
95 {
96 public:
102 template <int dim, typename Number>
104 const unsigned int n_nearest_neighbors);
105
109 unsigned int
111
112 // We need these since we inherit privately to avoid polymorphic use.
115
116 private:
118 };
119
120
121
127 {
128 protected:
133 template <int dim, typename Number>
135 const std::vector<::BoundingBox<dim, Number>> &bounding_boxes);
136
140 std::size_t
141 size() const;
142
146 const ::BoundingBox<3, float> &
147 get(unsigned int i) const;
148
149 private:
150 std::vector<::BoundingBox<3, float>> bounding_boxes;
151 };
152
153
154
162 {
163 public:
168 template <int dim, typename Number>
170 const std::vector<::BoundingBox<dim, Number>> &bounding_boxes);
171
172 // We need these since we inherit privately to avoid polymorphic use.
175 };
176
177
185 {
186 public:
192 template <int dim, typename Number>
194 const std::vector<::BoundingBox<dim, Number>> &bounding_boxes,
195 const unsigned int n_nearest_neighbors);
196
200 unsigned int
202
203 // We need these since we inherit privately to avoid polymorphic use.
206
207 private:
209 };
210
211
212
218 {
219 protected:
224 template <int dim, typename Number>
226 const std::vector<std::pair<::Point<dim, Number>, Number>>
227 &spheres);
228
232 std::size_t
233 size() const;
234
238 const std::pair<::Point<3, float>, float> &
239 get(unsigned int) const;
240
241 private:
242 std::vector<std::pair<::Point<3, float>, float>> spheres;
243 };
244
245
246
254 {
255 public:
260 template <int dim, typename Number>
262 const std::vector<std::pair<::Point<dim, Number>, Number>>
263 &spheres);
264
265 // We need these since we inherit privately to avoid polymorphic use.
268 };
269
270
271
279 {
280 public:
286 template <int dim, typename Number>
288 const std::vector<std::pair<::Point<dim, Number>, Number>> &spheres,
289 const unsigned int n_nearest_neighbors);
290
294 unsigned int
296
297 // We need these since we inherit privately to avoid polymorphic use.
300
301 private:
303 };
304# else
305 namespace internal
306 {
307 template <int dim, typename Number>
308 ArborX::Point<dim, Number>
309 to_arborx_point(const ::Point<dim, Number> &p)
310 {
311 if constexpr (dim == 1)
312 {
313 return {p[0]};
314 }
315
316 if constexpr (dim == 2)
317 {
318 return {p[0], p[1]};
319 }
320
321 if constexpr (dim == 3)
322 {
323 return {p[0], p[1], p[2]};
324 }
325 }
326
331 struct IndexableGetter
332 {
333 template <int dim, typename Number>
334 ArborX::Point<dim, Number>
335 operator()(const ArborX::PairValueIndex<::Point<dim, Number>,
336 unsigned int> &pair) const
337 {
338 return to_arborx_point(pair.value);
339 }
340
341
342
343 template <int dim, typename Number>
344 ArborX::Box<dim, Number>
345 operator()(const ArborX::PairValueIndex<::BoundingBox<dim, Number>,
346 unsigned int> &pair) const
347 {
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)};
352 }
353
354
355
356 template <int dim, typename Number>
357 ArborX::Sphere<dim, Number>
358 operator()(const ArborX::PairValueIndex<
359 std::pair<::Point<dim, Number>, Number>,
360 unsigned int> &pair) const
361 {
362 return {to_arborx_point(pair.value.first), pair.value.second};
363 }
364 };
365
366
367
371 struct ExtractIndex
372 {
373 template <typename Query, typename Value, typename Output>
374 KOKKOS_FUNCTION void
375 operator()(const Query &, const Value &value, const Output &out) const
376 {
377 out(value.index);
378 }
379 };
380
381
382
387 struct ExtractIndexRank
388 {
389 unsigned int rank;
390
391 template <typename Predicate, typename Value, typename Output>
392 KOKKOS_FUNCTION void
393 operator()(const Predicate &,
394 const ArborX::PairValueIndex<Value> &value,
395 const Output &out) const
396 {
397 out({value.index, rank});
398 }
399 };
400 } // namespace internal
401
402
403
409 template <int dim, typename Number>
411 {
412 public:
418 const std::vector<::Point<dim, Number>> &points);
419
423 std::size_t
424 size() const;
425
429 const ::Point<dim, Number> &
430 get(unsigned int i) const;
431
435 static constexpr bool is_nearest = false;
436
437 private:
438 std::vector<::Point<dim, Number>> points;
439 };
440
441
442
448 template <int dim, typename Number>
450 {
451 public:
456 PointNearestPredicate(const std::vector<::Point<dim, Number>> &points,
457 const unsigned int n_nearest_neighbors);
458
462 unsigned int
464
468 std::size_t
469 size() const;
470
474 const ::Point<dim, Number> &
475 get(unsigned int i) const;
476
477
481 static constexpr bool is_nearest = true;
482
483 private:
484 std::vector<::Point<dim, Number>> points;
485 unsigned int n_nearest_neighbors;
486 };
487
488
489
495 template <int dim, typename Number>
497 {
498 public:
504 const std::vector<::BoundingBox<dim, Number>> &bounding_boxes);
505
509 std::size_t
510 size() const;
511
515 const ::BoundingBox<dim, Number> &
516 get(unsigned int i) const;
517
521 static constexpr bool is_nearest = false;
522
523 private:
524 std::vector<::BoundingBox<dim, Number>> bounding_boxes;
525 };
526
527
528
534 template <int dim, typename Number>
536 {
537 public:
544 const std::vector<::BoundingBox<dim, Number>> &bounding_boxes,
545 const unsigned int n_nearest_neighbors);
546
550 unsigned int
552
556 std::size_t
557 size() const;
558
562 const ::BoundingBox<dim, Number> &
563 get(unsigned int i) const;
564
568 static constexpr bool is_nearest = true;
569
570 private:
571 std::vector<::BoundingBox<dim, Number>> bounding_boxes;
572 unsigned int n_nearest_neighbors;
573 };
574
575
576
582 template <int dim, typename Number>
584 {
585 public:
591 const std::vector<std::pair<::Point<dim, Number>, Number>>
592 &spheres);
593
597 std::size_t
598 size() const;
599
603 const std::pair<::Point<dim, Number>, Number> &
604 get(unsigned int) const;
605
609 static constexpr bool is_nearest = false;
610
611 private:
612 std::vector<std::pair<::Point<dim, Number>, Number>> spheres;
613 };
614
615
616
622 template <int dim, typename Number>
624 {
625 public:
632 const std::vector<std::pair<::Point<dim, Number>, Number>> &spheres,
633 const unsigned int n_nearest_neighbors);
634
638 unsigned int
640
644 std::size_t
645 size() const;
646
650 const std::pair<::Point<dim, Number>, Number> &
651 get(unsigned int) const;
652
656 static constexpr bool is_nearest = true;
657
658 private:
659 std::vector<std::pair<::Point<dim, Number>, Number>> spheres;
660 unsigned int n_nearest_neighbors;
661 };
662# endif
663} // namespace ArborXWrappers
664
666
670namespace ArborX
671{
672# if ARBORX_VERSION_MAJOR < 2
677 template <int dim, typename Number>
678 struct AccessTraits<std::vector<::Point<dim, Number>>, PrimitivesTag>
679 {
680 using memory_space = Kokkos::HostSpace;
681
685 static std::size_t
686 size(const std::vector<::Point<dim, Number>> &v);
687
691 static Point
692 get(const std::vector<::Point<dim, Number>> &v, std::size_t i);
693 };
694
695
696
701 template <int dim, typename Number>
702 struct AccessTraits<std::vector<::BoundingBox<dim, Number>>,
703 PrimitivesTag>
704 {
705 using memory_space = Kokkos::HostSpace;
706
710 static std::size_t
711 size(const std::vector<::BoundingBox<dim, Number>> &v);
712
716 static Box
717 get(const std::vector<::BoundingBox<dim, Number>> &v, std::size_t i);
718 };
719
720
721
726 template <int dim, typename Number>
727 struct AccessTraits<
728 std::vector<std::pair<::Point<dim, Number>, Number>>,
729 PrimitivesTag>
730 {
731 using memory_space = Kokkos::HostSpace;
732
736 static std::size_t
737 size(const std::vector<std::pair<::Point<dim, Number>, Number>> &v);
738
743 static Sphere
744 get(const std::vector<std::pair<::Point<dim, Number>, Number>> &v,
745 std::size_t i);
746 };
747# else
751 template <typename T>
752 struct AccessTraits<
753 std::vector<T>,
754 std::enable_if_t<
755 std::is_same_v<T, ::Point<T::dimension, float>> ||
756 std::is_same_v<T, ::Point<T::dimension, double>> ||
757 std::is_same_v<T, ::BoundingBox<T::dimension, float>> ||
758 std::is_same_v<T, ::BoundingBox<T::dimension, double>> ||
759 std::is_same_v<T, std::pair<::Point<T::dimension, float>, float>> ||
760 std::is_same_v<T,
761 std::pair<::Point<T::dimension, double>, double>>>>
762 {
763 using memory_space = Kokkos::HostSpace;
764
768 static std::size_t
769 size(const std::vector<T> &v);
770
774 static T
775 get(const std::vector<T> &v, std::size_t i);
776 };
777# endif
778
779
780
781# if ARBORX_VERSION_MAJOR < 2
785 template <>
787 PredicatesTag>
788 {
789 using memory_space = Kokkos::HostSpace;
790
794 static std::size_t
795 size(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect);
796
801 static auto
802 get(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect,
803 std::size_t i);
804 };
805
806
807
811 template <>
813 PredicatesTag>
814 {
815 using memory_space = Kokkos::HostSpace;
816
820 static std::size_t
821 size(const ::ArborXWrappers::PointNearestPredicate &pt_nearest);
822
828 static auto
829 get(const ::ArborXWrappers::PointNearestPredicate &pt_nearest,
830 std::size_t i);
831 };
832
833
834
839 template <>
841 PredicatesTag>
842 {
843 using memory_space = Kokkos::HostSpace;
844
848 static std::size_t
849 size(const ::ArborXWrappers::BoundingBoxIntersectPredicate
850 &bb_intersect);
851
856 static auto
857 get(
858 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect,
859 std::size_t i);
860 };
861
862
863
868 template <>
870 PredicatesTag>
871 {
872 using memory_space = Kokkos::HostSpace;
873
877 static std::size_t
878 size(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest);
879
885 static auto
886 get(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest,
887 std::size_t i);
888 };
889
890
891
896 template <>
898 PredicatesTag>
899 {
900 using memory_space = Kokkos::HostSpace;
901
905 static std::size_t
906 size(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect);
907
912 static auto
913 get(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect,
914 std::size_t i);
915 };
916
917
918
922 template <>
924 PredicatesTag>
925 {
926 using memory_space = Kokkos::HostSpace;
927
931 static std::size_t
932 size(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest);
933
939 static auto
940 get(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest,
941 std::size_t i);
942 };
943# else
947 template <int dim, typename Number>
948 struct AccessTraits<
950 {
951 using memory_space = Kokkos::HostSpace;
952
956 static std::size_t
957 size(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
958 &pt_intersect);
959
964 static auto
965 get(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
966 &pt_intersect,
967 std::size_t i);
968 };
969
970
971
975 template <int dim, typename Number>
976 struct AccessTraits<
978 {
979 using memory_space = Kokkos::HostSpace;
980
984 static std::size_t
985 size(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
986 &pt_nearest);
987
993 static auto
994 get(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
995 &pt_nearest,
996 std::size_t i);
997 };
998
999
1000
1005 template <int dim, typename Number>
1006 struct AccessTraits<
1007 ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>>
1008 {
1009 using memory_space = Kokkos::HostSpace;
1010
1014 static std::size_t
1015 size(
1016 const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1017 &bb_intersect);
1018
1023 static auto
1024 get(const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1025 &bb_intersect,
1026 std::size_t i);
1027 };
1028
1029
1030
1035 template <int dim, typename Number>
1036 struct AccessTraits<
1037 ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>>
1038 {
1039 using memory_space = Kokkos::HostSpace;
1040
1044 static std::size_t
1045 size(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1046 &bb_nearest);
1047
1053 static auto
1054 get(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1055 &bb_nearest,
1056 std::size_t i);
1057 };
1058
1059
1060
1065 template <int dim, typename Number>
1066 struct AccessTraits<
1067 ::ArborXWrappers::SphereIntersectPredicate<dim, Number>>
1068 {
1069 using memory_space = Kokkos::HostSpace;
1070
1074 static std::size_t
1075 size(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1076 &sph_intersect);
1077
1082 static auto
1083 get(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1084 &sph_intersect,
1085 std::size_t i);
1086 };
1087
1088
1089
1093 template <int dim, typename Number>
1094 struct AccessTraits<
1095 ::ArborXWrappers::SphereNearestPredicate<dim, Number>>
1096 {
1097 using memory_space = Kokkos::HostSpace;
1098
1102 static std::size_t
1103 size(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1104 &sph_nearest);
1105
1111 static auto
1112 get(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1113 &sph_nearest,
1114 std::size_t i);
1115 };
1116# endif
1117
1118 // ------------------------------- Inline ----------------------------------//
1119
1120 // The implementation of AccessTraits<..., PredicatesTag> needs to be in the
1121 // header file otherwise the return type of auto get() cannot be determined.
1122 // We use auto because ArborX does not expose the type of intersects
1123
1124# if ARBORX_VERSION_MAJOR < 2
1125 inline std::size_t
1126 AccessTraits<::ArborXWrappers::PointIntersectPredicate, PredicatesTag>::
1127 size(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect)
1128 {
1129 return pt_intersect.size();
1130 }
1131
1132
1133
1134 inline auto
1135 AccessTraits<::ArborXWrappers::PointIntersectPredicate, PredicatesTag>::
1136 get(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect,
1137 std::size_t i)
1138 {
1139 const auto dealii_point = pt_intersect.get(i);
1140 return intersects(Point{dealii_point[0], dealii_point[1], dealii_point[2]});
1141 }
1142
1143
1144
1145 inline std::size_t
1146 AccessTraits<::ArborXWrappers::PointNearestPredicate, PredicatesTag>::
1147 size(const ::ArborXWrappers::PointNearestPredicate &pt_nearest)
1148 {
1149 return pt_nearest.size();
1150 }
1151
1152
1153
1154 inline auto
1155 AccessTraits<::ArborXWrappers::PointNearestPredicate, PredicatesTag>::
1156 get(const ::ArborXWrappers::PointNearestPredicate &pt_nearest,
1157 std::size_t i)
1158 {
1159 const auto dealii_point = pt_nearest.get(i);
1160 return nearest(Point{dealii_point[0], dealii_point[1], dealii_point[2]},
1161 pt_nearest.get_n_nearest_neighbors());
1162 }
1163
1164
1165
1166 inline std::size_t
1168 PredicatesTag>::
1169 size(
1170 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect)
1171 {
1172 return bb_intersect.size();
1173 }
1174
1175
1176
1177 inline auto
1179 PredicatesTag>::
1180 get(
1181 const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect,
1182 std::size_t i)
1183 {
1184 const auto boundary_points = bb_intersect.get(i).get_boundary_points();
1185 const ::Point<3, float> min_corner = boundary_points.first;
1186 const ::Point<3, float> max_corner = boundary_points.second;
1187
1188 return intersects(Box{{min_corner[0], min_corner[1], min_corner[2]},
1189 {max_corner[0], max_corner[1], max_corner[2]}});
1190 }
1191
1192
1193
1194 inline std::size_t
1196 PredicatesTag>::
1197 size(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest)
1198 {
1199 return bb_nearest.size();
1200 }
1201
1202
1203
1204 inline auto
1206 PredicatesTag>::
1207 get(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest,
1208 std::size_t i)
1209 {
1210 const auto boundary_points = bb_nearest.get(i).get_boundary_points();
1211 const ::Point<3, float> min_corner = boundary_points.first;
1212 const ::Point<3, float> max_corner = boundary_points.second;
1213
1214 return nearest(Box{{min_corner[0], min_corner[1], min_corner[2]},
1215 {max_corner[0], max_corner[1], max_corner[2]}},
1216 bb_nearest.get_n_nearest_neighbors());
1217 }
1218
1219
1220
1221 inline std::size_t
1223 PredicatesTag>::
1224 size(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect)
1225 {
1226 return sph_intersect.size();
1227 }
1228
1229
1230
1231 inline auto
1233 PredicatesTag>::
1234 get(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect,
1235 std::size_t i)
1236 {
1237 const auto sphere = sph_intersect.get(i);
1238 return intersects(
1239 Sphere{{sphere.first[0], sphere.first[1], sphere.first[2]},
1240 sphere.second});
1241 }
1242
1243
1244
1245 inline std::size_t
1246 AccessTraits<::ArborXWrappers::SphereNearestPredicate, PredicatesTag>::
1247 size(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest)
1248 {
1249 return sph_nearest.size();
1250 }
1251
1252
1253
1254 inline auto
1255 AccessTraits<::ArborXWrappers::SphereNearestPredicate, PredicatesTag>::
1256 get(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest,
1257 std::size_t i)
1258 {
1259 const auto sphere = sph_nearest.get(i);
1260 return nearest(Sphere{{sphere.first[0], sphere.first[1], sphere.first[2]},
1261 sphere.second},
1262 sph_nearest.get_n_nearest_neighbors());
1263 }
1264# else
1265 template <int dim, typename Number>
1266 inline std::size_t
1267 AccessTraits<::ArborXWrappers::PointIntersectPredicate<dim, Number>>::
1268 size(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
1269 &pt_intersect)
1270 {
1271 return pt_intersect.size();
1272 }
1273
1274
1275
1276 template <int dim, typename Number>
1277 inline auto
1278 AccessTraits<::ArborXWrappers::PointIntersectPredicate<dim, Number>>::
1279 get(const ::ArborXWrappers::PointIntersectPredicate<dim, Number>
1280 &pt_intersect,
1281 std::size_t i)
1282 {
1283 return intersects(
1284 ::ArborXWrappers::internal::to_arborx_point(pt_intersect.get(i)));
1285 }
1286
1287
1288
1289 template <int dim, typename Number>
1290 inline std::size_t
1291 AccessTraits<::ArborXWrappers::PointNearestPredicate<dim, Number>>::
1292 size(const ::ArborXWrappers::PointNearestPredicate<dim, Number>
1293 &pt_nearest)
1294 {
1295 return pt_nearest.size();
1296 }
1297
1298
1299
1300 template <int dim, typename Number>
1301 inline auto
1302 AccessTraits<::ArborXWrappers::PointNearestPredicate<dim, Number>>::get(
1303 const ::ArborXWrappers::PointNearestPredicate<dim, Number>
1304 &pt_nearest,
1305 std::size_t i)
1306 {
1307 return nearest(::ArborXWrappers::internal::to_arborx_point(
1308 pt_nearest.get(i)),
1309 pt_nearest.get_n_nearest_neighbors());
1310 }
1311
1312
1313
1314 template <int dim, typename Number>
1315 inline std::size_t
1316 AccessTraits<
1317 ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>>::
1318 size(
1319 const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1320 &bb_intersect)
1321 {
1322 return bb_intersect.size();
1323 }
1324
1325
1326
1327 template <int dim, typename Number>
1328 inline auto
1329 AccessTraits<
1330 ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>>::
1331 get(const ::ArborXWrappers::BoundingBoxIntersectPredicate<dim, Number>
1332 &bb_intersect,
1333 std::size_t i)
1334 {
1335 const auto boundary_points = bb_intersect.get(i).get_boundary_points();
1336 const ::Point<dim, Number> min_corner = boundary_points.first;
1337 const ::Point<dim, Number> max_corner = boundary_points.second;
1338
1339 return intersects(
1340 Box{::ArborXWrappers::internal::to_arborx_point(min_corner),
1341 ::ArborXWrappers::internal::to_arborx_point(max_corner)});
1342 }
1343
1344
1345
1346 template <int dim, typename Number>
1347 inline std::size_t
1348 AccessTraits<
1349 ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>>::
1350 size(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1351 &bb_nearest)
1352 {
1353 return bb_nearest.size();
1354 }
1355
1356
1357
1358 template <int dim, typename Number>
1359 inline auto
1360 AccessTraits<
1361 ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>>::
1362 get(const ::ArborXWrappers::BoundingBoxNearestPredicate<dim, Number>
1363 &bb_nearest,
1364 std::size_t i)
1365 {
1366 const auto boundary_points = bb_nearest.get(i).get_boundary_points();
1367 const ::Point<dim, Number> min_corner = boundary_points.first;
1368 const ::Point<dim, Number> max_corner = boundary_points.second;
1369
1370 return nearest(
1371 Box{::ArborXWrappers::internal::to_arborx_point(min_corner),
1372 ::ArborXWrappers::internal::to_arborx_point(max_corner)},
1373 bb_nearest.get_n_nearest_neighbors());
1374 }
1375
1376
1377
1378 template <int dim, typename Number>
1379 inline std::size_t
1380 AccessTraits<::ArborXWrappers::SphereIntersectPredicate<dim, Number>>::
1381 size(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1382 &sph_intersect)
1383 {
1384 return sph_intersect.size();
1385 }
1386
1387
1388
1389 template <int dim, typename Number>
1390 inline auto
1391 AccessTraits<::ArborXWrappers::SphereIntersectPredicate<dim, Number>>::
1392 get(const ::ArborXWrappers::SphereIntersectPredicate<dim, Number>
1393 &sph_intersect,
1394 std::size_t i)
1395 {
1396 const auto sphere = sph_intersect.get(i);
1397 return intersects(
1398 Sphere{::ArborXWrappers::internal::to_arborx_point(sphere.first),
1399 sphere.second});
1400 }
1401
1402
1403
1404 template <int dim, typename Number>
1405 inline std::size_t
1406 AccessTraits<::ArborXWrappers::SphereNearestPredicate<dim, Number>>::
1407 size(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1408 &sph_nearest)
1409 {
1410 return sph_nearest.size();
1411 }
1412
1413
1414
1415 template <int dim, typename Number>
1416 inline auto
1417 AccessTraits<::ArborXWrappers::SphereNearestPredicate<dim, Number>>::
1418 get(const ::ArborXWrappers::SphereNearestPredicate<dim, Number>
1419 &sph_nearest,
1420 std::size_t i)
1421 {
1422 const auto sphere = sph_nearest.get(i);
1423 return nearest(Sphere{::ArborXWrappers::internal::to_arborx_point(
1424 sphere.first),
1425 sphere.second},
1426 sph_nearest.get_n_nearest_neighbors());
1427 }
1428# endif
1429} // namespace ArborX
1430
1431#else
1432
1433// Make sure the scripts that create the C++20 module input files have
1434// something to latch on if the preprocessor #ifdef above would
1435// otherwise lead to an empty content of the file.
1438
1439#endif
1440
1441#endif
BoundingBoxIntersectPredicate(const std::vector<::BoundingBox< dim, Number > > &bounding_boxes)
const ::BoundingBox< 3, float > & get(unsigned int i) const
BoundingBoxNearestPredicate(const std::vector<::BoundingBox< dim, Number > > &bounding_boxes, const unsigned int n_nearest_neighbors)
const ::BoundingBox< 3, float > & get(unsigned int i) const
BoundingBoxPredicate(const std::vector<::BoundingBox< dim, Number > > &bounding_boxes)
const ::BoundingBox< 3, float > & get(unsigned int i) const
std::vector<::BoundingBox< 3, float > > bounding_boxes
PointIntersectPredicate(const std::vector<::Point< dim, Number > > &points)
const ::Point< 3, float > & get(unsigned int i) const
const ::Point< 3, float > & get(unsigned int i) const
unsigned int get_n_nearest_neighbors() const
PointNearestPredicate(const std::vector<::Point< dim, Number > > &points, const unsigned int n_nearest_neighbors)
std::vector<::Point< 3, float > > points
PointPredicate(const std::vector<::Point< dim, Number > > &points)
const ::Point< 3, float > & get(unsigned int i) const
const std::pair<::Point< 3, float >, float > & get(unsigned int) const
SphereIntersectPredicate(const std::vector< std::pair<::Point< dim, Number >, Number > > &spheres)
const std::pair<::Point< 3, float >, float > & get(unsigned int) const
SphereNearestPredicate(const std::vector< std::pair<::Point< dim, Number >, Number > > &spheres, const unsigned int n_nearest_neighbors)
const std::pair<::Point< 3, float >, float > & get(unsigned int) const
std::vector< std::pair<::Point< 3, float >, float > > spheres
SpherePredicate(const std::vector< std::pair<::Point< dim, Number >, Number > > &spheres)
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > & get_boundary_points()
Definition point.h:113
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
const bool IsBlockVector< VectorType >::value
STL namespace.
static Sphere get(const std::vector< std::pair<::Point< dim, Number >, Number > > &v, std::size_t i)
static std::size_t size(const std::vector< std::pair<::Point< dim, Number >, Number > > &v)
static Box get(const std::vector<::BoundingBox< dim, Number > > &v, std::size_t i)
static std::size_t size(const std::vector<::BoundingBox< dim, Number > > &v)
static Point get(const std::vector<::Point< dim, Number > > &v, std::size_t i)
static std::size_t size(const std::vector<::Point< dim, Number > > &v)
static std::size_t size(const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect)
static auto get(const ::ArborXWrappers::BoundingBoxIntersectPredicate &bb_intersect, std::size_t i)
static auto get(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest, std::size_t i)
static std::size_t size(const ::ArborXWrappers::BoundingBoxNearestPredicate &bb_nearest)
static std::size_t size(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect)
static auto get(const ::ArborXWrappers::PointIntersectPredicate &pt_intersect, std::size_t i)
static auto get(const ::ArborXWrappers::PointNearestPredicate &pt_nearest, std::size_t i)
static std::size_t size(const ::ArborXWrappers::PointNearestPredicate &pt_nearest)
static std::size_t size(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect)
static auto get(const ::ArborXWrappers::SphereIntersectPredicate &sph_intersect, std::size_t i)
static auto get(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest, std::size_t i)
static std::size_t size(const ::ArborXWrappers::SphereNearestPredicate &sph_nearest)