--- jsr166/src/test/loops/Heat.java 2010/10/16 16:22:56 1.4 +++ jsr166/src/test/loops/Heat.java 2015/09/12 19:09:00 1.9 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ // Adapted from a cilk benchmark @@ -47,7 +47,7 @@ public class Heat { return; } - ForkJoinPool g = procs == 0? new ForkJoinPool() : + ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : new ForkJoinPool(procs); System.out.print("parallelism = " + g.getParallelism()); @@ -95,8 +95,7 @@ public class Heat { static final double dtdxsq = dt / (dx * dx); static final double dtdysq = dt / (dy * dy); - - // the function being applied across the cells + /** the function being applied across the cells */ static final double f(double x, double y) { return Math.sin(x) * Math.sin(y); } @@ -119,9 +118,6 @@ public class Heat { return Math.exp(-2*t) * Math.sin(x) * Math.sin(y); } - - - static final class Compute extends RecursiveAction { final int lb; final int ub; @@ -149,7 +145,6 @@ public class Heat { compstripe(oldm, newm); } - /** Updates all cells. */ final void compstripe(double[][] newMat, double[][] oldMat) { @@ -184,15 +179,13 @@ public class Heat { nv[b] = cell + dtdysq * (prev - twoc + next) + dtdxsq * (east[b] - twoc + west[b]); - } } - edges(newMat, llb, lub, tu + time * dt); + edges(newMat, llb, lub, tu + time * dt); } - - // the original version from cilk + /** the original version from cilk */ final void origcompstripe(double[][] newMat, double[][] oldMat) { final int llb = (lb == 0) ? 1 : lb; @@ -205,14 +198,12 @@ public class Heat { newMat[a][b] = cell + dtdxsq * (oldMat[a+1][b] - twoc + oldMat[a-1][b]) + dtdysq * (oldMat[a][b+1] - twoc + oldMat[a][b-1]); - } } edges(newMat, llb, lub, tu + time * dt); } - /** Initializes all cells. */ final void init() { final int llb = (lb == 0) ? 1 : lb; @@ -229,7 +220,6 @@ public class Heat { } edges(oldm, llb, lub, 0); - } /** Fills in edges with boundary values. */