13#ifndef dealii_solver_richardson_h
14#define dealii_solver_richardson_h
61template <
typename VectorType = Vector<
double>>
75 const bool use_preconditioned_residual =
false);
110 template <
typename MatrixType,
typename PreconditionerType>
114 void solve(const MatrixType &A,
117 const PreconditionerType &preconditioner);
122 template <typename MatrixType, typename PreconditionerType>
124 (
concepts::is_transpose_linear_operator_on<MatrixType, VectorType> &&
125 concepts::is_transpose_linear_operator_on<PreconditionerType, VectorType>))
126 void Tsolve(const MatrixType &A,
129 const PreconditionerType &preconditioner);
135 set_omega(const
double om = 1.);
143 print_vectors(const
unsigned int step,
146 const VectorType &d) const;
155 virtual typename VectorType::value_type
156 criterion(const VectorType &r, const VectorType &d) const;
169template <
typename VectorType>
173 const bool use_preconditioned_residual)
175 , use_preconditioned_residual(use_preconditioned_residual)
179template <
typename VectorType>
183 const AdditionalData &
data)
185 , additional_data(
data)
190template <
typename VectorType>
193 const AdditionalData &
data)
195 , additional_data(
data)
200template <
typename VectorType>
202template <
typename MatrixType,
typename PreconditionerType>
210 const PreconditionerType &preconditioner)
214 double last_criterion = std::numeric_limits<double>::lowest();
216 unsigned int iter = 0;
238 preconditioner.vmult(d, r);
242 last_criterion = criterion(r, d);
243 conv = this->iteration_status(iter, last_criterion, x);
250 if (additional_data.
omega != 1.0)
251 x.add(additional_data.
omega, d);
255 print_vectors(iter, x, r, d);
268template <
typename VectorType>
270template <
typename MatrixType,
typename PreconditionerType>
278 const PreconditionerType &preconditioner)
281 double last_criterion = std::numeric_limits<double>::lowest();
283 unsigned int iter = 0;
305 preconditioner.Tvmult(d, r);
307 last_criterion = criterion(r, d);
308 conv = this->iteration_status(iter, last_criterion, x);
312 x.add(additional_data.
omega, d);
313 print_vectors(iter, x, r, d);
327template <
typename VectorType>
332 const VectorType &)
const
337template <
typename VectorType>
339inline typename VectorType::value_type
341 const VectorType &d)
const
350template <
typename VectorType>
354 additional_data.
omega = om;
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void set_omega(const double om=1.)
SolverRichardson(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
void Tsolve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
virtual ~SolverRichardson() override=default
virtual VectorType::value_type criterion(const VectorType &r, const VectorType &d) const
SolverRichardson(SolverControl &cn, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define AssertThrow(cond, exc)
std::vector< index_type > data
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
AdditionalData(const double omega=1, const bool use_preconditioned_residual=false)
bool use_preconditioned_residual