3 #ifndef DUNE_ISTL_GSETC_HH
4 #define DUNE_ISTL_GSETC_HH
63 template<
int I, WithDiagType diag, WithRelaxType relax>
65 template<
class M,
class X,
class Y,
class K>
66 static void bltsolve (
const M&
A, X& v,
const Y& d,
const K& w)
69 typedef typename M::ConstRowIterator rowiterator;
70 typedef typename M::ConstColIterator coliterator;
71 typedef typename Y::block_type bblock;
74 rowiterator endi=A.end();
75 for (rowiterator i=A.begin(); i!=endi; ++i)
77 bblock rhs(d[i.index()]);
79 for (j=(*i).begin(); j.index()<i.index(); ++j)
80 (*j).mmv(v[j.index()],rhs);
84 template<
class M,
class X,
class Y,
class K>
85 static void butsolve (
const M&
A, X& v,
const Y& d,
const K& w)
88 typedef typename M::ConstRowIterator rowiterator;
89 typedef typename M::ConstColIterator coliterator;
90 typedef typename Y::block_type bblock;
93 rowiterator rendi=A.beforeBegin();
94 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
96 bblock rhs(d[i.index()]);
98 for (j=(*i).beforeEnd(); j.index()>i.index(); --j)
99 (*j).mmv(v[j.index()],rhs);
108 template<
class M,
class X,
class Y,
class K>
109 static void bltsolve (
const M&
A, X& v,
const Y& d,
const K& w)
114 template<
class M,
class X,
class Y,
class K>
115 static void butsolve (
const M&
A, X& v,
const Y& d,
const K& w)
123 template<
class M,
class X,
class Y,
class K>
124 static void bltsolve (
const M&
A, X& v,
const Y& d,
const K& )
128 template<
class M,
class X,
class Y,
class K>
129 static void butsolve (
const M&
A, X& v,
const Y& d,
const K& )
136 template<
class M,
class X,
class Y,
class K>
137 static void bltsolve (
const M& , X& v,
const Y& d,
const K& w)
142 template<
class M,
class X,
class Y,
class K>
143 static void butsolve (
const M& , X& v,
const Y& d,
const K& w)
151 template<
class M,
class X,
class Y,
class K>
152 static void bltsolve (
const M& , X& v,
const Y& d,
const K& )
156 template<
class M,
class X,
class Y,
class K>
157 static void butsolve (
const M& , X& v,
const Y& d,
const K& )
169 template<
class M,
class X,
class Y>
172 typename X::field_type w=1;
176 template<
class M,
class X,
class Y,
class K>
177 void bltsolve (
const M&
A, X& v,
const Y& d,
const K& w)
182 template<
class M,
class X,
class Y>
185 typename X::field_type w=1;
189 template<
class M,
class X,
class Y,
class K>
196 template<
class M,
class X,
class Y>
199 typename X::field_type w=1;
203 template<
class M,
class X,
class Y,
class K>
204 void butsolve (
const M&
A, X& v,
const Y& d,
const K& w)
209 template<
class M,
class X,
class Y>
212 typename X::field_type w=1;
216 template<
class M,
class X,
class Y,
class K>
225 template<
class M,
class X,
class Y,
int l>
228 typename X::field_type w=1;
232 template<
class M,
class X,
class Y,
class K,
int l>
238 template<
class M,
class X,
class Y,
int l>
241 typename X::field_type w=1;
245 template<
class M,
class X,
class Y,
class K,
int l>
252 template<
class M,
class X,
class Y,
int l>
255 typename X::field_type w=1;
259 template<
class M,
class X,
class Y,
class K,
int l>
265 template<
class M,
class X,
class Y,
int l>
268 typename X::field_type w=1;
272 template<
class M,
class X,
class Y,
class K,
int l>
288 template<
int I, WithRelaxType relax>
290 template<
class M,
class X,
class Y,
class K>
291 static void bdsolve (
const M&
A, X& v,
const Y& d,
const K& w)
294 typedef typename M::ConstRowIterator rowiterator;
295 typedef typename M::ConstColIterator coliterator;
298 rowiterator rendi=A.beforeBegin();
299 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
301 coliterator ii=(*i).find(i.index());
310 template<
class M,
class X,
class Y,
class K>
311 static void bdsolve (
const M&
A, X& v,
const Y& d,
const K& w)
319 template<
class M,
class X,
class Y,
class K>
320 static void bdsolve (
const M&
A, X& v,
const Y& d,
const K& )
331 template<
class M,
class X,
class Y>
334 typename X::field_type w=1;
338 template<
class M,
class X,
class Y,
class K>
339 void bdsolve (
const M&
A, X& v,
const Y& d,
const K& w)
347 template<
class M,
class X,
class Y,
int l>
350 typename X::field_type w=1;
354 template<
class M,
class X,
class Y,
class K,
int l>
377 #ifdef HAVE_BOOST_FUSION
379 template<
typename T11,
typename T12,
typename T13,
typename T14,
380 typename T15,
typename T16,
typename T17,
typename T18,
381 typename T19,
typename T21,
typename T22,
typename T23,
382 typename T24,
typename T25,
typename T26,
typename T27,
383 typename T28,
typename T29,
class K>
385 MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& x,
386 const MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& b,
390 boost::mpl::size<MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19> >::value;
396 template<
class M,
class X,
class Y,
class K>
397 static void dbgs (
const M& A, X& x,
const Y& b,
const K& w)
399 typedef typename M::ConstRowIterator rowiterator;
400 typedef typename M::ConstColIterator coliterator;
401 typedef typename Y::block_type bblock;
406 rowiterator endi=A.end();
407 for (rowiterator i=A.begin(); i!=endi; ++i)
410 coliterator endj=(*i).end();
411 coliterator j=(*i).begin();
412 for (; j.index()<i.index(); ++j)
413 (*j).mmv(x[j.index()],rhs);
414 coliterator diag=j++;
415 for (; j != endj; ++j)
416 (*j).mmv(x[j.index()],rhs);
425 #ifdef HAVE_BOOST_FUSION
427 template<
typename T11,
typename T12,
typename T13,
typename T14,
428 typename T15,
typename T16,
typename T17,
typename T18,
429 typename T19,
typename T21,
typename T22,
typename T23,
430 typename T24,
typename T25,
typename T26,
typename T27,
431 typename T28,
typename T29,
class K>
433 MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& x,
434 const MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& b,
438 boost::mpl::size<MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19> >::value;
444 template<
class M,
class X,
class Y,
class K>
445 static void bsorf (
const M& A, X& x,
const Y& b,
const K& w)
447 typedef typename M::ConstRowIterator rowiterator;
448 typedef typename M::ConstColIterator coliterator;
449 typedef typename Y::block_type bblock;
450 typedef typename X::block_type xblock;
455 if(A.begin()!=A.end())
458 rowiterator endi=A.end();
459 for (rowiterator i=A.begin(); i!=endi; ++i)
462 coliterator endj=(*i).end();
463 coliterator j=(*i).begin();
464 for (; j.index()<i.index(); ++j)
465 (*j).mmv(x[j.index()],rhs);
468 (*j).mmv(x[j.index()],rhs);
470 x[i.index()].axpy(w,v);
475 #ifdef HAVE_BOOST_FUSION
477 template<
typename T11,
typename T12,
typename T13,
typename T14,
478 typename T15,
typename T16,
typename T17,
typename T18,
479 typename T19,
typename T21,
typename T22,
typename T23,
480 typename T24,
typename T25,
typename T26,
typename T27,
481 typename T28,
typename T29,
class K>
483 MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& x,
484 const MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& b,
488 mpl::size<MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19> >::value;
494 template<
class M,
class X,
class Y,
class K>
495 static void bsorb (
const M& A, X& x,
const Y& b,
const K& w)
497 typedef typename M::ConstRowIterator rowiterator;
498 typedef typename M::ConstColIterator coliterator;
499 typedef typename Y::block_type bblock;
500 typedef typename X::block_type xblock;
505 if(A.begin()!=A.end())
508 rowiterator endi=A.beforeBegin();
509 for (rowiterator i=A.beforeEnd(); i!=endi; --i)
512 coliterator endj=(*i).end();
513 coliterator j=(*i).begin();
514 for (; j.index()<i.index(); ++j)
515 (*j).mmv(x[j.index()],rhs);
518 (*j).mmv(x[j.index()],rhs);
520 x[i.index()].axpy(w,v);
525 #ifdef HAVE_BOOST_FUSION
527 template<
typename T11,
typename T12,
typename T13,
typename T14,
528 typename T15,
typename T16,
typename T17,
typename T18,
529 typename T19,
typename T21,
typename T22,
typename T23,
530 typename T24,
typename T25,
typename T26,
typename T27,
531 typename T28,
typename T29,
class K>
533 MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& x,
534 const MultiTypeBlockVector<T21,T22,T23,T24,T25,T26,T27,T28,T29>& b,
538 boost::mpl::size<MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19> >::value;
544 template<
class M,
class X,
class Y,
class K>
545 static void dbjac (
const M& A, X& x,
const Y& b,
const K& w)
547 typedef typename M::ConstRowIterator rowiterator;
548 typedef typename M::ConstColIterator coliterator;
549 typedef typename Y::block_type bblock;
554 rowiterator endi=A.end();
555 for (rowiterator i=A.begin(); i!=endi; ++i)
558 coliterator endj=(*i).end();
559 coliterator j=(*i).begin();
560 for (; j.index()<i.index(); ++j)
561 (*j).mmv(x[j.index()],rhs);
564 (*j).mmv(x[j.index()],rhs);
573 template<
class M,
class X,
class Y,
class K>
574 static void dbgs (
const M&
A, X& x,
const Y& b,
const K& )
578 template<
class M,
class X,
class Y,
class K>
579 static void bsorf (
const M&
A, X& x,
const Y& b,
const K& )
583 template<
class M,
class X,
class Y,
class K>
584 static void bsorb (
const M&
A, X& x,
const Y& b,
const K& )
588 template<
class M,
class X,
class Y,
class K>
589 static void dbjac (
const M&
A, X& x,
const Y& b,
const K& )
599 template<
class M,
class X,
class Y,
class K>
600 void dbgs (
const M&
A, X& x,
const Y& b,
const K& w)
605 template<
class M,
class X,
class Y,
class K,
int l>
611 template<
class M,
class X,
class Y,
class K>
612 void bsorf (
const M&
A, X& x,
const Y& b,
const K& w)
617 template<
class M,
class X,
class Y,
class K,
int l>
623 template<
class M,
class X,
class Y,
class K>
624 void bsorb (
const M&
A, X& x,
const Y& b,
const K& w)
629 template<
class M,
class X,
class Y,
class K,
int l>
635 template<
class M,
class X,
class Y,
class K>
636 void dbjac (
const M&
A, X& x,
const Y& b,
const K& w)
641 template<
class M,
class X,
class Y,
class K,
int l>
void dbjac(const M &A, X &x, const Y &b, const K &w, BL< l >)
Jacobi step.
Definition: gsetc.hh:642
void ubutsolve(const M &A, X &v, const Y &d)
unit block upper triangular solve
Definition: gsetc.hh:210
static void bdsolve(const M &A, X &v, const Y &d, const K &)
Definition: gsetc.hh:320
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition: gsetc.hh:612
void bsorf(const M &A, X &x, const Y &b, const K &w, BL< l >)
SOR step.
Definition: gsetc.hh:618
static void bsorb(const M &A, X &x, const Y &b, const K &)
Definition: gsetc.hh:584
static void dbjac(const M &A, X &x, const Y &b, const K &w)
Definition: gsetc.hh:545
compile-time parameter for block recursion depth
Definition: gsetc.hh:40
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition: gsetc.hh:624
static void bltsolve(const M &, X &v, const Y &d, const K &)
Definition: gsetc.hh:152
void bdsolve(const M &A, X &v, const Y &d)
block diagonal solve, no relaxation
Definition: gsetc.hh:332
static void dbgs(const M &A, X &x, const Y &b, const K &)
Definition: gsetc.hh:574
Matrix & A
Definition: matrixmatrix.hh:216
static void bltsolve(const M &A, X &v, const Y &d, const K &)
Definition: gsetc.hh:124
static void dbgs(const M &A, X &x, const Y &b, const K &w)
Definition: gsetc.hh:397
void bsorb(const M &A, X &x, const Y &b, const K &w, BL< l >)
Backward SOR step.
Definition: gsetc.hh:630
static void bsorf(const M &A, X &x, const Y &b, const K &w)
Definition: gsetc.hh:445
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:109
static void bltsolve(const M &, X &v, const Y &d, const K &w)
Definition: gsetc.hh:137
WithRelaxType
Definition: gsetc.hh:49
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition: gsetc.hh:636
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:66
void butsolve(const M &A, X &v, const Y &d)
block upper triangular solve
Definition: gsetc.hh:197
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:115
static void butsolve(const M &, X &v, const Y &d, const K &w)
Definition: gsetc.hh:143
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:291
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:311
static void butsolve(const M &A, X &v, const Y &d, const K &)
Definition: gsetc.hh:129
void bltsolve(const M &A, X &v, const Y &d)
block lower triangular solve
Definition: gsetc.hh:170
static void bsorf(const M &A, X &x, const Y &b, const K &)
Definition: gsetc.hh:579
void ubltsolve(const M &A, X &v, const Y &d)
unit block lower triangular solve
Definition: gsetc.hh:183
static void dbjac(const M &A, X &x, const Y &b, const K &)
Definition: gsetc.hh:589
Definition: basearray.hh:19
void dbgs(const M &A, X &x, const Y &b, const K &w, BL< l >)
GS step.
Definition: gsetc.hh:606
WithDiagType
Definition: gsetc.hh:44
static void bsorb(const M &A, X &x, const Y &b, const K &w)
Definition: gsetc.hh:495
static void butsolve(const M &, X &v, const Y &d, const K &)
Definition: gsetc.hh:157
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition: gsetc.hh:85
void dbgs(const M &A, X &x, const Y &b, const K &w)
GS step.
Definition: gsetc.hh:600
Definition: matrixutils.hh:122