From c04b584ce6acef8af3e247a3f7eba445a14bd38b Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Tue, 13 Feb 2024 13:15:15 +0100 Subject: [PATCH] added concept for orthtree without data --- .../doc/Orthtree/Concepts/OrthtreeTraits.h | 8 +- .../Concepts/OrthtreeTraitsWithoutData.h | 76 +++++++++++++++++++ Orthtree/doc/Orthtree/PackageDescription.txt | 4 +- Orthtree/include/CGAL/Orthtree_traits_base.h | 48 ++++++------ Orthtree/include/CGAL/Orthtree_traits_point.h | 2 +- 5 files changed, 109 insertions(+), 29 deletions(-) create mode 100644 Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithoutData.h diff --git a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h index 43d54b8f861..81cff58c7f3 100644 --- a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h +++ b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h @@ -3,12 +3,14 @@ \cgalConcept The concept `OrthtreeTraits` defines the requirements for the - template parameter of the `CGAL::Orthtree` class. + template parameter of the `CGAL::Orthtree` class for a node type that stores data. + + \cgalRefines{OrthtreeTraitsWithoutData} \cgalHasModelsBegin - \cgalHasModels{CGAL::Orthtree_traits_point} + \cgalHasModels{CGAL::Orthtree_traits_point} \cgalHasModels{CGAL::Orthtree_traits_face_graph} - \cgalHasModels{CGAL::Orthtree_traits_base< K, dimension >} + \cgalHasModels{CGAL::Orthtree_traits_base} \cgalHasModelsEnd */ class OrthtreeTraits diff --git a/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithoutData.h b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithoutData.h new file mode 100644 index 00000000000..ab93b8db89f --- /dev/null +++ b/Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithoutData.h @@ -0,0 +1,76 @@ +/*! + \ingroup PkgOrthtreeConcepts + \cgalConcept + + The concept `OrthtreeTraitsWithoutData` defines the requirements for the + template parameter of the `CGAL::Orthtree` class. + + \cgalHasModelsBegin + \cgalHasModels{CGAL::Orthtree_traits_without_data} + \cgalHasModels{CGAL::Orthtree_traits_point} + \cgalHasModels{CGAL::Orthtree_traits_face_graph} + \cgalHasModels{CGAL::Orthtree_traits_base} + \cgalHasModelsEnd +*/ +class OrthtreeTraitsWithoutData +{ +public: + + /// \name Types + /// @{ + using Node_index = unspecified_type; ///< An integer type for nodes + constexpr int dimension; ///< Dimension. + using FT = unspecified_type; ///< The number type of the %Cartesian coordinates of types `Point_d` + using Point_d = unspecified_type; ///< Point type. + using Bbox_d = unspecified_type; ///< Bounding box type. Must be constructible from a pair of `Point_d` types. + + /*! + A random access iterator type to enumerate the + %Cartesian coordinates of a point of type `Point_d`. + */ + using Cartesian_const_iterator_d = unspecified_type; + + /*! + * \brief Integral number type which can take on values indicating adjacency directions. + * + * Must be able to take on values ranging from 0 to the number of faces of the (hyper)rectangle type, equivalent to 2 * D. + */ + using Adjacency = unspecified_type; ///< Specify the adjacency directions + + /*! + * \brief Functor with an operator to create the bounding box of the root node. + * + * Provides the operator: + * `Bbox_d operator()()` + * + * The bounding box must enclose all elements contained by the tree. + * It may be tight-fitting. The orthtree constructor produces a bounding box surrounding this region. + * For traits which assign no data to each node, this can be defined to return a fixed region. + */ + using Construct_root_node_bbox = unspecified_type; + + /*! + * \brief Functor with an operator to construct a `Point_d` from an initializer list. + * + * For trees which use a different kernel for the bounding box type, + * the return type of this functor must match the kernel used by the bounding box type and not that of the contents. + */ + using Construct_point_d = unspecified_type; + + /// @} + + /// \name Operations + /// @{ + + /*! + * constructs an object of type `Construct_root_node_bbox`. + */ + Construct_root_node_bbox construct_root_node_bbox_object() const; + + /*! + * constructs an object of type `Construct_point_d`. + */ + Construct_point_d construct_point_d_object() const; + + /// @} +}; diff --git a/Orthtree/doc/Orthtree/PackageDescription.txt b/Orthtree/doc/Orthtree/PackageDescription.txt index a451ff36b52..efb42fd47b5 100644 --- a/Orthtree/doc/Orthtree/PackageDescription.txt +++ b/Orthtree/doc/Orthtree/PackageDescription.txt @@ -40,6 +40,7 @@ Quadtree, Octree and Orthtree Reference \cgalClassifedRefPages \cgalCRPSection{Concepts} +- `OrthtreeTraitsWithoutData` - `OrthtreeTraits` - `OrthtreeTraversal` - `CollectionPartitioningOrthtreeTraits` @@ -50,7 +51,8 @@ Quadtree, Octree and Orthtree Reference - `CGAL::Orthtree` \cgalCRPSection{Traits} -- `CGAL::Orthtree_traits_point` +- `CGAL::Orthtree_traits_without_data` +- `CGAL::Orthtree_traits_point` - `CGAL::Orthtree_traits_base` - `CGAL::Orthtree_traits_face_graph` diff --git a/Orthtree/include/CGAL/Orthtree_traits_base.h b/Orthtree/include/CGAL/Orthtree_traits_base.h index a97f0f74101..6a55b4f6193 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_base.h @@ -27,25 +27,25 @@ namespace CGAL { The class `Orthtree_traits_base` is a base class providing common choices for types and functors. The base class is extended by `CGAL::Orthtree_traits_point` and by `CGAL::Orthtree_traits_face_graph`. - \tparam K a model of `Kernel`. + \tparam GeomTraits a model of `Kernel`. \tparam dim dimension of the ambient Euclidean space. \sa `CGAL::Orthtree_traits_point` \sa `CGAL::Orthtree_traits_face_graph` */ -template +template struct Orthtree_traits_base { /// \name Types /// @{ using Node_index = std::size_t; - using Kernel = K; + using Kernel = GeomTraits; static constexpr int dimension = dim; - using FT = typename K::FT; - using Point_d = typename K::Point_d; - using Bbox_d = typename K::Iso_box_d; - using Sphere_d = typename K::Sphere_d; - using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_d; + using FT = typename GeomTraits::FT; + using Point_d = typename GeomTraits::Point_d; + using Bbox_d = typename GeomTraits::Iso_box_d; + using Sphere_d = typename GeomTraits::Sphere_d; + using Cartesian_const_iterator_d = typename GeomTraits::Cartesian_const_iterator_d; /*! * Adjacency type. * @@ -99,16 +99,16 @@ struct Orthtree_traits_base { } }; -template -struct Orthtree_traits_base { +template +struct Orthtree_traits_base { using Node_index = std::size_t; - using Kernel = K; + using Kernel = GeomTraits; static constexpr int dimension = 2; - using FT = typename K::FT; - using Point_d = typename K::Point_2; - using Bbox_d = typename K::Iso_rectangle_2; - using Sphere_d = typename K::Circle_2; - using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_2; + using FT = typename GeomTraits::FT; + using Point_d = typename GeomTraits::Point_2; + using Bbox_d = typename GeomTraits::Iso_rectangle_2; + using Sphere_d = typename GeomTraits::Circle_2; + using Cartesian_const_iterator_d = typename GeomTraits::Cartesian_const_iterator_2; enum Adjacency { LEFT, @@ -124,16 +124,16 @@ struct Orthtree_traits_base { } }; -template -struct Orthtree_traits_base { +template +struct Orthtree_traits_base { using Node_index = std::size_t; - using Kernel = K; + using Kernel = GeomTraits; static constexpr int dimension = 3; - using FT = typename K::FT; - using Point_d = typename K::Point_3; - using Bbox_d = typename K::Iso_cuboid_3; - using Sphere_d = typename K::Sphere_3; - using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_3; + using FT = typename GeomTraits::FT; + using Point_d = typename GeomTraits::Point_3; + using Bbox_d = typename GeomTraits::Iso_cuboid_3; + using Sphere_d = typename GeomTraits::Sphere_3; + using Cartesian_const_iterator_d = typename GeomTraits::Cartesian_const_iterator_3; enum Adjacency { LEFT, diff --git a/Orthtree/include/CGAL/Orthtree_traits_point.h b/Orthtree/include/CGAL/Orthtree_traits_point.h index 3eca22fd8ec..e992a03960c 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point.h @@ -72,7 +72,7 @@ void reassign_points( \cgalModels{OrthtreeTraits} \sa `CGAL::Octree` \sa `CGAL::Quadtree` - \sa `CGAL::Orthtree_traits_base` + \sa `CGAL::Orthtree_traits_base` */ template < typename GeomTraits,