mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
geometry.index: docs - updated rtree times and linear picture, test - cosmetic change in experimental query iterator test, example - added experimental query iterator to the benchmark
[SVN r83944]
This commit is contained in:
parent
457e838a61
commit
dda8d2ac57
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
@ -39,9 +39,9 @@ non-overlapping boxes.
|
||||
[table
|
||||
[[] [linear algorithm] [quadratic algorithm] [R*-tree]]
|
||||
[[*Example structure*] [[$img/index/rtree/linear.png]] [[$img/index/rtree/quadratic.png]] [[$img/index/rtree/rstar.png]]]
|
||||
[[*1M Values inserts*] [2.11s] [2.98s] [5.49s]]
|
||||
[[*100k spatial queries*] [1.52s] [0.45s] [0.17s]]
|
||||
[[*100k knn queries*] [4.51s] [2.22s] [0.6s]]
|
||||
[[*1M Values inserts*] [1.65s] [2.51s] [4.96s]]
|
||||
[[*100k spatial queries*] [0.87s] [0.25s] [0.09s]]
|
||||
[[*100k knn queries*] [3.25s] [1.41s] [0.51s]]
|
||||
]
|
||||
|
||||
[heading Implementation details]
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
|
||||
#include <boost/geometry/index/rtree.hpp>
|
||||
|
||||
#include <boost/chrono.hpp>
|
||||
@ -47,9 +48,9 @@ int main()
|
||||
|
||||
typedef bg::model::point<double, 2, bg::cs::cartesian> P;
|
||||
typedef bg::model::box<P> B;
|
||||
typedef bgi::rtree<B, bgi::linear<32, 8> > RT;
|
||||
//typedef bgi::rtree<B, bgi::quadratic<32, 8> > RT;
|
||||
//typedef bgi::rtree<B, bgi::rstar<32, 8> > RT;
|
||||
typedef bgi::rtree<B, bgi::linear<16, 4> > RT;
|
||||
//typedef bgi::rtree<B, bgi::quadratic<8, 3> > RT;
|
||||
//typedef bgi::rtree<B, bgi::rstar<8, 3> > RT;
|
||||
|
||||
std::cout << "sizeof rtree: " << sizeof(RT) << std::endl;
|
||||
|
||||
@ -91,6 +92,25 @@ int main()
|
||||
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;
|
||||
for (size_t i = 0 ; i < queries_count ; ++i )
|
||||
{
|
||||
float x = coords[i].first;
|
||||
float y = coords[i].second;
|
||||
result.clear();
|
||||
std::copy(t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
|
||||
t.qend(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))),
|
||||
std::back_inserter(result));
|
||||
temp += result.size();
|
||||
}
|
||||
dur_t time = clock_t::now() - start;
|
||||
std::cout << time << " - query iterator(B) " << queries_count << " found " << temp << '\n';
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
clock_t::time_point start = clock_t::now();
|
||||
size_t temp = 0;
|
||||
@ -123,7 +143,7 @@ int main()
|
||||
{
|
||||
clock_t::time_point start = clock_t::now();
|
||||
size_t temp = 0;
|
||||
for (size_t i = 0 ; i < queries_count / 10 ; ++i )
|
||||
for (size_t i = 0 ; i < queries_count / 1 ; ++i )
|
||||
{
|
||||
float x = coords[i].first + 100;
|
||||
float y = coords[i].second + 100;
|
||||
|
@ -642,13 +642,6 @@ void exactly_the_same_outputs(Rtree const& rtree, Range1 const& output, Range2 c
|
||||
|
||||
// spatial query
|
||||
|
||||
template <typename Iterator, typename Container>
|
||||
void spatial_query_iterator(Iterator first, Iterator last, Container & container)
|
||||
{
|
||||
for ( ; first != last ; ++first )
|
||||
container.push_back(*first);
|
||||
}
|
||||
|
||||
template <typename Rtree, typename Value, typename Predicates>
|
||||
void spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> const& expected_output)
|
||||
{
|
||||
@ -672,8 +665,7 @@ void spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> con
|
||||
|
||||
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
|
||||
std::vector<Value> output3;
|
||||
//std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3));
|
||||
spatial_query_iterator(rtree.qbegin(pred), rtree.qend(pred), output3);
|
||||
std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3));
|
||||
|
||||
compare_outputs(rtree, output3, expected_output);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user