2
2
using namespace rheolef;
4
#include "neumann-laplace-assembly.h"
6
5
Float f (const point& x) { return 1; }
7
Float g (const point& x) { return -0.5/N; }
6
Float g (const point& x) { return -0.5/d; }
8
7
int main(int argc, char**argv) {
9
environment distributed (argc, argv);
8
environment rheolef (argc, argv);
10
9
geo omega (argv[1]);
11
N = omega.dimension();
10
d = omega.dimension();
12
11
space Xh (omega, argv[2]);
13
12
form m (Xh, Xh, "mass");
14
13
form a (Xh, Xh, "grad_grad");
15
field b = m*field(Xh,1.0);
16
field fh = interpolate(Xh, f);
17
space Wh (omega["boundary"], argv[2]);
18
field gh = interpolate(Wh, g);
19
form mb (Wh, Xh, "mass");
20
field mfh = m*fh + mb*gh;
21
distributor ext_ownership = mfh.u.ownership();
22
communicator comm = ext_ownership.comm();
23
size_t my_proc = comm.rank();
24
size_t last_proc = comm.size() - 1;
25
ext_ownership [last_proc+1]++;
26
csr<Float> A = neumann_laplace_assembly (ext_ownership, a.uu, b.u);
14
field b = m*field(Xh,1);
15
field lh = riesz(Xh, f) + riesz(Xh, "boundary", g);
16
csr<Float> A = {{ a.uu(), b.u()},
18
vec<Float> B = { lh.u(), 0 };
28
vec<Float> B (ext_ownership);
29
for (size_t i = 0; i < mfh.u.size(); i++) B[i] = mfh.u[i];
30
if (my_proc == last_proc) B [B.size()-1] = 0;
31
vec<Float> U (ext_ownership);
33
warning_macro ("retour de solve");
20
vec<Float> U = sa.solve (B);
35
warning_macro ("coucou {1}");
36
for (size_t i = 0; i < uh.u.size(); i++) uh.u[i] = U[i];
37
warning_macro ("coucou {2}");
38
Float lambda = (my_proc == last_proc) ? U [U.size()-1] : 0;
39
warning_macro ("coucou {3}");
22
uh.set_u() = U [range(0,uh.u().size())];
23
Float lambda = (U.size() == uh.u().size()+1) ? U [uh.u().size()] : 0;
40
24
#ifdef _RHEOLEF_HAVE_MPI
41
mpi::broadcast (comm, lambda, last_proc);
25
mpi::broadcast (U.comm(), lambda, U.comm().size() - 1);
42
26
#endif // _RHEOLEF_HAVE_MPI
43
warning_macro ("coucou {4}");
45
<< "lambda" << lambda << endl;
46
warning_macro ("coucou {5}");
28
<< "lambda" << lambda << endl;