//Numbers below are Long.Max_Value
long lasttime = 0x7fffffffffffffffL;
long mintime = 0x7fffffffffffffffL;
- for (long run = 0; ((run < 3) || Math.abs(lasttime - runtime) * 64 > Math.min(lasttime, runtime)) && run < 7; run++) {
+ for (long run = 0; // jjenista - ONLY RUN ONCE!
+ run < 1; //((run < 3) || Math.abs(lasttime - runtime) * 64 > Math.min(lasttime, runtime)) && run < 7;
+ run++) {
runtime = run(args);
if (runtime < mintime) {
mintime = runtime;
}
//System.exit( 0 ); // GC STALLS FOREVER????
- System.gc();
+ //System.gc();
}
System.out.println("minimum runtime: " + mintime + " ms");
//treat LinkedList as a stack
Stack worklist = new Stack();
- // LinkedList worklist = new LinkedList();
- // worklist.addAll(Mesh.getBad(mesh));
HashMapIterator it = m.getBad(mesh).iterator();
while (it.hasNext()) {
worklist.push(it.next());
System.gc();
- // int zzz = 0;
-
-
-// long id = Time.getNewTimeId();
long startTime = System.currentTimeMillis();
while (!worklist.isEmpty()) {
Node bad_element = (Node) worklist.pop();
-// System.out.println("Bad Node"+ ((Element)mesh.getNodeData(bad_element)).toString());
+
if (bad_element != null && mesh.containsNode(bad_element)) {
cavity.initialize(bad_element);
cavity.build();
cavity.update();
-
-
- // boolean printChange = true; //(zzz % 10 == 0);
//remove old data
-// if( printChange ) {
-// System.out.println( "\n\n\nbad tri: "+mesh.getNodeData( bad_element ) );
- // System.out.println( "\npre nodes: " );
- //}
Node node;
for (Iterator iterator = cavity.getPre().getNodes().iterator(); 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: " );
- //}
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: " );
- //}
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);
}
- // worklist.addAll(cavity.getPost().newBad(mesh));
it = cavity.getPost().newBad(mesh).iterator();
while (it.hasNext()) {
worklist.push((Node)it.next());
if (mesh.containsNode(bad_element)) {
worklist.push((Node) bad_element);
}
- }// else {
- //System.out.println( "\n\n\nthis tri no longer a concern: "+mesh.getNodeData( bad_element ) );
- //}
-
- //++zzz;
- //System.out.println( "\n\ntris="+mesh.getNumNodes()+
- // " [wl="+worklist.size()+"]");
- //if( zzz == 10 ) { System.exit( 0 ); }
+ }
}
long time = System.currentTimeMillis() - startTime;
System.out.println("runtime: " + time + " ms");
//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);
}