1 # ifndef _RHEOLEF_UZAWA_H
2 # define _RHEOLEF_UZAWA_H
23 #include "rheolef/solver_option.h"
84 template<
class Matrix,
class Vector,
class Preconditioner,
class Real2>
85 int uzawa (
const Matrix &A, Vector &x,
const Vector &Mb,
const Preconditioner &
M,
86 const Real2& rho,
const solver_option& sopt = solver_option())
89 typedef typename Vector::float_type Real;
90 std::string label = (sopt.label !=
"" ? sopt.label :
"uzawa");
91 Vector
b =
M.solve(Mb);
92 Real norm2_b =
dot(Mb,
b);
93 Real norm2_r = norm2_b;
94 if (sopt.absolute_stopping || norm2_b == Real(0)) norm2_b = 1;
95 if (sopt.p_err) (*sopt.p_err) <<
"[" << label <<
"] #iteration residue" << std::endl;
96 for (sopt.n_iter = 0; sopt.n_iter <= sopt.max_iter; sopt.n_iter++) {
98 Vector r =
M.solve(Mr);
100 sopt.residue = sqrt(norm2_r/norm2_b);
101 if (sopt.p_err) (*sopt.p_err) <<
"[" << label <<
"] " << sopt.n_iter <<
" " << sopt.residue << std::endl;
102 if (sopt.residue <= sopt.tol)
return 0;
This file is part of Rheolef.
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
dot(x,y): see the expression page for the full documentation
DATA::size_type size_type