11#include "multitypeblockvector.hh"
12#include "multitypeblockmatrix.hh"
14#include "istlexception.hh"
41 enum {recursion_level = l};
63 template<
int I, WithDiagType diag, WithRelaxType relax>
64 struct algmeta_btsolve {
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);
107 struct algmeta_btsolve<0,withdiag,withrelax> {
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)
122 struct algmeta_btsolve<0,withdiag,norelax> {
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& )
135 struct algmeta_btsolve<0,nodiag,withrelax> {
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)
150 struct algmeta_btsolve<0,nodiag,norelax> {
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>
190 void ubltsolve (
const M& A, X& v,
const Y& d,
const K& w)
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>
217 void ubutsolve (
const M& A, X& v,
const Y& d,
const K& w)
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>
289 struct algmeta_bdsolve {
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());
309 struct algmeta_bdsolve<0,withrelax> {
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)
318 struct algmeta_bdsolve<0,norelax> {
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>
374 struct algmeta_itsteps {
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>
384 static void dbgs (
const MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19>& A,
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>
432 static void bsorf (
const MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19>& A,
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>
482 static void bsorb (
const MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19>& A,
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>
532 static void dbjac (
const MultiTypeBlockMatrix<T11,T12,T13,T14,T15,T16,T17,T18,T19>& A,
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);
572 struct algmeta_itsteps<0> {
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>
606 void dbgs (
const M& A, X& x,
const Y& b,
const K& w,
BL<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>
618 void bsorf (
const M& A, X& x,
const Y& b,
const K& w,
BL<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>
630 void bsorb (
const M& A, X& x,
const Y& b,
const K& w,
BL<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>
642 void dbjac (
const M& A, X& x,
const Y& b,
const K& w,
BL<l> )
void bltsolve(const M &A, X &v, const Y &d)
block lower triangular solve
Definition: gsetc.hh:170
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition: gsetc.hh:624
void ubltsolve(const M &A, X &v, const Y &d)
unit block lower triangular solve
Definition: gsetc.hh:183
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition: gsetc.hh:636
void dbgs(const M &A, X &x, const Y &b, const K &w)
GS step.
Definition: gsetc.hh:600
void bsorf(const M &A, X &x, const Y &b, const K &w, BL< l >)
SOR step.
Definition: gsetc.hh:618
void dbjac(const M &A, X &x, const Y &b, const K &w, BL< l >)
Jacobi step.
Definition: gsetc.hh:642
void dbgs(const M &A, X &x, const Y &b, const K &w, BL< l >)
GS step.
Definition: gsetc.hh:606
void bltsolve(const M &A, X &v, const Y &d, const K &w, BL< l >)
relaxed block lower triangular solve
Definition: gsetc.hh:233
void butsolve(const M &A, X &v, const Y &d, const K &w, BL< l > bl)
relaxed block upper triangular solve
Definition: gsetc.hh:260
void bdsolve(const M &A, X &v, const Y &d)
block diagonal solve, no relaxation
Definition: gsetc.hh:332
void bsorb(const M &A, X &x, const Y &b, const K &w, BL< l >)
SSOR step.
Definition: gsetc.hh:630
void bdsolve(const M &A, X &v, const Y &d, const K &w, BL< l >)
block diagonal solve, with relaxation
Definition: gsetc.hh:355
void butsolve(const M &A, X &v, const Y &d)
block upper triangular solve
Definition: gsetc.hh:197
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition: gsetc.hh:612
void ubutsolve(const M &A, X &v, const Y &d)
unit block upper triangular solve
Definition: gsetc.hh:210
Dune namespace.
Definition: alignment.hh:14
compile-time parameter for block recursion depth
Definition: gsetc.hh:40