1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| #include "refine_unbalanced.h"
#define BGHOSTS 2
int main (int argc, char * argv[])
{
X0 = Y0 = -0.5;
init_grid (2);
int depth = argc > 1 ? atoi(argv[1]) : 6;
refine_unbalanced ((level <= depth && x <= -0.25 && y < 0 && y >= -0.25) ||
(level <= depth - 1 && y < 0), NULL);
output_cells (stdout);
scalar s[];
foreach()
s[] = 1.;
// check boundary conditions on leaves
foreach()
foreach_neighbor()
assert (s[] == 1.);
// rebalancing
int nf = 0;
foreach(reduction(+:nf))
nf++;
int npe;
MPI_Comm_size (MPI_COMM_WORLD, &npe);
nf = max(1, nf/npe);
scalar index[];
z_indexing (index, true);
foreach()
fprintf (qerr, "%g %g %g %d\n", x, y, z, min(npe - 1, (int)(index[]/nf)));
}
|