$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: mariano.consoni_at_[hidden]
Date: 2008-07-24 11:25:00
Author: mconsoni
Date: 2008-07-24 11:24:59 EDT (Thu, 24 Jul 2008)
New Revision: 47761
URL: http://svn.boost.org/trac/boost/changeset/47761
Log:
- Limited to 80 cols.
- Replaced tabs.
Text files modified: 
   sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/random_test.cpp |    45 ++++++++++++++++++++++++--------------- 
   1 files changed, 28 insertions(+), 17 deletions(-)
Modified: sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/random_test.cpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/random_test.cpp	(original)
+++ sandbox/SOC/2008/spacial_indexing/libs/spatial_index/test/random_test.cpp	2008-07-24 11:24:59 EDT (Thu, 24 Jul 2008)
@@ -1,7 +1,13 @@
+//
+// Boost.SpatialIndex - performance example for quadtree
+//
 // Copyright 2008 Federico J. Fernandez.
 // Distributed under 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)
+//
+//  See http://www.boost.org/ for latest version.
+//
 
 
 #include <boost/spatial_index.hpp>
@@ -21,15 +27,15 @@
 
 double drandom(unsigned int upper_bound)
 {
-  double r;		/* random value in range [0,1) */
-  long int M;	/* user supplied upper boundary */
+  double r;      /* random value in range [0,1) */
+  long int M;    /* user supplied upper boundary */
 
   struct timeval tv;
   struct timezone tz;
   gettimeofday(&tv, &tz);
   srand(tv.tv_usec);
 
-  M = upper_bound;		/* Choose M. Upper bound */
+  M = upper_bound;  /* Choose M. Upper bound */
   r = (   (double)rand() / ((double)(RAND_MAX)+(double)(1)) );
 
   return r * M;
@@ -40,10 +46,12 @@
 {
   // data and indexed points
   std::vector<unsigned int> ids;
-  std::vector<geometry::point_xy<double> > points;	
+  std::vector<geometry::point_xy<double> > points;
 
   // plane
-  geometry::box<geometry::point_xy<double> > plane(geometry::point_xy<double>(0.0, 0.0), geometry::point_xy<double>(MAX_X, MAX_Y));
+  geometry::box<geometry::point_xy<double> > plane(
+      geometry::point_xy<double>(0.0, 0.0), 
+      geometry::point_xy<double>(MAX_X, MAX_Y));
 
   // number of points
   const unsigned int points_count = 500;
@@ -54,7 +62,8 @@
   typedef geometry::point_xy<double> point_type;
   typedef unsigned int value_type;
 
-  boost::spatial_index::spatial_index<point_type, value_type, boost::spatial_index::quadtree<point_type, value_type> > q(plane, 1);
+  boost::spatial_index::spatial_index<point_type, value_type, 
+      boost::spatial_index::quadtree<point_type, value_type> > q(plane, 1);
 
   // generate random data
   for(unsigned int i = 0; i < points_count; i++) {
@@ -64,7 +73,8 @@
     ids.push_back(i);
     points.push_back(geometry::point_xy<double>(x, y));
 
-    // std::cerr << "insert " << i << " -> (" << x << ", " << y << ")" << std::endl;
+    // std::cerr << "insert " << i << " -> (" << x << ", " << y << ")" 
+    //           << std::endl;
   }
 
   // insert data
@@ -80,20 +90,21 @@
 
       // compute random positions to do the searches, store the data
       for(unsigned int j=0; j < find_count; j++) {
-	unsigned int pos = (int) drandom(points_count);
-	search_positions.push_back(points[pos]);
-	search_data.push_back(pos);
+        unsigned int pos = (int) drandom(points_count);
+        search_positions.push_back(points[pos]);
+        search_data.push_back(pos);
       }
 
       // search data and compare
       for(unsigned int j=0; j < find_count; j++) {
-	unsigned int i = q.find(search_positions[j]);
-	std::cout << search_data[j] 
-		  << " - found in (" << geometry::get<0>(search_positions[j]) << "," << geometry::get<1>(search_positions[j])
-		  << ") --> " << i << std::endl;
-	
-	// check if the retrieved data is equal to the stored data
-	BOOST_CHECK_EQUAL(i, search_data[j]);
+        unsigned int i = q.find(search_positions[j]);
+        std::cout << search_data[j] 
+                  << " - found in (" << geometry::get<0>(search_positions[j])
+                  << "," << geometry::get<1>(search_positions[j])
+                  << ") --> " << i << std::endl;
+
+        // check if the retrieved data is equal to the stored data
+        BOOST_CHECK_EQUAL(i, search_data[j]);
       }
 
       return 0;