Quotes around otherwise ambiguous (underline containing) name
[geos.git] / tests / bigtest / TestSweepLineSpeed.cpp
blobb6b3a655caa97f64628af213fbbdf152b62b4d7e
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
14 **********************************************************************/
17 //#define _CRTDBG_MAP_ALLOC
18 #include <stdlib.h>
19 //#include <crtdbg.h>
21 #include <stdio.h>
22 #include <time.h>
24 #include <geos/geom/GeometryFactory.h>
25 #include <geos/geom/Polygon.h>
26 #include "bigtest.h"
28 using namespace geos::geom;
30 /**
31 * Run relate between two large geometries to test the performance
32 * of the sweepline intersection detection algorithm
35 void run(int nPts, GeometryFactory *fact) {
36 clock_t startTime, endTime;
37 double size=100.0;
38 double armLen=50.0;
39 int nArms=10;
40 Polygon *poly=GeometryTestFactory::createSineStar(fact,0.0,0.0,size,armLen,nArms,nPts);
41 Polygon *box=GeometryTestFactory::createSineStar(fact,0.0,size/2,size,armLen,nArms,nPts);
42 //Polygon *box=GeometryTestFactory::createBox(fact,0,0,1,100.0);
44 startTime=clock();
45 poly->intersects(box);
46 endTime=clock();
47 double totalTime=(double)(endTime-startTime);
48 printf( "n Pts: %i Executed in %6.0f ms.\n",nPts,totalTime);
49 //cout << "n Pts: " << nPts << " Executed in " << totalTime << endl;
51 // FIXME - mloskot: Why generated test geometries are not destroyed?"
54 int main(int /* argc */, char** /* argv[] */) {
56 GeometryFactory::unique_ptr factptr = GeometryFactory::create();
57 GeometryFactory* fact = factptr.get();
59 run(1000,fact);
60 run(2000,fact);
61 run(4000,fact);
62 run(8000,fact);
63 run(16000,fact);
64 run(32000,fact);
65 run(64000,fact);
66 run(128000,fact);
67 run(256000,fact);
68 run(512000,fact);
69 run(1024000,fact);
71 // _CrtDumpMemoryLeaks();
73 cout << "Done" << endl;
75 return 0;