|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84735 - in trunk/boost/geometry/index: . detail/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2013-06-10 18:24:10
Author: awulkiew
Date: 2013-06-10 18:24:10 EDT (Mon, 10 Jun 2013)
New Revision: 84735
URL: http://svn.boost.org/trac/boost/changeset/84735
Log:
[geometry][index]: added modification of other than root rtree internals after packing.
Text files modified:
trunk/boost/geometry/index/detail/rtree/pack_create.hpp | 13 ++++++++-----
trunk/boost/geometry/index/rtree.hpp | 10 ++++++++--
2 files changed, 16 insertions(+), 7 deletions(-)
Modified: trunk/boost/geometry/index/detail/rtree/pack_create.hpp
==============================================================================
--- trunk/boost/geometry/index/detail/rtree/pack_create.hpp Mon Jun 10 17:51:20 2013 (r84734)
+++ trunk/boost/geometry/index/detail/rtree/pack_create.hpp 2013-06-10 18:24:10 EDT (Mon, 10 Jun 2013) (r84735)
@@ -123,6 +123,7 @@
typedef typename Allocators::node_pointer node_pointer;
typedef rtree::node_auto_ptr<Value, Options, Translator, Box, Allocators> node_auto_ptr;
+ typedef typename Allocators::size_type size_type;
typedef typename traits::point_type<Box>::type point_type;
typedef typename traits::coordinate_type<point_type>::type coordinate_type;
@@ -141,7 +142,7 @@
public:
// Arbitrary iterators
template <typename InIt> inline static
- node_pointer apply(InIt first, InIt last,
+ node_pointer apply(InIt first, InIt last, size_type & values_count, size_type & leafs_level,
parameters_type const& parameters, Translator const& translator, Allocators & allocators)
{
typedef typename std::iterator_traits<InIt>::difference_type diff_type;
@@ -153,7 +154,7 @@
typedef std::pair<point_type, InIt> entry_type;
std::vector<entry_type> entries;
- std::size_t values_count = static_cast<std::size_t>(diff);
+ values_count = static_cast<size_type>(diff);
entries.reserve(values_count);
Box hint_box;
@@ -167,9 +168,10 @@
entries.push_back(std::make_pair(pt, first));
}
- subtree_elements_counts subtree_counts = calculate_subtree_elements_counts(values_count, parameters);
+ subtree_elements_counts subtree_counts = calculate_subtree_elements_counts(values_count, parameters, leafs_level);
internal_element el = per_level(entries.begin(), entries.end(), hint_box, values_count, subtree_counts,
parameters, translator, allocators);
+
return el.second;
}
@@ -290,14 +292,15 @@
}
inline static
- subtree_elements_counts calculate_subtree_elements_counts(std::size_t elements_count, parameters_type const& parameters)
+ subtree_elements_counts calculate_subtree_elements_counts(std::size_t elements_count, parameters_type const& parameters, size_type & leafs_level)
{
(void)parameters;
subtree_elements_counts res(1, 1);
+ leafs_level = 0;
std::size_t smax = parameters.get_max_elements();
- for ( ; smax < elements_count ; smax *= parameters.get_max_elements() )
+ for ( ; smax < elements_count ; smax *= parameters.get_max_elements(), ++leafs_level )
res.maxc = smax;
res.minc = parameters.get_min_elements() * (res.maxc / parameters.get_max_elements());
Modified: trunk/boost/geometry/index/rtree.hpp
==============================================================================
--- trunk/boost/geometry/index/rtree.hpp Mon Jun 10 17:51:20 2013 (r84734)
+++ trunk/boost/geometry/index/rtree.hpp 2013-06-10 18:24:10 EDT (Mon, 10 Jun 2013) (r84735)
@@ -241,8 +241,11 @@
{
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
typedef detail::rtree::pack<value_type, options_type, translator_type, box_type, allocators_type> pack;
- m_members.root = pack::apply(first, last,
+ size_type vc = 0, ll = 0;
+ m_members.root = pack::apply(first, last, vc, ll,
m_members.parameters(), m_members.translator(), m_members.allocators());
+ m_members.values_count = vc;
+ m_members.leafs_level = ll;
#else
BOOST_TRY
@@ -282,8 +285,11 @@
{
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
typedef detail::rtree::pack<value_type, options_type, translator_type, box_type, allocators_type> pack;
- m_members.root = pack::apply(::boost::begin(rng), ::boost::end(rng),
+ size_type vc = 0, ll = 0;
+ m_members.root = pack::apply(::boost::begin(rng), ::boost::end(rng), vc, ll,
m_members.parameters(), m_members.translator(), m_members.allocators());
+ m_members.values_count = vc;
+ m_members.leafs_level = ll;
#else
BOOST_TRY
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk