1616#include < ArborX_GeometryTraits.hpp>
1717#include < ArborX_Ray.hpp>
1818#include < ArborX_Segment.hpp>
19+ #include < algorithms/ArborX_ReverseDispatch.hpp>
1920#include < misc/ArborX_Vector.hpp>
2021
2122#include < Kokkos_Array.hpp>
@@ -36,10 +37,10 @@ KOKKOS_INLINE_FUNCTION constexpr bool intersects(Geometry1 const &geometry1,
3637{
3738 static_assert (GeometryTraits::dimension_v<Geometry1> ==
3839 GeometryTraits::dimension_v<Geometry2>);
39- return Details::Dispatch::intersects<GeometryTraits:: tag_t <Geometry1>,
40- GeometryTraits::tag_t <Geometry2 >,
41- Geometry1, Geometry2>::apply (geometry1,
42- geometry2);
40+ return Details::Dispatch::DoApply<
41+ Details::Dispatch::intersects, GeometryTraits::tag_t <Geometry1 >,
42+ GeometryTraits:: tag_t <Geometry2>, Geometry1, Geometry2>::apply (geometry1,
43+ geometry2);
4344}
4445
4546namespace Details ::Dispatch
@@ -77,15 +78,6 @@ struct intersects<PointTag, BoxTag, Point, Box>
7778 return true ;
7879 }
7980};
80- template <typename Box, typename Point>
81- struct intersects <BoxTag, PointTag, Box, Point>
82- {
83- KOKKOS_FUNCTION static constexpr bool apply (Box const &box,
84- Point const &point)
85- {
86- return ::ArborX::intersects (point, box);
87- }
88- };
8981
9082// check if a sphere intersects with an axis-aligned bounding box
9183template <typename Sphere, typename Box>
@@ -121,16 +113,6 @@ struct intersects<SphereTag, PointTag, Sphere, Point>
121113 }
122114};
123115
124- template <typename Point, typename Sphere>
125- struct intersects <PointTag, SphereTag, Point, Sphere>
126- {
127- KOKKOS_FUNCTION static constexpr bool apply (Point const &point,
128- Sphere const &sphere)
129- {
130- return ::ArborX::intersects (sphere, point);
131- }
132- };
133-
134116// check if a sphere intersects with a triangle
135117template <typename Sphere, typename Triangle>
136118struct intersects <SphereTag, TriangleTag, Sphere, Triangle>
@@ -142,16 +124,6 @@ struct intersects<SphereTag, TriangleTag, Sphere, Triangle>
142124 }
143125};
144126
145- template <typename Triangle, typename Sphere>
146- struct intersects <TriangleTag, SphereTag, Triangle, Sphere>
147- {
148- KOKKOS_FUNCTION static constexpr bool apply (Triangle const &triangle,
149- Sphere const &sphere)
150- {
151- return ::ArborX::intersects (sphere, triangle);
152- }
153- };
154-
155127template <typename Point, typename Triangle>
156128struct intersects <PointTag, TriangleTag, Point, Triangle>
157129{
@@ -353,14 +325,6 @@ struct intersects<KDOPTag, BoxTag, KDOP, Box>
353325 }
354326};
355327
356- template <typename Box, typename KDOP>
357- struct intersects <BoxTag, KDOPTag, Box, KDOP>
358- {
359- KOKKOS_FUNCTION static constexpr bool apply (Box const &box, KDOP const &kdop)
360- {
361- return ::ArborX::intersects (kdop, box);
362- }
363- };
364328template <typename Triangle, typename Box>
365329struct intersects <TriangleTag, BoxTag, Triangle, Box>
366330{
@@ -393,16 +357,6 @@ struct intersects<PointTag, KDOPTag, Point, KDOP>
393357 }
394358};
395359
396- template <typename KDOP, typename Point>
397- struct intersects <KDOPTag, PointTag, KDOP, Point>
398- {
399- KOKKOS_FUNCTION static constexpr bool apply (KDOP const &kdop,
400- Point const &point)
401- {
402- return ::ArborX::intersects (point, kdop);
403- }
404- };
405-
406360template <typename KDOP1, typename KDOP2>
407361struct intersects <KDOPTag, KDOPTag, KDOP1, KDOP2>
408362{
@@ -540,16 +494,6 @@ struct intersects<SegmentTag, BoxTag, Segment, Box>
540494 }
541495};
542496
543- template <typename Box, typename Segment>
544- struct intersects <BoxTag, SegmentTag, Box, Segment>
545- {
546- KOKKOS_FUNCTION static constexpr bool apply (Box const &box,
547- Segment const &segment)
548- {
549- return ::ArborX::intersects (segment, box);
550- }
551- };
552-
553497template <typename Segment, typename Triangle>
554498struct intersects <SegmentTag, TriangleTag, Segment, Triangle>
555499{
@@ -570,17 +514,6 @@ struct intersects<SegmentTag, TriangleTag, Segment, Triangle>
570514 }
571515};
572516
573- template <typename Triangle, typename Segment>
574- struct intersects <TriangleTag, SegmentTag, Triangle, Segment>
575- {
576- KOKKOS_FUNCTION static constexpr bool apply (Triangle const &triangle,
577- Segment const &segment)
578-
579- {
580- return ::ArborX::intersects (segment, triangle);
581- }
582- };
583-
584517namespace
585518{
586519// Computes x^t R y
@@ -608,16 +541,6 @@ struct intersects<EllipsoidTag, PointTag, Ellipsoid, Point>
608541 }
609542};
610543
611- template <typename Point, typename Ellipsoid>
612- struct intersects <PointTag, EllipsoidTag, Point, Ellipsoid>
613- {
614- KOKKOS_FUNCTION static constexpr bool apply (Point const &point,
615- Ellipsoid const &ellipsoid)
616- {
617- return ::ArborX::intersects (ellipsoid, point);
618- }
619- };
620-
621544template <typename Ellipsoid, typename Segment>
622545struct intersects <EllipsoidTag, SegmentTag, Ellipsoid, Segment>
623546{
@@ -658,16 +581,6 @@ struct intersects<EllipsoidTag, SegmentTag, Ellipsoid, Segment>
658581 }
659582};
660583
661- template <typename Segment, typename Ellipsoid>
662- struct intersects <SegmentTag, EllipsoidTag, Segment, Ellipsoid>
663- {
664- KOKKOS_FUNCTION static constexpr bool apply (Segment const &segment,
665- Ellipsoid const &ellipsoid)
666- {
667- return ::ArborX::intersects (ellipsoid, segment);
668- }
669- };
670-
671584template <typename Ellipsoid, typename Box>
672585struct intersects <EllipsoidTag, BoxTag, Ellipsoid, Box>
673586{
@@ -764,16 +677,6 @@ struct intersects<EllipsoidTag, BoxTag, Ellipsoid, Box>
764677 }
765678};
766679
767- template <typename Box, typename Ellipsoid>
768- struct intersects <BoxTag, EllipsoidTag, Box, Ellipsoid>
769- {
770- KOKKOS_FUNCTION static constexpr bool apply (Box const &box,
771- Ellipsoid const &ellipsoid)
772- {
773- return ::ArborX::intersects (ellipsoid, box);
774- }
775- };
776-
777680} // namespace Details::Dispatch
778681
779682} // namespace ArborX
0 commit comments