use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class VoronoiPerfTest method run.
public void run(final int nPts) {
final List pts = randomPoints(nPts);
final Stopwatch sw = new Stopwatch();
final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
builder.insertVertices(pts);
final Geometry g = builder.getEdges();
// System.out.println("# pts: " + pts.size() + " -- " +
// sw.getTimeString());
// System.out.println(g);
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class PerformanceTestRunner method runInternal.
private void runInternal(final Class clz) {
try {
final Constructor ctor = clz.getConstructor(String.class);
final PerformanceTestCase test = (PerformanceTestCase) ctor.newInstance("Name");
final int[] runSize = test.getRunSize();
final int runIter = test.getRunIterations();
final Method[] runMethod = findMethods(clz, RUN_PREFIX);
// do the run
test.setUp();
for (final int size : runSize) {
test.startRun(size);
for (final Method element : runMethod) {
final Stopwatch sw = new Stopwatch();
for (int iter = 0; iter < runIter; iter++) {
element.invoke(test);
}
// System.out.println(element.getName() + " : " + sw.getTimeString());
}
test.endRun();
}
test.tearDown();
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class PointInAreaPerfTest method run.
public void run() {
final GeometryFactory geomFactory = GeometryFactory.DEFAULT_3D;
final SineStarFactory ssFact = new SineStarFactory();
ssFact.setSize(1000.0);
ssFact.setNumPoints(2000);
ssFact.setArmLengthRatio(0.1);
ssFact.setNumArms(100);
final Geometry area = ssFact.newSineStar();
// System.out.println(area);
final Stopwatch sw = new Stopwatch();
final PointOnGeometryLocator pia = new MCIndexedPointInAreaLocator(area);
// PointInAreaLocator pia = new IntervalIndexedPointInAreaLocator(area);
// PointInAreaLocator pia = new SimplePointInAreaLocator(area);
final PointInAreaPerfTester perfTester = new PointInAreaPerfTester(geomFactory, area);
perfTester.setNumPoints(50000);
perfTester.setPIA(pia);
perfTester.run();
// System.out.println("Overall time: " + sw.getTimeString());
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class PointInAreaStressTester method run.
/**
* @return true if all point locations were computed correctly
*/
public boolean run() {
final Stopwatch sw = new Stopwatch();
// default is to use the simple, non-indexed tester
if (this.pia2 == null) {
this.pia2 = new SimplePointInAreaLocator(this.area);
}
final int ptGridWidth = (int) Math.sqrt(this.numPts);
final BoundingBox areaEnv = this.area.getBoundingBox();
final double xStep = areaEnv.getWidth() / (ptGridWidth - 1);
final double yStep = areaEnv.getHeight() / (ptGridWidth - 1);
for (int i = 0; i < ptGridWidth; i++) {
for (int j = 0; j < ptGridWidth; j++) {
// compute test point
final double x = this.geomFactory.makePrecise(0, areaEnv.getMinX() + i * xStep);
final double y = this.geomFactory.makePrecise(1, areaEnv.getMinY() + j * yStep);
final Point pt = new PointDoubleXY(x, y);
final boolean isEqual = testPIA(pt);
if (!isEqual) {
return false;
}
}
}
// System.out.println("Test completed in " + sw.getTimeString());
printStats();
return true;
}
use of com.revolsys.geometry.util.Stopwatch in project com.revolsys.open by revolsys.
the class TestPerfDistanceLinesPoints method test.
public void test(final Geometry[] pts, final Geometry target) {
if (this.verbose) {
// System.out.println("Query points = " + pts.length
// + " Target points = " + target.getVertexCount());
// if (! verbose) System.out.print(num + ", ");
}
final Stopwatch sw = new Stopwatch();
final double dist = 0.0;
for (int i = 0; i < MAX_ITER; i++) {
computeDistance(pts, target);
}
if (!this.verbose) {
// System.out.println(sw.getTimeString());
}
if (this.verbose) {
final String name = USE_INDEXED_DIST ? "IndexedFacetDistance" : "Distance";
// System.out.println(name + " - Run time: " + sw.getTimeString());
// System.out.println(" (Distance = " + dist + ")\n");
// System.out.println();
}
}
Aggregations