/usr/share/doc/rheolef-doc/examples/neumann-laplace.cc is in rheolef-doc 6.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #include "rheolef.h"
using namespace rheolef;
using namespace std;
size_t d;
Float f (const point& x) { return 1; }
Float g (const point& x) { return -0.5/d; }
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
d = omega.dimension();
space Xh (omega, argv[2]);
trial u (Xh); test v (Xh);
form m = integrate (u*v);
form a = integrate (dot(grad(u),grad(v)));
field b = m*field(Xh,1);
field lh = integrate (f*v) + integrate ("boundary", g*v);
csr<Float> A = {{ a.uu(), b.u()},
{trans(b.u()), 0 }};
vec<Float> B = { lh.u(), 0 };
A.set_symmetry(true);
solver sa = ldlt(A);
vec<Float> U = sa.solve (B);
field uh(Xh);
uh.set_u() = U [range(0,uh.u().size())];
Float lambda = (U.size() == uh.u().size()+1) ? U [uh.u().size()] : 0;
#ifdef _RHEOLEF_HAVE_MPI
mpi::broadcast (U.comm(), lambda, U.comm().size() - 1);
#endif // _RHEOLEF_HAVE_MPI
dout << uh
<< "lambda" << lambda << endl;
}
|