|
dune-istl 2.9.0
|
Loading...
Searching...
No Matches
solver.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
149 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
230 IterativeSolver (const LinearOperator<X,Y>& op, Preconditioner<X,Y>& prec, scalar_real_type reduction, int maxit, int verbose) :
262 IterativeSolver (const LinearOperator<X,Y>& op, const ScalarProduct<X>& sp, Preconditioner<X,Y>& prec,
267 _reduction(reduction), _maxit(maxit), _verbose(verbose), _category(SolverCategory::category(op))
270 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
272 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
290 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
313 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<const ScalarProduct<X> > sp, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
351 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
353 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
475 _res.converged = (Simd::allTrue(def<_def0*_parent._reduction || def<real_type(1E-30))); // convergence check
Define base class for scalar product and norm.
Define general, extensible interface for operators. The available implementation wraps a matrix.
STL namespace.
#define DUNE_THROW(E, m)
auto io(const V &v)
bool allTrue(const Mask &mask)
auto max(const V &v1, const V &v2)
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
std::string className()
Reference get(const RAPropertyMapHelper< Reference, PropertyMap > &pmap, const Key &key)
T real_type
double elapsed() const noexcept
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
Statistics about the application of an inverse operator.
Definition solver.hh:48
InverseOperatorResult()
Default constructor.
Definition solver.hh:50
double condition_estimate
Estimate of condition number.
Definition solver.hh:79
double conv_rate
Convergence rate (average reduction per step)
Definition solver.hh:76
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
void printHeader(std::ostream &s) const
helper function for printing header of solver output
Definition solver.hh:163
virtual ~InverseOperator()
Destructor.
Definition solver.hh:156
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm) const
helper function for printing solver output
Definition solver.hh:185
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm, const DataType &norm_old) const
helper function for printing solver output
Definition solver.hh:172
virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)=0
apply inverse operator, with given convergence criteria.
Simd::Scalar< real_type > scalar_real_type
scalar type underlying the field_type
Definition solver.hh:114
Y range_type
Type of the range of the operator to be inverted.
Definition solver.hh:105
X domain_type
Type of the domain of the operator to be inverted.
Definition solver.hh:102
virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0
Apply inverse operator,.
X::field_type field_type
The field type of the operator.
Definition solver.hh:108
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solver.hh:111
virtual SolverCategory::Category category() const =0
Category of the solver (see SolverCategory::Category)
Base class for all implementations of iterative solvers.
Definition solver.hh:203
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:313
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:290
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solver.hh:374
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, Y > > prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:340
IterativeSolver(const LinearOperator< X, Y > &op, Preconditioner< X, Y > &prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:230
std::shared_ptr< const LinearOperator< X, Y > > _op
Definition solver.hh:504
IterativeSolver(const LinearOperator< X, Y > &op, const ScalarProduct< X > &sp, Preconditioner< X, Y > &prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:262
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition solver.hh:383
Iteration(const IterativeSolver &parent, InverseOperatorResult &res)
Definition solver.hh:413
Iteration(const Iteration &)=delete
bool step(CountType i, real_type def)
registers the iteration step, checks for invalid defect norm and convergence.
Definition solver.hh:455
Helper class for notifying a DUNE-ISTL linear solver about a change of the iteration matrix object in...
Definition solver.hh:522
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:524
Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTAB...
Definition solver.hh:540
static void setMatrix(ISTLLinearSolver &, const BCRSMatrix &)
Definition solver.hh:541
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:553
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
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:34
Definition solvercategory.hh:54
Definition solvertype.hh:16
T endl(T... args)
T find(T... args)
T setw(T... args)
T substr(T... args)
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8