Actual source code: example1.edp
1
2
3
4
5
6
7
8
10 load "metis"
11 border a(t=0, pi) { x=cos(t); y=sin(t); label=1; }
12 border b(t=pi, 2*pi) { x=cos(t); y=sin(t); label=2; }
13 mesh Th = buildmesh(a(100) + b(100));
14 fespace Ph(Th, P0);
15 Ph part;
16 metisdual(part[], Th, 32);
17 plot(part, value = 1, fill = 1, wait = 1, cmm = "partitioning");
18 for(int i = 0; i < 32; ++i) {
19 Ph vis = (abs(part - i) < 1e-12) * 10;
20 int elt = 0;
21 for(int j = 0; j < Ph.ndof; ++j)
22 if(vis[][j] > 1e-12)
23 ++elt;
24 plot(vis, fill = 1, cmm = "partition " + i +", " + elt + " element(s)", wait = 1, nbiso = 32);
25 }