47 |
|
return; |
48 |
|
} |
49 |
|
|
50 |
< |
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
50 |
> |
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
51 |
|
new ForkJoinPool(procs); |
52 |
< |
|
52 |
> |
|
53 |
|
System.out.print("parallelism = " + g.getParallelism()); |
54 |
|
System.out.print(" granularity = " + leafmaxcol); |
55 |
|
System.out.print(" rows = " + nx); |
56 |
|
System.out.print(" columns = " + ny); |
57 |
|
System.out.println(" steps = " + nt); |
58 |
< |
|
58 |
> |
|
59 |
|
oldm = new double[nx][ny]; |
60 |
|
newm = new double[nx][ny]; |
61 |
|
|
91 |
|
|
92 |
|
static final double dx = (xo - xu) / (nx - 1); |
93 |
|
static final double dy = (yo - yu) / (ny - 1); |
94 |
< |
static final double dt = (to - tu) / nt; |
94 |
> |
static final double dt = (to - tu) / nt; |
95 |
|
static final double dtdxsq = dt / (dx * dx); |
96 |
|
static final double dtdysq = dt / (dy * dy); |
97 |
|
|
98 |
|
|
99 |
|
// the function being applied across the cells |
100 |
< |
static final double f(double x, double y) { |
101 |
< |
return Math.sin(x) * Math.sin(y); |
100 |
> |
static final double f(double x, double y) { |
101 |
> |
return Math.sin(x) * Math.sin(y); |
102 |
|
} |
103 |
|
|
104 |
|
// random starting values |
105 |
|
|
106 |
< |
static final double randa(double x, double t) { |
107 |
< |
return 0.0; |
106 |
> |
static final double randa(double x, double t) { |
107 |
> |
return 0.0; |
108 |
|
} |
109 |
< |
static final double randb(double x, double t) { |
110 |
< |
return Math.exp(-2*t) * Math.sin(x); |
109 |
> |
static final double randb(double x, double t) { |
110 |
> |
return Math.exp(-2*t) * Math.sin(x); |
111 |
|
} |
112 |
< |
static final double randc(double y, double t) { |
113 |
< |
return 0.0; |
112 |
> |
static final double randc(double y, double t) { |
113 |
> |
return 0.0; |
114 |
|
} |
115 |
< |
static final double randd(double y, double t) { |
116 |
< |
return Math.exp(-2*t) * Math.sin(y); |
115 |
> |
static final double randd(double y, double t) { |
116 |
> |
return Math.exp(-2*t) * Math.sin(y); |
117 |
|
} |
118 |
< |
static final double solu(double x, double y, double t) { |
119 |
< |
return Math.exp(-2*t) * Math.sin(x) * Math.sin(y); |
118 |
> |
static final double solu(double x, double y, double t) { |
119 |
> |
return Math.exp(-2*t) * Math.sin(x) * Math.sin(y); |
120 |
|
} |
121 |
|
|
122 |
|
|
132 |
|
ub = upperBound; |
133 |
|
time = timestep; |
134 |
|
} |
135 |
< |
|
135 |
> |
|
136 |
|
public void compute() { |
137 |
|
if (ub - lb > leafmaxcol) { |
138 |
|
int mid = (lb + ub) >>> 1; |
194 |
|
|
195 |
|
// the original version from cilk |
196 |
|
final void origcompstripe(double[][] newMat, double[][] oldMat) { |
197 |
< |
|
197 |
> |
|
198 |
|
final int llb = (lb == 0) ? 1 : lb; |
199 |
|
final int lub = (ub == nx) ? nx - 1 : ub; |
200 |
|
|
252 |
|
} |
253 |
|
|
254 |
|
if (ub == nx) { |
255 |
< |
double[] v = m[nx - 1]; |
255 |
> |
double[] v = m[nx - 1]; |
256 |
|
double y = yu; |
257 |
|
for (int b = 0; b < ny; b++) { |
258 |
|
y += dy; |