Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:29

0001 // Boost.Geometry Index
0002 //
0003 // R-tree kmeans split algorithm implementation
0004 //
0005 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
0006 //
0007 // This file was modified by Oracle on 2021.
0008 // Modifications copyright (c) 2021 Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 //
0011 // Use, modification and distribution is subject to the Boost Software License,
0012 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP
0017 
0018 #include <boost/geometry/index/detail/rtree/node/concept.hpp>
0019 #include <boost/geometry/index/detail/rtree/visitors/insert.hpp>
0020 
0021 namespace boost { namespace geometry { namespace index {
0022 
0023 namespace detail { namespace rtree {
0024 
0025 // TODO: This should be defined in options.hpp
0026 // For now it's defined here to satisfy Boost header policy
0027 struct split_kmeans_tag {};
0028 
0029 namespace kmeans {
0030 
0031 // some details
0032 
0033 } // namespace kmeans
0034 
0035 // split_kmeans_tag
0036 // OR
0037 // split_clusters_tag and redistribute_kmeans_tag - then redistribute will probably slightly different interface
0038 // or some other than "redistribute"
0039 
0040 // 1. for this algorithm one probably MUST USE NON-STATIC NODES with node_default_tag
0041 //    or the algorithm must be changed somehow - to not store additional nodes in the current node
0042 //    but return excessive element/elements container instead (possibly pushable_array<1> or std::vector)
0043 //    this would also cause building of smaller trees since +1 element in nodes wouldn't be needed in different redistributing algorithms
0044 // 2. it is probably possible to add e.g. 2 levels of tree in one insert
0045 
0046 // Edge case is that every node split generates M + 1 children, in parent containing M nodes
0047 // result is 2M + 1 nodes in parent on this level
0048 // On next level the same, next the same and so on.
0049 // We have Depth*M+1 nodes in the root
0050 // The tree may then gain some > 1 levels in one insert
0051 // split::apply() manages this but special attention is required
0052 
0053 // which algorithm should be used to choose current node in traversing while inserting?
0054 // some of the currently used ones or some using mean values as well?
0055 
0056 // TODO
0057 // 1. Zmienic troche algorytm zeby przekazywal nadmiarowe elementy do split
0058 //    i pobieral ze split nadmiarowe elementy rodzica
0059 //    W zaleznosci od algorytmu w rozny sposob - l/q/r* powinny zwracac np pushable_array<1>
0060 //    wtedy tez is_overerflow (z R* insert?) bedzie nieportrzebne
0061 //    Dla kmeans zapewne std::vector, jednak w wezlach nadal moglaby byc pushable_array
0062 // 2. Fajnie byloby tez uproscic te wszystkie parametry root,parent,index itd. Mozliwe ze okazalyby sie zbedne
0063 // 3. Sprawdzyc czasy wykonywania i zajetosc pamieci
0064 // 4. Pamietac o parametryzacji kontenera z nadmiarowymi elementami
0065 // PS. Z R* reinsertami moze byc masakra
0066 
0067 template <typename MembersHolder>
0068 class split<MembersHolder, split_kmeans_tag>
0069 {
0070 protected:
0071     typedef typename MembersHolder::parameters_type parameters_type;
0072     typedef typename MembersHolder::box_type box_type;
0073     typedef typename MembersHolder::translator_type translator_type;
0074     typedef typename MembersHolder::allocators_type allocators_type;
0075     typedef typename MembersHolder::size_type size_type;
0076 
0077     typedef typename MembersHolder::node node;
0078     typedef typename MembersHolder::internal_node internal_node;
0079     typedef typename MembersHolder::leaf leaf;
0080 
0081 public:
0082     typedef index::detail::varray
0083         <
0084             typename rtree::elements_type<internal_node>::type::value_type,
0085             1
0086         > nodes_container_type;
0087 
0088     template <typename Node>
0089     static inline void apply(nodes_container_type & additional_nodes,
0090                              Node & n,
0091                              box_type & n_box,
0092                              parameters_type const& parameters,
0093                              translator_type const& translator,
0094                              allocators_type & allocators)
0095     {
0096 
0097     }
0098 };
0099 
0100 }} // namespace detail::rtree
0101 
0102 }}} // namespace boost::geometry::index
0103 
0104 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_KMEANS_SPLIT_HPP