3 #ifndef DUNE_ISTL_SCHWARZ_HH
4 #define DUNE_ISTL_SCHWARZ_HH
13 #include <dune/common/timer.hh>
74 template<
class M,
class X,
class Y,
class C>
75 class OverlappingSchwarzOperator :
public AssembledLinearOperator<M,X,Y>
114 : _A_(A), communication(com)
118 virtual void apply (
const X& x, Y& y)
const
122 communication.project(y);
130 communication.project(y);
135 virtual const matrix_type&
getmat ()
const
141 const matrix_type& _A_;
142 const communication_type& communication;
162 template<
class X,
class C>
194 virtual field_type
dot (
const X& x,
const X& y)
197 communication.dot(x,y,result);
204 virtual double norm (
const X& x)
206 return communication.norm(x);
210 const communication_type& communication;
213 template<
class X,
class C>
226 static ScalarProduct*
construct(
const communication_type& comm)
228 return new ScalarProduct(comm);
238 template<
class M,
class X,
class Y,
class C>
280 ParSSOR (
const matrix_type&
A,
int n, field_type w,
const communication_type& c)
281 : _A_(A), _n(n), _w(w), communication(c)
289 virtual void pre (X& x, Y& b)
291 communication.copyOwnerToAll(x,x);
299 virtual void apply (X& v,
const Y& d)
301 for (
int i=0; i<_n; i++) {
305 communication.copyOwnerToAll(v,v);
317 const matrix_type& _A_;
323 const communication_type& communication;
328 template<
class T>
class ConstructionTraits;
354 template<
class X,
class Y,
class C,
class T=Preconditioner<X,Y> >
390 : preconditioner(p), communication(c)
398 virtual void pre (X& x, Y& b)
400 communication.copyOwnerToAll(x,x);
401 preconditioner.pre(x,b);
409 virtual void apply (X& v,
const Y& d)
411 preconditioner.apply(v,d);
412 communication.copyOwnerToAll(v,v);
415 template<
bool forward>
418 preconditioner.template apply<forward>(v,d);
419 communication.copyOwnerToAll(v,v);
429 preconditioner.post(x);
437 const communication_type& communication;
ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c)
Constructor.
Definition: schwarz.hh:280
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition: schwarz.hh:118
virtual void post(X &x)
Clean up.
Definition: schwarz.hh:313
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition: schwarz.hh:416
virtual void apply(X &v, const Y &d)
Apply the precondtioner.
Definition: schwarz.hh:299
virtual void post(X &x)
Clean up.
Definition: schwarz.hh:427
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition: gsetc.hh:612
Base class for scalar product and norm computation.
Definition: scalarproducts.hh:43
Implementation of the BCRSMatrix class.
C communication_type
The type of the communication object.
Definition: schwarz.hh:177
Definition: basearray.hh:19
Define base class for scalar product and norm.
OverlappingSchwarzScalarProduct(const communication_type &com)
Constructor needs to know the grid.
Definition: schwarz.hh:186
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Y range_type
The type of the range.
Definition: schwarz.hh:92
Some generic functions for pretty printing vectors and matrices.
virtual double norm(const X &x)
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
Definition: schwarz.hh:204
X::field_type field_type
The field type used by the vector type domain_type.
Definition: schwarz.hh:172
M matrix_type
The matrix type the preconditioner is for.
Definition: schwarz.hh:255
virtual const matrix_type & getmat() const
get the sequential assembled linear operator.
Definition: schwarz.hh:135
Definition: schwarz.hh:180
Y range_type
The range type of the preconditioner.
Definition: schwarz.hh:259
A parallel SSOR preconditioner.
Definition: schwarz.hh:252
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition: gsetc.hh:624
C communication_type
The type of the communication object.
Definition: schwarz.hh:263
Y range_type
The range type of the preconditioner.
Definition: schwarz.hh:367
Categories for the solvers.
Definition: solvercategory.hh:17
Matrix & A
Definition: matrixmatrix.hh:216
The category the precondtioner is part of.
Definition: schwarz.hh:268
BlockPreconditioner(T &p, const communication_type &c)
Constructor.
Definition: schwarz.hh:389
C communication_type
The type of the communication object to use.
Definition: schwarz.hh:219
X domain_type
The type of the vector to compute the scalar product on.
Definition: schwarz.hh:170
X domain_type
The domain type of the preconditioner.
Definition: schwarz.hh:257
Define general, extensible interface for operators. The available implementation wraps a matrix...
X::field_type field_type
The field type of the range.
Definition: schwarz.hh:94
static ScalarProduct * construct(const communication_type &comm)
Definition: schwarz.hh:226
The category the precondtioner is part of.
Definition: schwarz.hh:379
C communication_type
The type of the communication object.
Definition: schwarz.hh:99
Traits class for generically constructing non default constructable types.
Definition: novlpschwarz.hh:326
The solver category.
Definition: scalarproducts.hh:82
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition: schwarz.hh:127
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:26
M matrix_type
The type of the matrix we operate on.
Definition: schwarz.hh:82
X domain_type
The domain type of the preconditioner.
Definition: schwarz.hh:362
virtual field_type dot(const X &x, const X &y)
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition: schwarz.hh:194
Block parallel preconditioner.
Definition: schwarz.hh:355
X::field_type field_type
The field type of the preconditioner.
Definition: schwarz.hh:261
Choose the approriate scalar product for a solver category.
Definition: scalarproducts.hh:75
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition: schwarz.hh:289
Category for ovelapping solvers.
Definition: solvercategory.hh:25
The solver category.
Definition: schwarz.hh:103
C communication_type
The type of the communication object..
Definition: schwarz.hh:374
X::field_type field_type
The field type of the preconditioner.
Definition: schwarz.hh:369
OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition: schwarz.hh:113
Classes providing communication interfaces for overlapping Schwarz methods.
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition: schwarz.hh:398
X domain_type
The type of the domain.
Definition: schwarz.hh:87
Define general preconditioner interface.
OverlappingSchwarzScalarProduct< X, C > ScalarProduct
The type of the scalar product for the overlapping case.
Definition: schwarz.hh:217
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: schwarz.hh:409
Scalar product for overlapping schwarz methods.
Definition: schwarz.hh:163
Implementations of the inverse operator interface.