dune-istl  2.8.0
preconditioners.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ISTL_PRECONDITIONERS_HH
4 #define DUNE_ISTL_PRECONDITIONERS_HH
5 
6 #include <cmath>
7 #include <complex>
8 #include <iostream>
9 #include <iomanip>
10 #include <memory>
11 #include <string>
12 
13 #include <dune/common/simd/simd.hh>
14 #include <dune/common/parametertree.hh>
15 
17 #include "preconditioner.hh"
18 #include "solver.hh"
19 #include "solvercategory.hh"
20 #include "istlexception.hh"
21 #include "matrixutils.hh"
22 #include "gsetc.hh"
23 #include "ildl.hh"
24 #include "ilu.hh"
25 
26 
27 namespace Dune {
70  template<class O, int c = -1>
72  public Preconditioner<typename O::domain_type, typename O::range_type>
73  {
74  public:
76  typedef typename O::domain_type domain_type;
78  typedef typename O::range_type range_type;
80  typedef typename range_type::field_type field_type;
82  typedef Simd::Scalar<field_type> scalar_field_type;
84  typedef O InverseOperator;
85 
91  : inverse_operator_(inverse_operator)
92  {
93  if(c != -1 && SolverCategory::category(inverse_operator_) != c)
94  DUNE_THROW(InvalidStateException, "User-supplied solver category does not match that of the given inverse operator");
95  }
96 
97  virtual void pre(domain_type&,range_type&)
98  {}
99 
100  virtual void apply(domain_type& v, const range_type& d)
101  {
103  range_type copy(d);
104  inverse_operator_.apply(v, copy, res);
105  }
106 
107  virtual void post(domain_type&)
108  {}
109 
112  {
113  return SolverCategory::category(inverse_operator_);
114  }
115 
116  private:
117  InverseOperator& inverse_operator_;
118  };
119 
120  //=====================================================================
121  // Implementation of this interface for sequential ISTL-preconditioners
122  //=====================================================================
123 
124 
136  template<class M, class X, class Y, int l=1>
137  class SeqSSOR : public Preconditioner<X,Y> {
138  public:
140  typedef M matrix_type;
142  typedef X domain_type;
144  typedef Y range_type;
146  typedef typename X::field_type field_type;
148  typedef Simd::Scalar<field_type> scalar_field_type;
149 
157  SeqSSOR (const M& A, int n, scalar_field_type w)
158  : _A_(A), _n(n), _w(w)
159  {
161  }
162 
176  SeqSSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
177  : SeqSSOR(A->getmat(), configuration)
178  {}
179 
193  SeqSSOR (const M& A, const ParameterTree& configuration)
194  : SeqSSOR(A, configuration.get<int>("iterations",1), configuration.get<scalar_field_type>("relaxation",1.0))
195  {}
196 
202  virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
203  {}
204 
210  virtual void apply (X& v, const Y& d)
211  {
212  for (int i=0; i<_n; i++) {
213  bsorf(_A_,v,d,_w,BL<l>());
214  bsorb(_A_,v,d,_w,BL<l>());
215  }
216  }
217 
223  virtual void post ([[maybe_unused]] X& x)
224  {}
225 
228  {
230  }
231 
232  private:
234  const M& _A_;
236  int _n;
239  };
240  DUNE_REGISTER_PRECONDITIONER("ssor", defaultPreconditionerBlockLevelCreator<Dune::SeqSSOR>());
241 
242 
254  template<class M, class X, class Y, int l=1>
255  class SeqSOR : public Preconditioner<X,Y> {
256  public:
258  typedef M matrix_type;
260  typedef X domain_type;
262  typedef Y range_type;
264  typedef typename X::field_type field_type;
266  typedef Simd::Scalar<field_type> scalar_field_type;
267 
275  SeqSOR (const M& A, int n, scalar_field_type w)
276  : _A_(A), _n(n), _w(w)
277  {
279  }
280 
294  SeqSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
295  : SeqSOR(A->getmat(), configuration)
296  {}
297 
311  SeqSOR (const M& A, const ParameterTree& configuration)
312  : SeqSOR(A, configuration.get<int>("iterations",1), configuration.get<scalar_field_type>("relaxation",1.0))
313  {}
314 
320  virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
321  {}
322 
328  virtual void apply (X& v, const Y& d)
329  {
330  this->template apply<true>(v,d);
331  }
332 
341  template<bool forward>
342  void apply(X& v, const Y& d)
343  {
344  if(forward)
345  for (int i=0; i<_n; i++) {
346  bsorf(_A_,v,d,_w,BL<l>());
347  }
348  else
349  for (int i=0; i<_n; i++) {
350  bsorb(_A_,v,d,_w,BL<l>());
351  }
352  }
353 
359  virtual void post ([[maybe_unused]] X& x)
360  {}
361 
364  {
366  }
367 
368  private:
370  const M& _A_;
372  int _n;
375  };
376  DUNE_REGISTER_PRECONDITIONER("sor", defaultPreconditionerBlockLevelCreator<Dune::SeqSOR>());
377 
378 
389  template<class M, class X, class Y, int l=1>
391  DUNE_REGISTER_PRECONDITIONER("gs", defaultPreconditionerBlockLevelCreator<Dune::SeqGS>());
392 
403  template<class M, class X, class Y, int l=1>
404  class SeqJac : public Preconditioner<X,Y> {
405  public:
407  typedef M matrix_type;
409  typedef X domain_type;
411  typedef Y range_type;
413  typedef typename X::field_type field_type;
415  typedef Simd::Scalar<field_type> scalar_field_type;
416 
424  SeqJac (const M& A, int n, scalar_field_type w)
425  : _A_(A), _n(n), _w(w)
426  {
428  }
429 
443  SeqJac (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
444  : SeqJac(A->getmat(), configuration)
445  {}
446 
460  SeqJac (const M& A, const ParameterTree& configuration)
461  : SeqJac(A, configuration.get<int>("iterations",1), configuration.get<scalar_field_type>("relaxation",1.0))
462  {}
463 
469  virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
470  {}
471 
477  virtual void apply (X& v, const Y& d)
478  {
479  for (int i=0; i<_n; i++) {
480  dbjac(_A_,v,d,_w,BL<l>());
481  }
482  }
483 
489  virtual void post ([[maybe_unused]] X& x)
490  {}
491 
494  {
496  }
497 
498  private:
500  const M& _A_;
502  int _n;
504  scalar_field_type _w;
505  };
506  DUNE_REGISTER_PRECONDITIONER("jac", defaultPreconditionerBlockLevelCreator<Dune::SeqJac>());
507 
508 
509 
521  template<class M, class X, class Y, int l=1>
522  class SeqILU : public Preconditioner<X,Y> {
523  public:
525  typedef typename std::remove_const<M>::type matrix_type;
527  typedef typename matrix_type :: block_type block_type;
529  typedef X domain_type;
531  typedef Y range_type;
532 
534  typedef typename X::field_type field_type;
535 
537  typedef Simd::Scalar<field_type> scalar_field_type;
538 
541 
549  SeqILU (const M& A, scalar_field_type w, const bool resort = false )
550  : SeqILU( A, 0, w, resort ) // construct ILU(0)
551  {
552  }
553 
568  SeqILU (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
569  : SeqILU(A->getmat(), configuration)
570  {}
571 
586  SeqILU(const M& A, const ParameterTree& config)
587  : SeqILU(A, config.get("n", 0),
588  config.get<scalar_field_type>("relaxation", 1.0),
589  config.get("resort", false))
590  {}
591 
600  SeqILU (const M& A, int n, scalar_field_type w, const bool resort = false )
601  : ILU_(),
602  lower_(),
603  upper_(),
604  inv_(),
605  w_(w),
606  wNotIdentity_([w]{using std::abs; return abs(w - scalar_field_type(1)) > 1e-15;}() )
607  {
608  if( n == 0 )
609  {
610  // copy A
611  ILU_.reset( new matrix_type( A ) );
612  // create ILU(0) decomposition
614  }
615  else
616  {
617  // create matrix in build mode
618  ILU_.reset( new matrix_type( A.N(), A.M(), matrix_type::row_wise) );
619  // create ILU(n) decomposition
620  ILU::blockILUDecomposition( A, n, *ILU_ );
621  }
622 
623  if( resort )
624  {
625  // store ILU in simple CRS format
626  ILU::convertToCRS( *ILU_, lower_, upper_, inv_ );
627  ILU_.reset();
628  }
629  }
630 
636  virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
637  {}
638 
644  virtual void apply (X& v, const Y& d)
645  {
646  if( ILU_ )
647  {
648  ILU::blockILUBacksolve( *ILU_, v, d);
649  }
650  else
651  {
652  ILU::blockILUBacksolve(lower_, upper_, inv_, v, d);
653  }
654 
655  if( wNotIdentity_ )
656  {
657  v *= w_;
658  }
659  }
660 
666  virtual void post ([[maybe_unused]] X& x)
667  {}
668 
671  {
673  }
674 
675  protected:
677  std::unique_ptr< matrix_type > ILU_;
678 
682  std::vector< block_type, typename matrix_type::allocator_type > inv_;
683 
687  const bool wNotIdentity_;
688  };
689  DUNE_REGISTER_PRECONDITIONER("ilu", defaultPreconditionerBlockLevelCreator<Dune::SeqILU>());
690 
691 
700  template<class X, class Y>
701  class Richardson : public Preconditioner<X,Y> {
702  public:
704  typedef X domain_type;
706  typedef Y range_type;
708  typedef typename X::field_type field_type;
710  typedef Simd::Scalar<field_type> scalar_field_type;
711 
718  _w(w)
719  {}
720 
732  Richardson (const ParameterTree& configuration)
733  : Richardson(configuration.get<scalar_field_type>("relaxation", 1.0))
734  {}
735 
741  virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
742  {}
743 
749  virtual void apply (X& v, const Y& d)
750  {
751  v = d;
752  v *= _w;
753  }
754 
760  virtual void post ([[maybe_unused]] X& x)
761  {}
762 
765  {
767  }
768 
769  private:
772  };
773  DUNE_REGISTER_PRECONDITIONER("richardson", [](auto tl, const auto& /* mat */, const ParameterTree& config){
774  using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
775  using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
776  return std::make_shared<Richardson<D,R>>(config);
777  });
778 
779 
790  template< class M, class X, class Y >
791  class SeqILDL
792  : public Preconditioner< X, Y >
793  {
794  typedef SeqILDL< M, X, Y > This;
796 
797  public:
799  typedef std::remove_const_t< M > matrix_type;
801  typedef X domain_type;
803  typedef Y range_type;
805  typedef typename X::field_type field_type;
807  typedef Simd::Scalar<field_type> scalar_field_type;
808 
821  SeqILDL (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
822  : SeqILDL(A->getmat(), configuration)
823  {}
824 
837  SeqILDL(const matrix_type& A, const ParameterTree& config)
838  : SeqILDL(A, config.get<scalar_field_type>("relaxation", 1.0))
839  {}
840 
849  explicit SeqILDL ( const matrix_type &A, scalar_field_type relax = scalar_field_type( 1 ) )
850  : decomposition_( A.N(), A.M(), matrix_type::random ),
851  relax_( relax )
852  {
853  // setup row sizes for lower triangular matrix
854  for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
855  {
856  const auto &A_i = *i;
857  const auto ij = A_i.find( i.index() );
858  if( ij != A_i.end() )
859  decomposition_.setrowsize( i.index(), ij.offset()+1 );
860  else
861  DUNE_THROW( ISTLError, "diagonal entry missing" );
862  }
863  decomposition_.endrowsizes();
864 
865  // setup row indices for lower triangular matrix
866  for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
867  {
868  const auto &A_i = *i;
869  for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij )
870  decomposition_.addindex( i.index(), ij.index() );
871  decomposition_.addindex( i.index(), i.index() );
872  }
873  decomposition_.endindices();
874 
875  // copy values of lower triangular matrix
876  auto i = A.begin();
877  for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row != rowend; ++row, ++i )
878  {
879  auto ij = i->begin();
880  for( auto col = row->begin(), colend = row->end(); col != colend; ++col, ++ij )
881  *col = *ij;
882  }
883 
884  // perform ILDL decomposition
885  bildl_decompose( decomposition_ );
886  }
887 
889  void pre ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
890  {}
891 
893  void apply ( X &v, const Y &d ) override
894  {
895  bildl_backsolve( decomposition_, v, d, true );
896  v *= relax_;
897  }
898 
900  void post ([[maybe_unused]] X &x) override
901  {}
902 
905 
906  private:
907  matrix_type decomposition_;
908  scalar_field_type relax_;
909  };
910  DUNE_REGISTER_PRECONDITIONER("ildl", defaultPreconditionerCreator<Dune::SeqILDL>());
911 
914 } // end namespace
915 
916 
917 #endif
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
Incomplete LDL decomposition.
The incomplete LU factorization kernels.
Some handy generic functions for ISTL matrices.
Define general, extensible interface for inverse operators.
Col col
Definition: matrixmatrix.hh:349
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition: gsetc.hh:644
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition: gsetc.hh:656
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition: gsetc.hh:632
Definition: allocator.hh:9
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition: ildl.hh:86
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get([[maybe_unused]] const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:291
DUNE_REGISTER_PRECONDITIONER("amg", AMGCreator())
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition: ildl.hh:147
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition: ilu.hh:306
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition: ilu.hh:93
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition: ilu.hh:32
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition: ilu.hh:166
compile-time parameter for block recursion depth
Definition: gsetc.hh:43
derive error class from the base class in common
Definition: istlexception.hh:17
size_type M() const
Return the number of columns.
Definition: matrix.hh:698
size_type N() const
Return the number of rows.
Definition: matrix.hh:693
static void check([[maybe_unused]] const Matrix &mat)
Check whether the a matrix has diagonal values on blocklevel recursion levels.
Definition: matrixutils.hh:51
A linear operator exporting itself in matrix form.
Definition: operators.hh:107
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:30
Turns an InverseOperator into a Preconditioner.
Definition: preconditioners.hh:73
O::range_type range_type
The range type of the preconditioner.
Definition: preconditioners.hh:78
O::domain_type domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:76
virtual void post(domain_type &)
Clean up.
Definition: preconditioners.hh:107
range_type::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:80
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:82
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:111
virtual void pre(domain_type &, range_type &)
Prepare the preconditioner.
Definition: preconditioners.hh:97
InverseOperator2Preconditioner(InverseOperator &inverse_operator)
Construct the preconditioner from the solver.
Definition: preconditioners.hh:90
O InverseOperator
type of the wrapped inverse operator
Definition: preconditioners.hh:84
virtual void apply(domain_type &v, const range_type &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition: preconditioners.hh:100
Sequential SSOR preconditioner.
Definition: preconditioners.hh:137
SeqSSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y >> &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:176
SeqSSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:193
virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
Prepare the preconditioner.
Definition: preconditioners.hh:202
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:227
X::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:146
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:148
SeqSSOR(const M &A, int n, scalar_field_type w)
Constructor.
Definition: preconditioners.hh:157
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:142
M matrix_type
The matrix type the preconditioner is for.
Definition: preconditioners.hh:140
virtual void post([[maybe_unused]] X &x)
Clean up.
Definition: preconditioners.hh:223
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: preconditioners.hh:210
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:144
Sequential SOR preconditioner.
Definition: preconditioners.hh:255
M matrix_type
The matrix type the preconditioner is for.
Definition: preconditioners.hh:258
void apply(X &v, const Y &d)
Apply the preconditioner in a special direction.
Definition: preconditioners.hh:342
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:260
SeqSOR(const M &A, int n, scalar_field_type w)
Constructor.
Definition: preconditioners.hh:275
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:266
SeqSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y >> &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:294
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:363
virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
Prepare the preconditioner.
Definition: preconditioners.hh:320
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: preconditioners.hh:328
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:262
SeqSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:311
X::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:264
virtual void post([[maybe_unused]] X &x)
Clean up.
Definition: preconditioners.hh:359
The sequential jacobian preconditioner.
Definition: preconditioners.hh:404
virtual void post([[maybe_unused]] X &x)
Clean up.
Definition: preconditioners.hh:489
SeqJac(const M &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:460
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: preconditioners.hh:477
M matrix_type
The matrix type the preconditioner is for.
Definition: preconditioners.hh:407
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:415
SeqJac(const std::shared_ptr< const AssembledLinearOperator< M, X, Y >> &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:443
X::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:413
SeqJac(const M &A, int n, scalar_field_type w)
Constructor.
Definition: preconditioners.hh:424
virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
Prepare the preconditioner.
Definition: preconditioners.hh:469
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:409
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:493
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:411
Sequential ILU preconditioner.
Definition: preconditioners.hh:522
matrix_type ::block_type block_type
block type of matrix
Definition: preconditioners.hh:527
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: preconditioners.hh:644
ILU::CRS< block_type, typename M::allocator_type > CRS
type of ILU storage
Definition: preconditioners.hh:540
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:531
const scalar_field_type w_
The relaxation factor to use.
Definition: preconditioners.hh:685
CRS lower_
The ILU(n) decomposition of the matrix. As storage a CRS structure is used.
Definition: preconditioners.hh:680
const bool wNotIdentity_
true if w != 1.0
Definition: preconditioners.hh:687
SeqILU(const M &A, const ParameterTree &config)
Constructor.
Definition: preconditioners.hh:586
virtual void post([[maybe_unused]] X &x)
Clean up.
Definition: preconditioners.hh:666
SeqILU(const M &A, int n, scalar_field_type w, const bool resort=false)
Constructor.
Definition: preconditioners.hh:600
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: preconditioners.hh:525
SeqILU(const M &A, scalar_field_type w, const bool resort=false)
Constructor.
Definition: preconditioners.hh:549
virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
Prepare the preconditioner.
Definition: preconditioners.hh:636
X::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:534
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:670
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:529
std::vector< block_type, typename matrix_type::allocator_type > inv_
Definition: preconditioners.hh:682
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:537
SeqILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y >> &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:568
std::unique_ptr< matrix_type > ILU_
The ILU(n) decomposition of the matrix. As storage a BCRSMatrix is used.
Definition: preconditioners.hh:677
CRS upper_
Definition: preconditioners.hh:681
Richardson preconditioner.
Definition: preconditioners.hh:701
virtual void post([[maybe_unused]] X &x)
Clean up.
Definition: preconditioners.hh:760
X::field_type field_type
The field type of the preconditioner.
Definition: preconditioners.hh:708
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:764
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:706
Richardson(scalar_field_type w=1.0)
Constructor.
Definition: preconditioners.hh:717
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:710
Richardson(const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:732
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:704
virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
Prepare the preconditioner.
Definition: preconditioners.hh:741
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition: preconditioners.hh:749
sequential ILDL preconditioner
Definition: preconditioners.hh:793
SeqILDL(const matrix_type &A, const ParameterTree &config)
Constructor.
Definition: preconditioners.hh:837
void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
Prepare the preconditioner.
Definition: preconditioners.hh:889
SeqILDL(const matrix_type &A, scalar_field_type relax=scalar_field_type(1))
constructor
Definition: preconditioners.hh:849
void post([[maybe_unused]] X &x) override
Clean up.
Definition: preconditioners.hh:900
X domain_type
domain type of the preconditioner
Definition: preconditioners.hh:801
Y range_type
range type of the preconditioner
Definition: preconditioners.hh:803
std::remove_const_t< M > matrix_type
type of matrix the preconditioner is for
Definition: preconditioners.hh:799
void apply(X &v, const Y &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition: preconditioners.hh:893
SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y >> &A, const ParameterTree &configuration)
Constructor.
Definition: preconditioners.hh:821
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition: preconditioners.hh:807
X::field_type field_type
field type of the preconditioner
Definition: preconditioners.hh:805
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
Definition: preconditioners.hh:904
Statistics about the application of an inverse operator.
Definition: solver.hh:46
Abstract base class for all solvers.
Definition: solver.hh:97
Category
Definition: solvercategory.hh:21
@ sequential
Category for sequential solvers.
Definition: solvercategory.hh:23
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition: solvercategory.hh:32