Procs p = new Procs2(NP, NP) ; |
on(p) { |
Range x = new BlockRange(N, p.dim(0), 1) ; // ghost width 1 |
Range y = new BlockRange(N, p.dim(1), 1) ; // ... |
float [[,]] u = new float [[x, y]] ; |
for(int parity = 0 ; parity < 2 ; parity++) { |
Adlib.writeHalo(u, widths) ; |
overall(i = x | 1 : N - 2) |
overall(j = y | 1 + (x.idx(i) + parity) % 2 : N - 2 : 2) |
u [i, j] = 0.25 * (u [i - 1, j] + u [i + 1, j] + u [i, j - 1] + u [i, j + 1]) ; |
} |
} |