2
/// This file is part of Rheolef.
4
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
6
/// Rheolef is free software; you can redistribute it and/or modify
7
/// it under the terms of the GNU General Public License as published by
8
/// the Free Software Foundation; either version 2 of the License, or
9
/// (at your option) any later version.
11
/// Rheolef is distributed in the hope that it will be useful,
12
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
/// GNU General Public License for more details.
16
/// You should have received a copy of the GNU General Public License
17
/// along with Rheolef; if not, write to the Free Software
18
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
/// =========================================================================
22
using namespace rheolef;
25
Float f (const point& x) { return 1+(0.5/N)*(x[0]*(1-x[0])+x[1]*(1-x[1])+x[2]*(1-x[2])); }
26
Float g (const point& x) { return -0.5/N; }
27
int main(int argc, char**argv) {
28
environment parallel(argc, argv);
29
warning_macro ("neumann[1]");
31
warning_macro ("neumann[2]");
32
N = omega.dimension();
33
warning_macro ("neumann[3]");
34
space Vh (omega, "P1");
35
warning_macro ("neumann[4]");
36
field fh = interpolate(Vh, f);
37
warning_macro ("neumann[5]");
39
warning_macro ("neumann[6]");
40
form m (Vh, Vh, "mass");
41
warning_macro ("neumann[7]");
42
form a (Vh, Vh, "grad_grad");
43
warning_macro ("neumann[8]");
45
warning_macro ("neumann[9]");
46
size_t max_iter = 10000;
48
warning_macro ("neumann[10]");
49
int status = pcg (c.uu(), uh.u(), m.uu()*fh.u() + m.ub()*fh.b(), eye<Float>(), max_iter, tol, &pcerr);
50
warning_macro ("neumann[11]");
52
warning_macro ("neumann[12]");