|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85508 - in trunk/libs/geometry/index: example test/rtree
From: adam.wulkiewicz_at_[hidden]
Date: 2013-08-28 20:36:52
Author: awulkiew
Date: 2013-08-28 20:36:52 EDT (Wed, 28 Aug 2013)
New Revision: 85508
URL: http://svn.boost.org/trac/boost/changeset/85508
Log:
[geometry][index] test: added query iterators, benchmark: removed unneeded tests versions of query iterators.
Text files modified:
trunk/libs/geometry/index/example/benchmark_experimental.cpp | 122 +++------------------------------------
trunk/libs/geometry/index/test/rtree/test_rtree.hpp | 18 ++--
2 files changed, 20 insertions(+), 120 deletions(-)
Modified: trunk/libs/geometry/index/example/benchmark_experimental.cpp
==============================================================================
--- trunk/libs/geometry/index/example/benchmark_experimental.cpp Wed Aug 28 20:33:54 2013 (r85507)
+++ trunk/libs/geometry/index/example/benchmark_experimental.cpp 2013-08-28 20:36:52 EDT (Wed, 28 Aug 2013) (r85508)
@@ -8,8 +8,6 @@
// http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
-#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
-#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS_MOVE
#include <iostream>
@@ -176,7 +174,7 @@
std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n';
}
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
+
{
clock_t::time_point start = clock_t::now();
size_t temp = 0;
@@ -211,7 +209,7 @@
dur_t time = clock_t::now() - start;
std::cout << time << " - qbegin(B) qend() " << queries_count << " found " << temp << '\n';
}
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+
{
clock_t::time_point start = clock_t::now();
size_t temp = 0;
@@ -236,64 +234,14 @@
float x = coords[i].first;
float y = coords[i].second;
result.clear();
- RT::const_query_iterator_alt first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- RT::const_query_iterator_alt last = t.qend(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased2 qbegin(B) qend(B) " << queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- RT::const_query_iterator_alt last = t.qend();
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased2 qbegin(B) qend() " << queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt2 first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- RT::const_query_iterator_alt2 last = t.qend(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased3 qbegin(B) qend(B) " << queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt2 first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
- RT::const_query_iterator_alt2 last = t.qend();
+ RT::const_query_iterator first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10))));
+ RT::const_query_iterator last = t.qend();
std::copy(first, last, std::back_inserter(result));
temp += result.size();
}
dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased3 qbegin(B) qend() " << queries_count << " found " << temp << '\n';
+ std::cout << time << " - type-erased qbegin(B) qend() " << queries_count << " found " << temp << '\n';
}
-#endif
-#endif
{
clock_t::time_point start = clock_t::now();
@@ -338,7 +286,6 @@
std::cout << time << " - query(nearest(P, " << neighbours_count << ")) " << nearest_queries_count << " found " << temp << '\n';
}
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
{
clock_t::time_point start = clock_t::now();
size_t temp = 0;
@@ -373,7 +320,7 @@
dur_t time = clock_t::now() - start;
std::cout << time << " - qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
}
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+
{
clock_t::time_point start = clock_t::now();
size_t temp = 0;
@@ -398,63 +345,16 @@
float x = coords[i].first;
float y = coords[i].second;
result.clear();
- RT::const_query_iterator_alt first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
- RT::const_query_iterator_alt last = t.qend(bgi::nearest(P(x, y), neighbours_count));
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased2 qbegin(nearest(P, " << neighbours_count << ")) qend(n) " << nearest_queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < nearest_queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
- RT::const_query_iterator_alt last = t.qend();
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased2 qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < nearest_queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt2 first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
- RT::const_query_iterator_alt2 last = t.qend(bgi::nearest(P(x, y), neighbours_count));
- std::copy(first, last, std::back_inserter(result));
- temp += result.size();
- }
- dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased3 qbegin(nearest(P, " << neighbours_count << ")) qend(n) " << nearest_queries_count << " found " << temp << '\n';
- }
- {
- clock_t::time_point start = clock_t::now();
- size_t temp = 0;
- for (size_t i = 0 ; i < nearest_queries_count ; ++i )
- {
- float x = coords[i].first;
- float y = coords[i].second;
- result.clear();
- RT::const_query_iterator_alt2 first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
- RT::const_query_iterator_alt2 last = t.qend();
+ RT::const_query_iterator first = t.qbegin(bgi::nearest(P(x, y), neighbours_count));
+ RT::const_query_iterator last = t.qend();
std::copy(first, last, std::back_inserter(result));
temp += result.size();
}
dur_t time = clock_t::now() - start;
- std::cout << time << " - type-erased3 qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
+ std::cout << time << " - type-erased qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n';
}
-#endif
+
+#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
{
LS ls;
Modified: trunk/libs/geometry/index/test/rtree/test_rtree.hpp
==============================================================================
--- trunk/libs/geometry/index/test/rtree/test_rtree.hpp Wed Aug 28 20:33:54 2013 (r85507)
+++ trunk/libs/geometry/index/test/rtree/test_rtree.hpp 2013-08-28 20:36:52 EDT (Wed, 28 Aug 2013) (r85508)
@@ -18,7 +18,7 @@
// TEST
//#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
-//#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
+
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp>
@@ -668,13 +668,11 @@
exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(pred));
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
std::vector<Value> output3;
std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3));
compare_outputs(rtree, output3, expected_output);
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
{
typedef typename Rtree::const_query_iterator QI;
QI first = rtree.qbegin(pred);
@@ -682,9 +680,11 @@
std::vector<Value> output4;
std::copy(first, last, std::back_inserter(output4));
compare_outputs(rtree, output4, expected_output);
+ QI last2 = rtree.qend();
+ output4.clear();
+ std::copy(first, last2, std::back_inserter(output4));
+ compare_outputs(rtree, output4, expected_output);
}
-#endif
-#endif
}
// rtree specific queries tests
@@ -1039,13 +1039,11 @@
exactly_the_same_outputs(rtree, output, output2);
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
std::vector<Value> output3;
std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(bgi::nearest(pt, k)), std::back_inserter(output3));
compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance);
-#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
{
typedef typename Rtree::const_query_iterator QI;
QI first = rtree.qbegin(bgi::nearest(pt, k));
@@ -1053,9 +1051,11 @@
std::vector<Value> output4;
std::copy(first, last, std::back_inserter(output4));
compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance);
+ QI last2 = rtree.qend();
+ output4.clear();
+ std::copy(first, last, std::back_inserter(output4));
+ compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance);
}
-#endif
-#endif
}
// rtree nearest not found
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