Reference documentation for deal.II version GIT relicensing-1062-gc06da148b8 2024-07-15 19:20:02+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{
46 template <typename ValueType, typename IndexType>
48 {
49 public:
102 SolverBase(SolverControl &solver_control, const std::string &exec_type);
103
107 virtual ~SolverBase() = default;
108
112 void
113 initialize(const SparseMatrix<ValueType> &matrix);
114
120 void
121 apply(Vector<ValueType> &solution, const Vector<ValueType> &rhs);
122
128 void
129 solve(const SparseMatrix<ValueType> &matrix,
130 Vector<ValueType> &solution,
131 const Vector<ValueType> &rhs);
132
137 control() const;
138
139
140 protected:
146
150 std::shared_ptr<gko::LinOpFactory> solver_gen;
151
156 std::shared_ptr<gko::stop::ResidualNormReduction<>::Factory>
158
163 std::shared_ptr<gko::log::Convergence<>> convergence_logger;
164
169 std::shared_ptr<gko::stop::Combined::Factory> combined_factory;
170
176 std::shared_ptr<gko::Executor> executor;
177
178 private:
185 void
187
195 std::shared_ptr<gko::matrix::Csr<ValueType, IndexType>> system_matrix;
196
202 const std::string exec_type;
203 };
204
205
209 template <typename ValueType = double, typename IndexType = int32_t>
210 class SolverCG : public SolverBase<ValueType, IndexType>
211 {
212 public:
217 {};
218
231 const std::string &exec_type,
232 const AdditionalData &data = AdditionalData());
233
248 const std::string &exec_type,
249 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
250 const AdditionalData &data = AdditionalData());
251
252 protected:
257 };
258
259
263 template <typename ValueType = double, typename IndexType = int32_t>
264 class SolverBicgstab : public SolverBase<ValueType, IndexType>
265 {
266 public:
271 {};
272
285 const std::string &exec_type,
286 const AdditionalData &data = AdditionalData());
287
302 const std::string &exec_type,
303 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
304 const AdditionalData &data = AdditionalData());
305
306 protected:
311 };
312
319 template <typename ValueType = double, typename IndexType = int32_t>
320 class SolverCGS : public SolverBase<ValueType, IndexType>
321 {
322 public:
327 {};
328
341 const std::string &exec_type,
342 const AdditionalData &data = AdditionalData());
343
358 const std::string &exec_type,
359 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
360 const AdditionalData &data = AdditionalData());
361
362 protected:
367 };
368
384 template <typename ValueType = double, typename IndexType = int32_t>
385 class SolverFCG : public SolverBase<ValueType, IndexType>
386 {
387 public:
392 {};
393
406 const std::string &exec_type,
407 const AdditionalData &data = AdditionalData());
408
423 const std::string &exec_type,
424 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
425 const AdditionalData &data = AdditionalData());
426
427 protected:
432 };
433
437 template <typename ValueType = double, typename IndexType = int32_t>
438 class SolverGMRES : public SolverBase<ValueType, IndexType>
439 {
440 public:
445 {
450 AdditionalData(const unsigned int restart_parameter = 30);
451
455 unsigned int restart_parameter;
456 };
457
470 const std::string &exec_type,
471 const AdditionalData &data = AdditionalData());
472
487 const std::string &exec_type,
488 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
489 const AdditionalData &data = AdditionalData());
490
491 protected:
496 };
497
505 template <typename ValueType = double, typename IndexType = int32_t>
506 class SolverIR : public SolverBase<ValueType, IndexType>
507 {
508 public:
513 {};
514
527 const std::string &exec_type,
528 const AdditionalData &data = AdditionalData());
529
544 const std::string &exec_type,
545 const std::shared_ptr<gko::LinOpFactory> &inner_solver,
546 const AdditionalData &data = AdditionalData());
547
548 protected:
553 };
554
555
556} // namespace GinkgoWrappers
557
559
560#endif // DEAL_II_WITH_GINKGO
561
562#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