Reference documentation for deal.II version GIT relicensing-426-g7976cfd195 2024-04-18 21:10:01+00:00
\(\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\}}\)
Loading...
Searching...
No Matches
ginkgo_solver.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2019 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_ginkgo_solver_h
16#define dealii_ginkgo_solver_h
17
18
19#include <deal.II/base/config.h>
20
21#ifdef DEAL_II_WITH_GINKGO
22
27# include <deal.II/lac/vector.h>
28
29# include <ginkgo/ginkgo.hpp>
30
31# include <memory>
32
34
36{
48 template <typename ValueType, typename IndexType>
50 {
51 public:
104 SolverBase(SolverControl &solver_control, const std::string &exec_type);
105
109 virtual ~SolverBase() = default;
110
114 void
115 initialize(const SparseMatrix<ValueType> &matrix);
116
122 void
123 apply(Vector<ValueType> &solution, const Vector<ValueType> &rhs);
124
130 void
131 solve(const SparseMatrix<ValueType> &matrix,
132 Vector<ValueType> &solution,
133 const Vector<ValueType> &rhs);
134
139 control() const;
140
141
142 protected:
148
152 std::shared_ptr<gko::LinOpFactory> solver_gen;
153
158 std::shared_ptr<gko::stop::ResidualNormReduction<>::Factory>
160
165 std::shared_ptr<gko::log::Convergence<>> convergence_logger;
166
171 std::shared_ptr<gko::stop::Combined::Factory> combined_factory;
172
178 std::shared_ptr<gko::Executor> executor;
179
180 private:
187 void
189
197 std::shared_ptr<gko::matrix::Csr<ValueType, IndexType>> system_matrix;
198
204 const std::string exec_type;
205 };
206
207
213 template <typename ValueType = double, typename IndexType = int32_t>
214 class SolverCG : public SolverBase<ValueType, IndexType>
215 {
216 public:
221 {};
222
235 const std::string &exec_type,
236 const AdditionalData &data = AdditionalData());
237
252 const std::string &exec_type,
253 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
254 const AdditionalData &data = AdditionalData());
255
256 protected:
261 };
262
263
269 template <typename ValueType = double, typename IndexType = int32_t>
270 class SolverBicgstab : public SolverBase<ValueType, IndexType>
271 {
272 public:
277 {};
278
291 const std::string &exec_type,
292 const AdditionalData &data = AdditionalData());
293
308 const std::string &exec_type,
309 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
310 const AdditionalData &data = AdditionalData());
311
312 protected:
317 };
318
327 template <typename ValueType = double, typename IndexType = int32_t>
328 class SolverCGS : public SolverBase<ValueType, IndexType>
329 {
330 public:
335 {};
336
349 const std::string &exec_type,
350 const AdditionalData &data = AdditionalData());
351
366 const std::string &exec_type,
367 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
368 const AdditionalData &data = AdditionalData());
369
370 protected:
375 };
376
394 template <typename ValueType = double, typename IndexType = int32_t>
395 class SolverFCG : public SolverBase<ValueType, IndexType>
396 {
397 public:
402 {};
403
416 const std::string &exec_type,
417 const AdditionalData &data = AdditionalData());
418
433 const std::string &exec_type,
434 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
435 const AdditionalData &data = AdditionalData());
436
437 protected:
442 };
443
449 template <typename ValueType = double, typename IndexType = int32_t>
450 class SolverGMRES : public SolverBase<ValueType, IndexType>
451 {
452 public:
457 {
462 AdditionalData(const unsigned int restart_parameter = 30);
463
467 unsigned int restart_parameter;
468 };
469
482 const std::string &exec_type,
483 const AdditionalData &data = AdditionalData());
484
499 const std::string &exec_type,
500 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
501 const AdditionalData &data = AdditionalData());
502
503 protected:
508 };
509
519 template <typename ValueType = double, typename IndexType = int32_t>
520 class SolverIR : public SolverBase<ValueType, IndexType>
521 {
522 public:
527 {};
528
541 const std::string &exec_type,
542 const AdditionalData &data = AdditionalData());
543
558 const std::string &exec_type,
559 const std::shared_ptr<gko::LinOpFactory> &inner_solver,
560 const AdditionalData &data = AdditionalData());
561
562 protected:
567 };
568
569
570} // namespace GinkgoWrappers
571
573
574#endif // DEAL_II_WITH_GINKGO
575
576#endif
SolverControl & control() const
const std::string exec_type
SolverControl & solver_control
std::shared_ptr< gko::log::Convergence<> > convergence_logger
void initialize(const SparseMatrix< ValueType > &matrix)
std::shared_ptr< gko::matrix::Csr< ValueType, IndexType > > system_matrix
void apply(Vector< ValueType > &solution, const Vector< ValueType > &rhs)
std::shared_ptr< gko::Executor > executor
std::shared_ptr< gko::LinOpFactory > solver_gen
void solve(const SparseMatrix< ValueType > &matrix, Vector< ValueType > &solution, const Vector< ValueType > &rhs)
virtual ~SolverBase()=default
std::shared_ptr< gko::stop::ResidualNormReduction<>::Factory > residual_criterion
std::shared_ptr< gko::stop::Combined::Factory > combined_factory
const AdditionalData additional_data
const AdditionalData additional_data
const AdditionalData additional_data
const AdditionalData additional_data
const AdditionalData additional_data
const AdditionalData additional_data
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503