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