From f187a4212391e0ca13c7218d8a7ec369fc0f1b7e Mon Sep 17 00:00:00 2001 From: jjenista Date: Tue, 5 Apr 2011 23:02:07 +0000 Subject: [PATCH] static initializers cause a problem for DFJ, easy enough to work around them --- .../oooJava/DelaunayRefinement/Element.java | 3 +- .../oooJava/DelaunayRefinement/Mesh.java | 1 + .../SerialDelaunayRefinement.java | 69 ------------------- .../oooJava/DelaunayRefinement/Subgraph.java | 9 ++- .../oooJava/DelaunayRefinement/Tuple.java | 7 +- .../oooJava/DelaunayRefinement/makefile | 2 +- 6 files changed, 14 insertions(+), 77 deletions(-) diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Element.java b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Element.java index 64993165..d449df16 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Element.java +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Element.java @@ -7,9 +7,10 @@ public class Element { private final int dim; private final Tuple center; private final double radius_squared; - private final double MINANGLE = 30D; + private final double MINANGLE; public Element(Tuple a, Tuple b, Tuple c) { + MINANGLE = 30D; dim = 3; coords = new Tuple[3]; coords[0] = a; diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Mesh.java b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Mesh.java index 27c60318..e0b635f2 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Mesh.java +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Mesh.java @@ -1,4 +1,5 @@ public class Mesh { + protected HashMap edge_map; protected Node aNode; diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/SerialDelaunayRefinement.java b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/SerialDelaunayRefinement.java index 7e93e01f..735a337e 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/SerialDelaunayRefinement.java +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/SerialDelaunayRefinement.java @@ -180,65 +180,26 @@ public class SerialDelaunayRefinement { iterator.hasNext();) { node = (Node) iterator.next(); - //if( printChange ) { - // System.out.println( " "+mesh.getNodeData( node ) ); - //} mesh.removeNode(node); } //add new data - //if( printChange ) { - // System.out.println( "post nodes: " ); - //} //Takes up 1.7% of runtime for (Iterator iterator1 = cavity.getPost().getNodes().iterator(); iterator1.hasNext();) { node = (Node) iterator1.next(); - //if( printChange ) { - // System.out.println( " "+mesh.getNodeData( node ) ); - //} mesh.addNode(node); } - //if( printChange ) { - // System.out.println( "post edges: " ); - //} //Takes up 7.8% of runtime Edge_d edge; for (Iterator iterator2 = cavity.getPost().getEdges().iterator(); iterator2.hasNext();) { edge = (Edge_d) iterator2.next(); - //if( printChange ) { - // System.out.println( " "+mesh.getEdgeData( edge ) ); - //} mesh.addEdge(edge); } - - - /* - for (Iterator iterator1 = cavity.getPost().getNodes().iterator(); - iterator1.hasNext();) { - node = (Node) iterator1.next(); - - Element e = (Element)mesh.getNodeData( node ); - - int cntOutNeighbors = 0; - for (Iterator iterator = mesh.getOutNeighbors(node); iterator.hasNext();) { - ++cntOutNeighbors; - Node neighbor = (Node) iterator.next(); - } - - int dim = e.getDim(); - int out = cntOutNeighbors; - - if( dim == 3 && out < 3 ) { - System.out.println( e+" has dim="+dim+" and num out-neighbors in graph="+out ); - } - } - */ - } } @@ -263,38 +224,9 @@ public class SerialDelaunayRefinement { worklist.push( nodeForBadTri ); } - /* - if( appliedCavity != 1 ) { - - // if we couldn't even apply this cavity, just - // throw it back on the worklist - if( nodeForBadTri != null && nodeForBadTri.inGraph ) { - worklist.push( nodeForBadTri ); - } else { - System.out.println( "\n\n\nthis tri no longer a concern: "+ - mesh.getNodeData( nodeForBadTri ) ); - } - - } else { - // otherwise we did apply the cavity, - // and we may have introduced new bad triangles - HashMapIterator it2 = cavity.getPost().newBad(mesh).iterator(); - while (it2.hasNext()) { - worklist.push((Node)it2.next()); - } - } - */ - } // end scheduleMoreBad } // end phase 3 - //++zzz; - //Node aNode = (Node)lastAppliedCavity.getPost().getNodes().iterator().next(); - //mesh.discoverAllNodes( aNode ); - //System.out.println( "\n\ntris="+mesh.getNumNodes()+ - // " [wl="+worklist.size()+"]"); - //if( zzz == 10 ) { System.exit( 0 ); } - } // end while( !worklist.isEmpty() ) System.out.println( "yuh?" ); @@ -326,7 +258,6 @@ public class SerialDelaunayRefinement { //Put in cuz of static issues. Mesh m = new Mesh(); if (!m.verify(result)) { -// throw new IllegalStateException("refinement failed."); System.out.println("Refinement Failed."); System.exit(-1); } diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Subgraph.java b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Subgraph.java index 375602c1..900691b6 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Subgraph.java +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Subgraph.java @@ -1,11 +1,14 @@ public class Subgraph { - private final LinkedList nodes = new LinkedList(); - private final LinkedList border = new LinkedList(); - private final LinkedList edges = new LinkedList(); + private final LinkedList nodes; + private final LinkedList border; + private final LinkedList edges; public Subgraph() { + nodes = new LinkedList(); + border = new LinkedList(); + edges = new LinkedList(); } public boolean existsNode(Node n) { diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Tuple.java b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Tuple.java index 0e4ab8d1..5ab0723a 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Tuple.java +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/Tuple.java @@ -1,5 +1,9 @@ public class Tuple { + private final double coords[]; + private final int hashvalue; + + public Tuple(double a, double b, double c) { coords = new double[3]; coords[0] = a; @@ -147,7 +151,4 @@ public class Tuple { public double get(int i) { return coords[i]; } - - private final double coords[]; - private final int hashvalue; } diff --git a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/makefile b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/makefile index bfc6b8b2..7c9f2e3a 100644 --- a/Robust/src/Benchmarks/oooJava/DelaunayRefinement/makefile +++ b/Robust/src/Benchmarks/oooJava/DelaunayRefinement/makefile @@ -3,6 +3,6 @@ PROGRAM=SerialDelaunayRefinement SOURCE_FILES=SerialDelaunayRefinement.java NUM_OOO_WORKERS=24 -NUM_RCR_WORKERS=23 +NUM_RCR_WORKERS=7 include ../master-makefile -- 2.34.1