Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
PreconditionSelector< MatrixType, VectorType > Class Template Reference

#include <deal.II/lac/precondition_selector.h>

Inheritance diagram for PreconditionSelector< MatrixType, VectorType >:
[legend]

Public Types

using size_type = typename MatrixType::size_type
 

Public Member Functions

 PreconditionSelector (const std::string &preconditioning, const typename VectorType::value_type &omega=1.)
 
virtual ~PreconditionSelector () override
 
void use_matrix (const MatrixType &M)
 
size_type m () const
 
size_type n () const
 
virtual void vmult (VectorType &dst, const VectorType &src) const
 
virtual void Tvmult (VectorType &dst, const VectorType &src) const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static std::string get_precondition_names ()
 
static ::ExceptionBaseExcNoMatrixGivenToUse ()
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 

Protected Attributes

std::string preconditioning
 

Private Attributes

SmartPointer< const MatrixType, PreconditionSelector< MatrixType, VectorType > > A
 
const VectorType::value_type omega
 

Detailed Description

template<typename MatrixType = SparseMatrix<double>, typename VectorType = ::Vector<double>>
class PreconditionSelector< MatrixType, VectorType >

Selects the preconditioner. The constructor of this class takes the name of the preconditioning and the damping parameter omega of the preconditioning and the use_matrix function takes the matrix that is used by the matrix-builtin precondition functions. Each time, the operator() function is called, this preselected preconditioner, this matrix and this omega is used for the preconditioning. This class is designed for being used as argument of the solve function of a Solver and it covers the selection of all matrix-builtin precondition functions. The selection of other preconditioners, like BlockSOR or ILU should be handled in derived classes by the user.

Usage

The simplest use of this class is the following:

// generate a @p SolverControl and a @p VectorMemory
SolverControl control;
// generate a solver
SolverCG<SparseMatrix<double>, Vector<double> > solver(control, memory);
// generate a @p PreconditionSelector
preconditioning("jacobi", 1.);
// give a matrix whose diagonal entries are to be used for the
// preconditioning. Generally the matrix of the linear equation system Ax=b.
preconditioning.use_matrix(A);
// call the @p solve function with this preconditioning as last argument
solver.solve(A,x,b,preconditioning);

The same example where also the SolverSelector class is used reads

// generate a @p SolverControl and a @p VectorMemory
SolverControl control;
// generate a @p SolverSelector that calls the @p SolverCG
solver_selector("cg", control, memory);
// generate a @p PreconditionSelector
preconditioning("jacobi", 1.);
preconditioning.use_matrix(A);
solver_selector.solve(A,x,b,preconditioning);

Now the use of the SolverSelector in combination with the PreconditionSelector allows the user to select both, the solver and the preconditioner, at the beginning of their program and each time the solver is started (that is several times e.g. in a nonlinear iteration) this preselected solver and preconditioner is called.

Author
Ralf Hartmann, 1999; extension for full compatibility with LinearOperator class: Jean-Paul Pelteret, 2015

Definition at line 103 of file precondition_selector.h.


The documentation for this class was generated from the following file:
SolverCG
Definition: solver_cg.h:98
SolverSelector
Definition: solver_selector.h:91
PreconditionSelector
Definition: precondition_selector.h:103
Physics::Elasticity::Kinematics::b
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
PreconditionSelector::preconditioning
std::string preconditioning
Definition: precondition_selector.h:187
SolverControl
Definition: solver_control.h:67
PreconditionSelector::A
SmartPointer< const MatrixType, PreconditionSelector< MatrixType, VectorType > > A
Definition: precondition_selector.h:195
Vector< double >
VectorMemory
Definition: vector_memory.h:107