From b76b97b9c4cffcdade8dbba5bbd6d501632e9446 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 31 Mar 2021 14:08:19 -0400 Subject: [PATCH] Avoid usage of the ArborX access traits in polymorphic contexts --- include/deal.II/arborx/access_traits.h | 28 ++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/include/deal.II/arborx/access_traits.h b/include/deal.II/arborx/access_traits.h index 7c02fd85c2..be704fbb92 100644 --- a/include/deal.II/arborx/access_traits.h +++ b/include/deal.II/arborx/access_traits.h @@ -62,8 +62,9 @@ namespace ArborXWrappers * This class defines a predicate used by ArborXWrappers::BVH to determine * for given points which of the bounding boxes used to build the * ArborXWrappers::BVH intersect with them. + * @note The class is not supposed to be used in polymorphic context. */ - class PointIntersectPredicate : public PointPredicate + class PointIntersectPredicate : private PointPredicate { public: /** @@ -73,6 +74,10 @@ namespace ArborXWrappers template PointIntersectPredicate( const std::vector> &points); + + // We need these since we inherit privately to avoid polymorphic use. + using PointPredicate::get; + using PointPredicate::size; }; @@ -81,8 +86,9 @@ namespace ArborXWrappers * This class defines a predicate used by ArborXWrappers::BVH to determine * for given points which are the nearest bounding boxes/points among the ones * used to build the ArborXWrappers::BVH. + * @note The class is not supposed to be used in polymorphic context. */ - class PointNearestPredicate : public PointPredicate + class PointNearestPredicate : private PointPredicate { public: /** @@ -100,6 +106,10 @@ namespace ArborXWrappers unsigned int get_n_nearest_neighbors() const; + // We need these since we inherit privately to avoid polymorphic use. + using PointPredicate::get; + using PointPredicate::size; + private: unsigned int n_nearest_neighbors; }; @@ -142,8 +152,9 @@ namespace ArborXWrappers * This class is used by ArborXWrappers::BVH to determine for given bounding * boxes which of the bounding boxes used to build the ArborXWrappers::BVH * intersect with them. + * @note The class is not supposed to be used in polymorphic context. */ - class BoundingBoxIntersectPredicate : public BoundingBoxPredicate + class BoundingBoxIntersectPredicate : private BoundingBoxPredicate { public: /** @@ -153,6 +164,10 @@ namespace ArborXWrappers template BoundingBoxIntersectPredicate( const std::vector> &bounding_boxes); + + // We need these since we inherit privately to avoid polymorphic use. + using BoundingBoxPredicate::get; + using BoundingBoxPredicate::size; }; @@ -160,8 +175,9 @@ namespace ArborXWrappers * This class is used by ArborXWrappers::BVH to determine for given bounding * boxes which are the nearest bounding boxes/points among the ones used to * build the ArborXWrappers::BVH. + * @note The class is not supposed to be used in polymorphic context. */ - class BoundingBoxNearestPredicate : public BoundingBoxPredicate + class BoundingBoxNearestPredicate : private BoundingBoxPredicate { public: /** @@ -180,6 +196,10 @@ namespace ArborXWrappers unsigned int get_n_nearest_neighbors() const; + // We need these since we inherit privately to avoid polymorphic use. + using BoundingBoxPredicate::get; + using BoundingBoxPredicate::size; + private: unsigned int n_nearest_neighbors; }; -- 2.39.5