Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71764 - in sandbox-branches/geometry/index_080_new: boost/geometry/extensions/index/rtree/linear boost/geometry/extensions/index/rtree/quadratic boost/geometry/extensions/index/rtree/visitors tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-05-06 11:04:04


Author: awulkiew
Date: 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
New Revision: 71764
URL: http://svn.boost.org/trac/boost/changeset/71764

Log:
corrected: gcc compile errors, wrong assert in remove; + minor changes
Text files modified:
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/linear.hpp | 3 +++
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp | 3 ---
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp | 5 +----
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 7 ++++++-
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/remove.hpp | 13 +++++++------
   sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/save.hpp | 2 +-
   sandbox-branches/geometry/index_080_new/tests/additional_sizes_and_times.cpp | 4 ++--
   7 files changed, 20 insertions(+), 17 deletions(-)

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/linear.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/linear.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/linear.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -16,6 +16,9 @@
 
 }}} // namespace boost::geometry::index
 
+//TEST
+// TODO
+
 #include <boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp>
 
 #endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_LINEAR_LINEAR_HPP

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -281,9 +281,6 @@
                 --remaining;
             }
         }
-
- assert(min_elems <= elements1.size() && elements1.size() <= max_elems);
- assert(min_elems <= elements2.size() && elements2.size() <= max_elems);
     }
 };
 

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -143,7 +143,7 @@
         // redistribute the rest of the elements
         while ( !elements_copy.empty() )
         {
- elements_type::reverse_iterator el_it = elements_copy.rbegin();
+ typename elements_type::reverse_iterator el_it = elements_copy.rbegin();
             bool insert_into_group1 = false;
 
             size_t elements1_count = elements1.size();
@@ -204,9 +204,6 @@
             assert(0 < remaining);
             --remaining;
         }
-
- assert(min_elems <= elements1.size() && elements1.size() <= max_elems);
- assert(min_elems <= elements2.size() && elements2.size() <= max_elems);
     }
 
     // sprawdzic szukanie najmniejszego powiekszenia wezla dla grupy1 i grupy2

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/insert.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/insert.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -96,11 +96,16 @@
         Translator const& tr)
     {
         node * second_node = rtree::create_node(Node());
+ Node & n2 = boost::get<Node>(*second_node);
 
         // redistribute elements
         Box box1, box2;
         redistribute_elements<Value, Translator, Box, Tag>::
- apply(n, boost::get<Node>(*second_node), box1, box2, min_elems, max_elems, tr);
+ apply(n, n2, box1, box2, min_elems, max_elems, tr);
+
+ // check numbers of elements
+ assert(min_elems <= rtree::elements_get(n).size() && rtree::elements_get(n).size() <= max_elems);
+ assert(min_elems <= rtree::elements_get(n2).size() && rtree::elements_get(n2).size() <= max_elems);
 
         // node is not the root
         if ( parent != 0 )

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/remove.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/remove.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/remove.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -84,12 +84,13 @@
                 m_is_underflow = elements.size() < m_min_elems_per_node;
             }
 
- // test - underflow state should be ok here
- assert(elements.size() < m_min_elems_per_node == m_is_underflow);
-
             // n is not root - adjust aabb
             if ( 0 != m_parent )
             {
+ // test underflow state should be ok here
+ // note that there may be less than min_elems elements in root
+ assert((elements.size() < m_min_elems_per_node) == m_is_underflow);
+
                 rtree::elements_get(*m_parent)[m_current_child_index].first
                     = rtree::elements_box<Box>(elements.begin(), elements.end(), m_tr);
             }
@@ -104,7 +105,7 @@
 
                 // reinsert elements from removed nodes
                 // begin with levels closer to the root
- for ( std::vector< std::pair<size_t, node*> >::reverse_iterator it = m_underflowed_nodes.rbegin();
+ for ( typename std::vector< std::pair<size_t, node*> >::reverse_iterator it = m_underflowed_nodes.rbegin();
                         it != m_underflowed_nodes.rend() ; ++it )
                 {
                     if ( boost::apply_visitor(is_leaf<Value, Box, Tag>(), *it->second) )
@@ -128,7 +129,7 @@
         elements_type & elements = rtree::elements_get(n);
 
         // find value and remove it
- for ( elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it )
+ for ( typename elements_type::iterator it = elements.begin() ; it != elements.end() ; ++it )
         {
             if ( m_tr.equals(*it, m_value) )
             {
@@ -182,7 +183,7 @@
         for ( typename elements_type::iterator it = elements.begin();
             it != elements.end() ; ++it )
         {
- visitors::insert<elements_type::value_type, Value, Translator, Box, Tag> insert_v(
+ visitors::insert<typename elements_type::value_type, Value, Translator, Box, Tag> insert_v(
                 m_root_node,
                 *it,
                 m_min_elems_per_node,

Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/save.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/save.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/save.hpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -29,7 +29,7 @@
>,
         size_t
>,
- typename Translator,
+ Translator,
     Box,
     Tag
>

Modified: sandbox-branches/geometry/index_080_new/tests/additional_sizes_and_times.cpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/tests/additional_sizes_and_times.cpp (original)
+++ sandbox-branches/geometry/index_080_new/tests/additional_sizes_and_times.cpp 2011-05-06 11:04:03 EDT (Fri, 06 May 2011)
@@ -17,8 +17,8 @@
 
     typedef bg::model::point<float, 2, bg::cs::cartesian> P;
     typedef bg::model::box<P> B;
- //typedef bgi::rtree<std::pair<B, size_t>, bgi::default_parameter, bgi::linear_tag> RT;
- typedef bgi::rtree<std::pair<B, size_t>, bgi::default_parameter, bgi::quadratic_tag> RT;
+ typedef bgi::rtree<std::pair<B, size_t>, bgi::default_parameter, bgi::linear_tag> RT;
+ //typedef bgi::rtree<std::pair<B, size_t>, bgi::default_parameter, bgi::quadratic_tag> RT;
 
     std::ifstream file_cfg("config.txt");
     size_t max_elems = 4;


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