|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72604 - in sandbox-branches/geometry/index_080_new: boost/geometry/extensions/index boost/geometry/extensions/index/rtree boost/geometry/extensions/index/rtree/linear boost/geometry/extensions/index/rtree/node boost/geometry/extensions/index/rtree/quadratic boost/geometry/extensions/index/rtree/rstar boost/geometry/extensions/index/rtree/visitors tests
From: adam.wulkiewicz_at_[hidden]
Date: 2011-06-15 14:12:02
Author: awulkiew
Date: 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
New Revision: 72604
URL: http://svn.boost.org/trac/boost/changeset/72604
Log:
node_poly is now default node, node_variant is enabled by tag dispatching instead of #define. default_variant_tag added. Asserts implemented as macro BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG).
Added:
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/assert.hpp (contents, props changed)
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node.hpp (contents, props changed)
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default.hpp (contents, props changed)
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp (contents, props changed)
Removed:
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node.hpp
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_poly.hpp
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_variant.hpp
Text files modified:
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/linear/redistribute_elements.hpp | 4 +-
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/options.hpp | 1
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/quadratic/redistribute_elements.hpp | 4 +-
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp | 2
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/insert.hpp | 53 +++++++++++++++++----------------------
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp | 17 +++++++-----
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp | 9 +++++-
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp | 2
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp | 2
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/destroy.hpp | 2
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/find.hpp | 4 +-
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 37 ++++++++++++++-------------
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp | 2
sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/remove.hpp | 5 +--
sandbox-branches/geometry/index_080_new/tests/additional_sizes_and_times.cpp | 15 +++++------
15 files changed, 80 insertions(+), 79 deletions(-)
Added: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/assert.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/assert.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -0,0 +1,27 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.SpatialIndex - ASSERT
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_ASSERT_HPP
+
+#ifdef NDEBUG
+
+#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM)
+
+#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG)
+
+#else
+
+#define BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(PARAM) PARAM
+
+#define BOOST_GEOMETRY_INDEX_ASSERT(CONDITION, TEXT_MSG) assert((CONDITION) && (TEXT_MSG))
+
+#endif
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_ASSERT_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-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -18,7 +18,7 @@
#include <boost/geometry/extensions/index/algorithms/area.hpp>
#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
@@ -51,7 +51,7 @@
{
size_t elements_count = elements.size();
- assert(2 <= elements_count);
+ BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements");
// find the lowest low, highest high
coordinate_type lowest_low = index::get<min_corner, DimensionIndex>(rtree::element_indexable(elements[0], tr));
Deleted: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
+++ (empty file)
@@ -1,85 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.Index - R-tree nodes
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP
-
-#ifndef BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES
-
-#include <boost/geometry/extensions/index/rtree/node/node_poly.hpp>
-
-#else
-
-#include <boost/geometry/extensions/index/rtree/node/node_variant.hpp>
-
-#endif // BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-// nodes elements
-
-template <typename Node>
-struct elements_type
-{
- typedef typename Node::elements_type type;
-};
-
-template <typename Node>
-inline typename elements_type<Node>::type &
-elements(Node & n)
-{
- return n.elements;
-}
-
-template <typename Node>
-inline typename elements_type<Node>::type const&
-elements(Node const& n)
-{
- return n.elements;
-}
-
-// uniform indexable getter for child node element's box and value's indexable
-// value's indexable version
-
-template <typename Value, typename Translator>
-inline typename Translator::indexable_type const&
-element_indexable(Value const& el, Translator const& tr)
-{
- return tr(el);
-};
-
-// elements box
-
-template <typename Box, typename FwdIter, typename Translator>
-inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
-{
- Box result;
-
- if (first == last)
- {
- geometry::assign_zero(result);
- return result;
- }
-
- geometry::convert(element_indexable(*first, tr), result);
- ++first;
-
- for ( ; first != last ; ++first )
- geometry::expand(result, element_indexable(*first, tr));
-
- return result;
-}
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_HPP
Added: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -0,0 +1,16 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - R-tree nodes
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
+
+#include <boost/geometry/extensions/index/rtree/node/node_default.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node_default_variant.hpp>
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_HPP
Added: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -0,0 +1,248 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - R-tree polymorphic nodes
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
+
+#include <vector>
+
+#include <boost/geometry/algorithms/expand.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// visitor forward declaration
+template <typename Value, typename Box, typename Tag, bool IsVisitableConst>
+struct visitor_poly;
+
+// nodes types
+
+template <typename Value, typename Box, typename Tag>
+struct node_poly
+{
+ virtual ~node_poly() {}
+ virtual void apply_visitor(visitor_poly<Value, Box, Tag, false> &) = 0;
+ virtual void apply_visitor(visitor_poly<Value, Box, Tag, true> &) const = 0;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct internal_node_poly : public node_poly<Value, Box, Tag>
+{
+ typedef std::vector<
+ std::pair<Box, node_poly<Value, Box, Tag> *>
+ > elements_type;
+
+ void apply_visitor(visitor_poly<Value, Box, Tag, false> & v) { v(*this); }
+ void apply_visitor(visitor_poly<Value, Box, Tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct leaf_poly : public node_poly<Value, Box, Tag>
+{
+ typedef std::vector<Value> elements_type;
+
+ void apply_visitor(visitor_poly<Value, Box, Tag, false> & v) { v(*this); }
+ void apply_visitor(visitor_poly<Value, Box, Tag, true> & v) const { v(*this); }
+
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Box, typename Tag>
+struct node
+{
+ typedef node_poly<Value, Box, Tag> type;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct internal_node
+{
+ typedef internal_node_poly<Value, Box, Tag> type;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct leaf
+{
+ typedef leaf_poly<Value, Box, Tag> type;
+};
+
+// nodes conversion
+
+template <typename Derived, typename Value, typename Box, typename Tag>
+inline Derived & get(node_poly<Value, Box, Tag> & n)
+{
+ assert(dynamic_cast<Derived*>(&n));
+ return static_cast<Derived&>(n);
+}
+
+template <typename Derived, typename Value, typename Box, typename Tag>
+inline Derived * get(node_poly<Value, Box, Tag> * n)
+{
+ assert(dynamic_cast<Derived*>(n));
+ return static_cast<Derived*>(n);
+}
+
+// visitor
+
+template <typename Value, typename Box, typename Tag>
+struct visitor_poly<Value, Box, Tag, true>
+{
+ typedef typename internal_node<Value, Box, Tag>::type internal_node;
+ typedef typename leaf<Value, Box, Tag>::type leaf;
+
+ virtual ~visitor_poly() {}
+
+ virtual void operator()(internal_node const&) = 0;
+ virtual void operator()(leaf const&) = 0;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct visitor_poly<Value, Box, Tag, false>
+{
+ typedef typename internal_node<Value, Box, Tag>::type internal_node;
+ typedef typename leaf<Value, Box, Tag>::type leaf;
+
+ virtual ~visitor_poly() {}
+
+ virtual void operator()(internal_node &) = 0;
+ virtual void operator()(leaf &) = 0;
+};
+
+// visitor traits
+
+template <typename Value, typename Box, typename Tag, bool IsVisitableConst>
+struct visitor
+{
+ typedef visitor_poly<Value, Box, Tag, IsVisitableConst> type;
+};
+
+template <typename Visitor, typename Visitable>
+inline void apply_visitor(Visitor &v, Visitable & n)
+{
+ n.apply_visitor(v);
+}
+
+// element's indexable type
+
+template <typename Value, typename Translator>
+struct element_indexable_type
+{
+ typedef typename Translator::indexable_type type;
+};
+
+template <typename Value, typename Box, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<Box, node_poly<Value, Box, Tag> *>,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Translator>
+inline typename Translator::indexable_type const&
+ element_indexable(Value const& el, Translator const& tr)
+{
+ return tr(el);
+};
+
+template <typename Value, typename Box, typename Tag, typename Translator>
+inline Box const&
+element_indexable(
+ std::pair< Box, node_poly<Value, Box, Tag> *> const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// create leaf node
+
+template <typename Value, typename Box, typename Tag>
+inline typename node<Value, Box, Tag>::type *
+create_node(leaf_poly<Value, Box, Tag> const& l)
+{
+ typedef typename node<Value, Box, Tag>::type node;
+ node * n = new leaf_poly<Value, Box, Tag>(l);
+ return n;
+}
+
+// create internal node
+
+template <typename Value, typename Box, typename Tag>
+inline typename node<Value, Box, Tag>::type *
+create_node(internal_node_poly<Value, Box, Tag> const& in)
+{
+ typedef typename node<Value, Box, Tag>::type node;
+ node * n = new internal_node_poly<Value, Box, Tag>(in);
+ return n;
+}
+
+// default node
+
+template <typename Value, typename Box, typename Tag>
+inline void delete_node(node_poly<Value, Box, Tag> * n)
+{
+ delete n;
+}
+
+// nodes elements
+
+template <typename Node>
+struct elements_type
+{
+ typedef typename Node::elements_type type;
+};
+
+template <typename Node>
+inline typename elements_type<Node>::type &
+ elements(Node & n)
+{
+ return n.elements;
+}
+
+template <typename Node>
+inline typename elements_type<Node>::type const&
+ elements(Node const& n)
+{
+ return n.elements;
+}
+
+// elements box
+
+template <typename Box, typename FwdIter, typename Translator>
+inline Box elements_box(FwdIter first, FwdIter last, Translator const& tr)
+{
+ Box result;
+
+ if (first == last)
+ {
+ geometry::assign_zero(result);
+ return result;
+ }
+
+ geometry::convert(element_indexable(*first, tr), result);
+ ++first;
+
+ for ( ; first != last ; ++first )
+ geometry::expand(result, element_indexable(*first, tr));
+
+ return result;
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_HPP
Added: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_default_variant.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -0,0 +1,185 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Boost.Index - R-tree variant nodes
+//
+// Copyright 2011 Adam Wulkiewicz.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
+
+#include <vector>
+#include <boost/variant.hpp>
+
+namespace boost { namespace geometry { namespace index {
+
+namespace detail { namespace rtree {
+
+// nodes default types
+
+template <typename Value, typename Box, typename Tag>
+struct internal_node_variant
+{
+ typedef std::vector<
+ std::pair<
+ Box,
+ typename node<Value, Box, Tag>::type *
+ >
+ > elements_type;
+
+ elements_type elements;
+};
+
+template <typename Value, typename Box, typename Tag>
+struct leaf_variant
+{
+ typedef std::vector<Value> elements_type;
+ elements_type elements;
+};
+
+// nodes traits
+
+template <typename Value, typename Box>
+struct node<Value, Box, default_variant_tag>
+{
+ typedef boost::variant<
+ leaf_variant<Value, Box, default_variant_tag>,
+ internal_node_variant<Value, Box, default_variant_tag>
+ > type;
+};
+
+template <typename Value, typename Box>
+struct internal_node<Value, Box, default_variant_tag>
+{
+ typedef internal_node_variant<Value, Box, default_variant_tag> type;
+};
+
+template <typename Value, typename Box>
+struct leaf<Value, Box, default_variant_tag>
+{
+ typedef leaf_variant<Value, Box, default_variant_tag> type;
+};
+
+// nodes conversion
+
+template <typename V, typename Value, typename Box, typename Tag>
+inline V & get(
+ boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > &v
+)
+{
+ return boost::get<V>(v);
+}
+
+template <typename V, typename Value, typename Box, typename Tag>
+inline V * get(boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > *v)
+{
+ return boost::get<V>(v);
+}
+
+// visitor traits
+
+template <typename Value, typename Box, bool IsVisitableConst>
+struct visitor<Value, Box, default_variant_tag, IsVisitableConst>
+{
+ typedef static_visitor<> type;
+};
+
+template <typename Visitor, typename Value, typename Box, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > & n)
+{
+ boost::apply_visitor(v, n);
+}
+
+template <typename Visitor, typename Value, typename Box, typename Tag>
+inline void apply_visitor(Visitor & v,
+ boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > const& n)
+{
+ boost::apply_visitor(v, n);
+}
+
+// element's indexable type
+
+template <typename Value, typename Box, typename Tag, typename Translator>
+struct element_indexable_type<
+ std::pair<
+ Box,
+ boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > *
+ >,
+ Translator
+>
+{
+ typedef Box type;
+};
+
+// element's indexable getter
+
+template <typename Value, typename Box, typename Tag, typename Translator>
+inline Box const&
+element_indexable(std::pair<
+ Box,
+ boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > *
+ > const& el,
+ Translator const&)
+{
+ return el.first;
+}
+
+// create leaf node
+
+template <typename Value, typename Box, typename Tag>
+inline typename node<Value, Box, Tag>::type *
+create_node(leaf_variant<Value, Box, Tag> const& l)
+{
+ typedef typename node<Value, Box, Tag>::type node;
+ node * n = new node(l);
+ return n;
+}
+
+// create internal node
+
+template <typename Value, typename Box, typename Tag>
+inline typename node<Value, Box, Tag>::type *
+create_node(internal_node_variant<Value, Box, Tag> const& in)
+{
+ typedef typename node<Value, Box, Tag>::type node;
+ node * n = new node(in);
+ return n;
+}
+
+// default node
+
+template <typename Value, typename Box, typename Tag>
+inline void delete_node(boost::variant<
+ leaf_variant<Value, Box, Tag>,
+ internal_node_variant<Value, Box, Tag>
+ > * n)
+{
+ delete n;
+}
+
+}} // namespace detail::rtree
+
+}}} // namespace boost::geometry::index
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_DEFAULT_VARIANT_HPP
Deleted: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_poly.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_poly.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
+++ (empty file)
@@ -1,197 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.Index - R-tree polymorphic nodes
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP
-
-#include <vector>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-// visitor forward declaration
-template <typename Value, typename Box, typename Tag, bool IsVisitableConst>
-struct visitor_poly;
-
-// nodes types
-
-template <typename Value, typename Box, typename Tag>
-struct node_poly
-{
- virtual ~node_poly() {}
- virtual void apply_visitor(visitor_poly<Value, Box, Tag, false> &) = 0;
- virtual void apply_visitor(visitor_poly<Value, Box, Tag, true> &) const = 0;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct internal_node_poly : public node_poly<Value, Box, Tag>
-{
- typedef std::vector<
- std::pair<Box, node_poly<Value, Box, Tag> *>
- > elements_type;
-
- void apply_visitor(visitor_poly<Value, Box, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Box, Tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct leaf_poly : public node_poly<Value, Box, Tag>
-{
- typedef std::vector<Value> elements_type;
-
- void apply_visitor(visitor_poly<Value, Box, Tag, false> & v) { v(*this); }
- void apply_visitor(visitor_poly<Value, Box, Tag, true> & v) const { v(*this); }
-
- elements_type elements;
-};
-
-// nodes traits
-
-template <typename Value, typename Box, typename Tag>
-struct node
-{
- typedef node_poly<Value, Box, Tag> type;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct internal_node
-{
- typedef internal_node_poly<Value, Box, Tag> type;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct leaf
-{
- typedef leaf_poly<Value, Box, Tag> type;
-};
-
-// nodes conversion
-
-template <typename Derived, typename Value, typename Box, typename Tag>
-inline Derived & get(node_poly<Value, Box, Tag> & n)
-{
- assert(dynamic_cast<Derived*>(&n));
- return dynamic_cast<Derived&>(n);
-}
-
-template <typename Derived, typename Value, typename Box, typename Tag>
-inline Derived * get(node_poly<Value, Box, Tag> * n)
-{
- assert(dynamic_cast<Derived*>(n));
- return dynamic_cast<Derived*>(n);
-}
-
-// visitor
-
-template <typename Value, typename Box, typename Tag>
-struct visitor_poly<Value, Box, Tag, true>
-{
- typedef typename internal_node<Value, Box, Tag>::type internal_node;
- typedef typename leaf<Value, Box, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node const&) = 0;
- virtual void operator()(leaf const&) = 0;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct visitor_poly<Value, Box, Tag, false>
-{
- typedef typename internal_node<Value, Box, Tag>::type internal_node;
- typedef typename leaf<Value, Box, Tag>::type leaf;
-
- virtual ~visitor_poly() {}
-
- virtual void operator()(internal_node &) = 0;
- virtual void operator()(leaf &) = 0;
-};
-
-// visitor traits
-
-template <typename Value, typename Box, typename Tag, bool IsVisitableConst>
-struct visitor
-{
- typedef visitor_poly<Value, Box, Tag, IsVisitableConst> type;
-};
-
-template <typename Visitor, typename Visitable>
-inline void apply_visitor(Visitor &v, Visitable & n)
-{
- n.apply_visitor(v);
-}
-
-// uniform indexable for child node element's box and value's indexable
-
-// value's indexable version
-
-template <typename Value, typename Translator>
-struct element_indexable_type
-{
- typedef typename Translator::indexable_type type;
-};
-
-// node element's indexable specialization
-
-template <typename Value, typename Box, typename Tag, typename Translator>
-struct element_indexable_type<
- std::pair<Box, node_poly<Value, Box, Tag> *>,
- Translator
->
-{
- typedef Box type;
-};
-
-template <typename Value, typename Box, typename Tag, typename Translator>
-inline Box const&
-element_indexable(
- std::pair< Box, node_poly<Value, Box, Tag> *> const& el,
- Translator const&)
-{
- return el.first;
-}
-
-// create leaf node
-
-template <typename Value, typename Box, typename Tag>
-inline typename node<Value, Box, Tag>::type *
- create_node(leaf_poly<Value, Box, Tag> const& l)
-{
- typedef typename node<Value, Box, Tag>::type node;
- node * n = new leaf_poly<Value, Box, Tag>(l);
- return n;
-}
-
-// create internal node
-
-template <typename Value, typename Box, typename Tag>
-inline typename node<Value, Box, Tag>::type *
- create_node(internal_node_poly<Value, Box, Tag> const& in)
-{
- typedef typename node<Value, Box, Tag>::type node;
- node * n = new internal_node_poly<Value, Box, Tag>(in);
- return n;
-}
-
-// default node
-
-template <typename Value, typename Box, typename Tag>
-inline void delete_node(node_poly<Value, Box, Tag> * n)
-{
- delete n;
-}
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_POLY_HPP
Deleted: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_variant.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/node/node_variant.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
+++ (empty file)
@@ -1,176 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Boost.Index - R-tree variant nodes
-//
-// Copyright 2011 Adam Wulkiewicz.
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP
-#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP
-
-#include <vector>
-#include <boost/variant.hpp>
-
-namespace boost { namespace geometry { namespace index {
-
-namespace detail { namespace rtree {
-
-template <typename Value, typename Box, typename Tag>
-struct node;
-
-// nodes default types
-
-template <typename Value, typename Box, typename Tag>
-struct internal_node_variant
-{
- typedef std::vector<
- std::pair<
- Box,
- typename node<Value, Box, Tag>::type *
- >
- > elements_type;
-
- elements_type elements;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct leaf_variant
-{
- typedef std::vector<Value> elements_type;
- elements_type elements;
-};
-
-// nodes traits
-
-template <typename Value, typename Box, typename Tag>
-struct node
-{
- typedef boost::variant<
- leaf_variant<Value, Box, Tag>,
- internal_node_variant<Value, Box, Tag>
- > type;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct internal_node
-{
- typedef internal_node_variant<Value, Box, Tag> type;
-};
-
-template <typename Value, typename Box, typename Tag>
-struct leaf
-{
- typedef leaf_variant<Value, Box, Tag> type;
-};
-
-// nodes conversion
-
-template <typename V, typename Variant>
-inline V & get(Variant &v)
-{
- return boost::get<V>(v);
-}
-
-template <typename V, typename Variant>
-inline V * get(Variant *v)
-{
- return boost::get<V>(v);
-}
-
-// visitor traits
-
-template <typename Value, typename Box, typename Tag, bool IsVisitableConst>
-struct visitor
-{
- typedef static_visitor<> type;
-};
-
-template <typename Visitor, typename Visitable>
-inline void apply_visitor(Visitor &v, Visitable &n)
-{
- boost::apply_visitor(v, n);
-}
-
-// uniform indexable for child node element's box and value's indexable
-
-// value's indexable version
-
-template <typename Value, typename Translator>
-struct element_indexable_type
-{
- typedef typename Translator::indexable_type type;
-};
-
-// node element's indexable specialization
-
-template <typename Value, typename Box, typename Tag, typename Translator>
-struct element_indexable_type<
- std::pair<
- Box,
- boost::variant<
- leaf_variant<Value, Box, Tag>,
- internal_node_variant<Value, Box, Tag>
- > *
- >,
- Translator
->
-{
- typedef Box type;
-};
-
-template <typename Value, typename Box, typename Tag, typename Translator>
-inline Box const&
-element_indexable(
- std::pair<
- Box,
- boost::variant<
- leaf_variant<Value, Box, Tag>,
- internal_node_variant<Value, Box, Tag>
- > *
- > const& el,
- Translator const&)
-{
- return el.first;
-}
-
-// create leaf node
-
-template <typename Value, typename Box, typename Tag>
-inline typename node<Value, Box, Tag>::type *
-create_node(leaf_variant<Value, Box, Tag> const& l)
-{
- typedef typename node<Value, Box, Tag>::type node;
- node * n = new node(l);
- return n;
-}
-
-// create internal node
-
-template <typename Value, typename Box, typename Tag>
-inline typename node<Value, Box, Tag>::type *
-create_node(internal_node_variant<Value, Box, Tag> const& in)
-{
- typedef typename node<Value, Box, Tag>::type node;
- node * n = new node(in);
- return n;
-}
-
-// default node
-
-template <typename Value, typename Box, typename Tag>
-inline void delete_node(
- boost::variant<
- leaf_variant<Value, Box, Tag>,
- internal_node_variant<Value, Box, Tag>
- > * n)
-{
- delete n;
-}
-
-}} // namespace detail::rtree
-
-}}} // namespace boost::geometry::index
-
-#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_NODE_VARIANT_HPP
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/options.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/options.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/options.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -27,6 +27,7 @@
// NodeTag
struct default_tag {};
+struct default_variant_tag {};
namespace options {
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-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -15,7 +15,7 @@
#include <boost/geometry/extensions/index/algorithms/area.hpp>
#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
@@ -43,7 +43,7 @@
{
size_t elements_count = elements.size();
- assert(2 <= elements_count);
+ BOOST_GEOMETRY_INDEX_ASSERT(2 <= elements_count, "wrong number of elements");
area_type greatest_free_area = 0;
seed1 = 0;
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -18,7 +18,7 @@
#include <boost/geometry/extensions/index/algorithms/overlap.hpp>
#include <boost/geometry/extensions/index/algorithms/union_area.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
namespace boost { namespace geometry { namespace index {
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/insert.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/insert.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -15,8 +15,6 @@
#include <boost/geometry/extensions/index/algorithms/area.hpp>
#include <boost/geometry/extensions/index/algorithms/distance_sqr.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
-
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {
@@ -48,10 +46,11 @@
// TODO: awulkiew - change second point_type to the point type of the Indexable?
typedef typename index::default_distance_sqr_result<point_type, point_type>::type distance_sqr_type;
- assert(parent != 0);
+ BOOST_GEOMETRY_INDEX_ASSERT(parent, "node shouldn't be the root node");
const size_t reinserted_elements_count = static_cast<size_t>(max_elems * 0.3f);
assert(0 < reinserted_elements_count);
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < reinserted_elements_count, "wrong value of elements to reinsert");
// calculate current node's center
point_type node_center;
@@ -147,9 +146,8 @@
template <typename Node>
inline void handle_possible_reinsert_or_split_of_root(Node &n)
{
- // reinsert should be handled only once for level
- assert(result_elements.empty());
-
+ BOOST_GEOMETRY_INDEX_ASSERT(result_elements.empty(), "reinsert should be handled only once for level");
+
result_relative_level = base::m_leafs_level - base::m_current_level;
// overflow
@@ -166,8 +164,7 @@
// node is root node
else
{
- // it's really the root node
- assert(&n == rtree::get<Node>(base::m_root_node));
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(base::m_root_node), "node should be the root node");
base::split(n);
}
}
@@ -219,7 +216,7 @@
inline void operator()(internal_node & n)
{
- assert(base::m_current_level < base::m_leafs_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level");
if ( base::m_current_level < base::m_level )
{
@@ -229,7 +226,7 @@
// further insert
if ( 0 < InsertIndex )
{
- assert(0 < base::m_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex");
if ( base::m_current_level == base::m_level - 1 )
{
@@ -239,7 +236,7 @@
}
else
{
- assert( base::m_level == base::m_current_level );
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level");
// push new child node
rtree::elements(n).push_back(base::m_element);
@@ -286,13 +283,13 @@
inline void operator()(internal_node & n)
{
- assert(base::m_current_level < base::m_leafs_level);
- assert(base::m_current_level < base::m_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level");
// next traversing step
base::traverse(*this, n);
- assert(0 < base::m_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < base::m_level, "illegal level value, level shouldn't be the root level for 0 < InsertIndex");
if ( base::m_current_level == base::m_level - 1 )
{
@@ -304,10 +301,9 @@
inline void operator()(leaf & n)
{
- assert(base::m_current_level == base::m_leafs_level);
- assert(base::m_level == base::m_current_level ||
- base::m_level == std::numeric_limits<size_t>::max());
-
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
+
rtree::elements(n).push_back(base::m_element);
base::handle_possible_split(n);
@@ -335,9 +331,9 @@
inline void operator()(internal_node & n)
{
- assert(base::m_current_level < base::m_leafs_level);
- assert(base::m_current_level < base::m_level);
-
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level");
+
// next traversing step
base::traverse(*this, n);
@@ -346,9 +342,8 @@
inline void operator()(leaf & n)
{
- assert(base::m_current_level == base::m_leafs_level);
- assert(base::m_level == base::m_current_level ||
- base::m_level == std::numeric_limits<size_t>::max());
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
rtree::elements(n).push_back(base::m_element);
@@ -385,10 +380,9 @@
, m_tr(tr), m_relative_level(relative_level)
{}
- inline void operator()(internal_node & n)
+ inline void operator()(internal_node & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n))
{
- // current node should be the root
- assert(&n == rtree::get<internal_node>(m_root));
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<internal_node>(m_root), "current node should be the root");
detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v(
m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level);
@@ -401,10 +395,9 @@
}
}
- inline void operator()(leaf & n)
+ inline void operator()(leaf & BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(n))
{
- // current node should be the root
- assert(&n == rtree::get<leaf>(m_root));
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<leaf>(m_root), "current node should be the root");
detail::rstar::level_insert<0, Element, Value, Options, Translator, Box> lins_v(
m_root, m_leafs_level, m_element, m_min_elements, m_max_elements, m_tr, m_relative_level);
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -18,7 +18,7 @@
#include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
@@ -68,7 +68,8 @@
// copy elements
Elements elements_copy = elements;
- assert(elements_copy.size() == max_elems + 1);
+
+ BOOST_GEOMETRY_INDEX_ASSERT(elements_copy.size() == max_elems + 1, "wrong number of elements");
// sort elements
element_axis_corner_less<element_type, Translator, Corner, AxisIndex> elements_less(tr);
@@ -288,7 +289,8 @@
}
else
{
- assert(axis == Dimension - 1);
+ BOOST_GEOMETRY_INDEX_ASSERT(axis == Dimension - 1, "unexpected axis value");
+
typedef typename Elements::value_type element_type;
element_axis_corner_less<element_type, Translator, Corner, Dimension - 1> less(tr);
std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less);
@@ -302,7 +304,8 @@
template <typename Elements, typename Translator>
static inline void apply(Elements & elements, const size_t axis, const size_t index, Translator const& tr)
{
- assert(axis == 0);
+ BOOST_GEOMETRY_INDEX_ASSERT(axis == 0, "unexpected axis value");
+
typedef typename Elements::value_type element_type;
element_axis_corner_less<element_type, Translator, Corner, 0> less(tr);
std::partial_sort(elements.begin(), elements.begin() + index, elements.end(), less);
@@ -353,9 +356,9 @@
// TODO: awulkiew - get rid of following static_casts?
- assert(split_axis < index::traits::dimension<Box>::value);
- assert(split_corner == static_cast<size_t>(min_corner) || split_corner == static_cast<size_t>(max_corner));
- assert(min_elems <= split_index && split_index <= max_elems - min_elems + 1);
+ BOOST_GEOMETRY_INDEX_ASSERT(split_axis < index::traits::dimension<Box>::value, "unexpected value");
+ BOOST_GEOMETRY_INDEX_ASSERT(split_corner == static_cast<size_t>(min_corner) || split_corner == static_cast<size_t>(max_corner), "unexpected value");
+ BOOST_GEOMETRY_INDEX_ASSERT(min_elems <= split_index && split_index <= max_elems - min_elems + 1, "unexpected value");
// TODO: awulkiew - check if std::partial_sort produces the same result as std::sort
if ( split_corner == static_cast<size_t>(min_corner) )
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/rtree.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -14,11 +14,15 @@
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
+#include <boost/geometry/extensions/index/assert.hpp>
+
#include <boost/geometry/extensions/index/translator/translator.hpp>
#include <boost/geometry/extensions/index/rtree/options.hpp>
#include <boost/geometry/extensions/index/rtree/filters.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
+
#include <boost/geometry/extensions/index/rtree/visitors/find.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/destroy.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/insert.hpp>
@@ -104,7 +108,8 @@
void remove(value_type const& value)
{
// TODO: awulkiew - assert for correct value
- assert(0 < m_values_count);
+
+ BOOST_GEOMETRY_INDEX_ASSERT(0 < m_values_count, "can't remove, there is no elements in the rtree");
detail::rtree::visitors::remove<value_type, options_type, translator_type, box_type>
remove_v(m_root, m_leafs_level, value, m_min_elems_per_node, m_max_elems_per_node, m_translator);
@@ -128,7 +133,7 @@
void clear()
{
// TODO: awulkiew - implement
- assert(false);
+ BOOST_GEOMETRY_INDEX_ASSERT(false, "not implemented");
}
template <typename Visitor>
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -11,7 +11,7 @@
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_BOXES_OK_HPP
#include <boost/geometry/algorithms/equals.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
namespace boost { namespace geometry { namespace index {
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -10,7 +10,7 @@
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_ARE_LEVELS_OK_HPP
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
namespace boost { namespace geometry { namespace index {
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/destroy.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/destroy.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/destroy.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -10,7 +10,7 @@
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_DELETE_HPP
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
namespace boost { namespace geometry { namespace index {
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/find.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/find.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/find.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -12,9 +12,9 @@
#include <boost/geometry/algorithms/intersects.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
-#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
+//#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
namespace boost { namespace geometry { namespace index {
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-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -12,7 +12,7 @@
#include <boost/geometry/extensions/index/algorithms/area.hpp>
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
namespace boost { namespace geometry { namespace index {
@@ -40,7 +40,7 @@
{
children_type & children = rtree::elements(n);
- assert(!children.empty());
+ BOOST_GEOMETRY_INDEX_ASSERT(!children.empty(), "can't choose the next node if children are empty");
size_t children_count = children.size();
@@ -110,8 +110,8 @@
, m_current_child_index(0)
, m_current_level(0)
{
- assert(m_relative_level <= leafs_level);
- assert(m_level <= m_leafs_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(m_relative_level <= leafs_level, "unexpected level value");
+ BOOST_GEOMETRY_INDEX_ASSERT(m_level <= m_leafs_level, "unexpected level value");
// TODO
// assert - check if Box is correct
}
@@ -137,8 +137,8 @@
template <typename Node>
inline void post_traverse(Node &n)
{
- // if node isn't a root check if parent and current_child_index isn't corrupted
- assert(0 == m_parent || &n == rtree::get<Node>(rtree::elements(*m_parent)[m_current_child_index].second));
+ BOOST_GEOMETRY_INDEX_ASSERT(0 == m_parent || &n == rtree::get<Node>(rtree::elements(*m_parent)[m_current_child_index].second),
+ "if node isn't the root current_child_index should be valid");
// handle overflow
if ( m_max_elems_per_node < rtree::elements(n).size() )
@@ -182,9 +182,11 @@
apply(n, n2, box1, box2, m_min_elems_per_node, m_max_elems_per_node, m_tr);
// check numbers of elements
- assert(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node);
- assert(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node);
-
+ BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n).size() && rtree::elements(n).size() <= m_max_elems_per_node,
+ "unexpected number of elements");
+ BOOST_GEOMETRY_INDEX_ASSERT(m_min_elems_per_node <= rtree::elements(n2).size() && rtree::elements(n2).size() <= m_max_elems_per_node,
+ "unexpected number of elements");
+
// node is not the root - just add the new node
if ( m_parent != 0 )
{
@@ -196,7 +198,7 @@
// node is the root - add level
else
{
- assert(&n == rtree::get<Node>(m_root_node));
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(m_root_node), "node should be the root");
// create new root and add nodes
node * new_root = rtree::create_node(internal_node());
@@ -254,7 +256,7 @@
inline void operator()(internal_node & n)
{
- assert(base::m_current_level < base::m_leafs_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level");
if ( base::m_current_level < base::m_level )
{
@@ -263,7 +265,7 @@
}
else
{
- assert( base::m_level == base::m_current_level );
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level, "unexpected level");
// push new child node
rtree::elements(n).push_back(base::m_element);
@@ -301,8 +303,8 @@
inline void operator()(internal_node & n)
{
- assert(base::m_current_level < base::m_leafs_level);
- assert(base::m_current_level < base::m_level);
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level < base::m_level, "unexpected level");
// next traversing step
base::traverse(*this, n);
@@ -312,10 +314,9 @@
inline void operator()(leaf & n)
{
- assert(base::m_current_level == base::m_leafs_level);
- assert( base::m_level == base::m_current_level ||
- base::m_level == std::numeric_limits<size_t>::max() );
-
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
+
rtree::elements(n).push_back(base::m_element);
base::post_traverse(n);
Modified: sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp
==============================================================================
--- sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp (original)
+++ sandbox-branches/geometry/index_080_new/boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp 2011-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -10,7 +10,7 @@
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_IS_LEAF_HPP
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
namespace boost { namespace geometry { namespace index {
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-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -10,7 +10,7 @@
#ifndef BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP
#define BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_VISITORS_REMOVE_HPP
-#include <boost/geometry/extensions/index/rtree/node.hpp>
+#include <boost/geometry/extensions/index/rtree/node/node.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/is_leaf.hpp>
@@ -104,8 +104,7 @@
// n is root node
else
{
- // current node must be a root
- assert(&n == rtree::get<internal_node>(m_root_node));
+ BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<internal_node>(m_root_node), "node must be the root");
// value not found
assert(m_is_value_removed);
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-06-15 14:11:59 EDT (Wed, 15 Jun 2011)
@@ -7,15 +7,14 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-//#define BOOST_GEOMETRY_INDEX_USE_VARIANT_NODES
+#include <iostream>
+#include <fstream>
+
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp>
-#include <iostream>
-#include <fstream>
-
#include <boost/timer.hpp>
#include <boost/foreach.hpp>
#include <boost/random.hpp>
@@ -31,11 +30,11 @@
typedef bg::model::box<P> B;
//typedef bgi::rtree<std::pair<B, size_t>, bgi::linear_tag> RT;
//typedef bgi::rtree<std::pair<B, size_t>, bgi::quadratic_tag> RT;
- typedef bgi::rtree<std::pair<B, size_t>, bgi::rstar_tag> RT;
- /*typedef bgi::rtree<
+ //typedef bgi::rtree<std::pair<B, size_t>, bgi::rstar_tag> RT;
+ typedef bgi::rtree<
std::pair<B, size_t>,
- bgi::options::rtree<bgi::reinsert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag>
- > RT;*/
+ bgi::options::rtree<bgi::insert_tag, bgi::choose_by_area_diff_tag, bgi::rstar_tag, bgi::default_tag>
+ > RT;
// load config file
std::ifstream file_cfg("config.txt");
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