ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/Heat.java
(Generate patch)

Comparing jsr166/src/test/loops/Heat.java (file contents):
Revision 1.2 by jsr166, Mon Sep 20 20:42:37 2010 UTC vs.
Revision 1.8 by jsr166, Mon Aug 10 03:13:33 2015 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   // Adapted from a cilk benchmark
# Line 47 | Line 47 | public class Heat {
47              return;
48          }
49  
50 <        ForkJoinPool g = procs == 0? new ForkJoinPool() :
50 >        ForkJoinPool g = (procs == 0) ? new ForkJoinPool() :
51              new ForkJoinPool(procs);
52  
53          System.out.print("parallelism = " + g.getParallelism());
# Line 150 | Line 150 | public class Heat {
150          }
151  
152  
153 <        /** Update all cells **/
153 >        /** Updates all cells. */
154          final void compstripe(double[][] newMat, double[][] oldMat) {
155  
156              // manually mangled to reduce array indexing
# Line 184 | Line 184 | public class Heat {
184                      nv[b] = cell
185                          + dtdysq * (prev    - twoc + next)
186                          + dtdxsq * (east[b] - twoc + west[b]);
187
187                  }
188              }
189  
190 <            edges(newMat, llb, lub,  tu + time * dt);
190 >            edges(newMat, llb, lub, tu + time * dt);
191          }
192  
193  
# Line 205 | Line 204 | public class Heat {
204                      newMat[a][b] = cell
205                          + dtdxsq * (oldMat[a+1][b] - twoc + oldMat[a-1][b])
206                          + dtdysq * (oldMat[a][b+1] - twoc + oldMat[a][b-1]);
208
207                  }
208              }
209  
# Line 213 | Line 211 | public class Heat {
211          }
212  
213  
214 <        /** Initialize all cells **/
214 >        /** Initializes all cells. */
215          final void init() {
216              final int llb = (lb == 0) ? 1 : lb;
217              final int lub = (ub == nx) ? nx - 1 : ub;
218  
219 <            for (int a = llb; a < lub; a++) {   /* inner nodes */
219 >            for (int a = llb; a < lub; a++) {   /* inner nodes */
220                  double[] ov = oldm[a];
221                  double x = xu + a * dx;
222                  double y = yu;
# Line 229 | Line 227 | public class Heat {
227              }
228  
229              edges(oldm, llb, lub, 0);
232
230          }
231  
232 <        /** Fill in edges with boundary values **/
232 >        /** Fills in edges with boundary values. */
233          final void edges(double [][] m, int llb, int lub, double t) {
234  
235              for (int a = llb; a < lub; a++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines