Reference documentation for deal.II version 9.3.3
\(\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\}}\)
ginkgo_solver.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2018 - 2019 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_ginkgo_solver_h
17# define dealii_ginkgo_solver_h
18
19
20# include <deal.II/base/config.h>
21
22# ifdef DEAL_II_WITH_GINKGO
23
28# include <deal.II/lac/vector.h>
29
30# include <ginkgo/ginkgo.hpp>
31
32# include <memory>
33
35
37{
49 template <typename ValueType, typename IndexType>
51 {
52 public:
105 SolverBase(SolverControl &solver_control, const std::string &exec_type);
106
110 virtual ~SolverBase() = default;
111
115 void
117
123 void
124 apply(Vector<ValueType> &solution, const Vector<ValueType> &rhs);
125
131 void
133 Vector<ValueType> & solution,
134 const Vector<ValueType> & rhs);
135
140 control() const;
141
142
143 protected:
149
153 std::shared_ptr<gko::LinOpFactory> solver_gen;
154
159 std::shared_ptr<gko::stop::ResidualNormReduction<>::Factory>
161
166 std::shared_ptr<gko::log::Convergence<>> convergence_logger;
167
172 std::shared_ptr<gko::stop::Combined::Factory> combined_factory;
173
179 std::shared_ptr<gko::Executor> executor;
180
181 private:
188 void
190
198 std::shared_ptr<gko::matrix::Csr<ValueType, IndexType>> system_matrix;
199
205 const std::string exec_type;
206 };
207
208
214 template <typename ValueType = double, typename IndexType = int32_t>
215 class SolverCG : public SolverBase<ValueType, IndexType>
216 {
217 public:
222 {};
223
236 const std::string & exec_type,
237 const AdditionalData &data = AdditionalData());
238
253 const std::string & exec_type,
254 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
255 const AdditionalData & data = AdditionalData());
256
257 protected:
262 };
263
264
270 template <typename ValueType = double, typename IndexType = int32_t>
271 class SolverBicgstab : public SolverBase<ValueType, IndexType>
272 {
273 public:
278 {};
279
292 const std::string & exec_type,
293 const AdditionalData &data = AdditionalData());
294
309 const std::string & exec_type,
310 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
311 const AdditionalData &data = AdditionalData());
312
313 protected:
318 };
319
328 template <typename ValueType = double, typename IndexType = int32_t>
329 class SolverCGS : public SolverBase<ValueType, IndexType>
330 {
331 public:
336 {};
337
350 const std::string & exec_type,
351 const AdditionalData &data = AdditionalData());
352
367 const std::string & exec_type,
368 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
369 const AdditionalData &data = AdditionalData());
370
371 protected:
376 };
377
395 template <typename ValueType = double, typename IndexType = int32_t>
396 class SolverFCG : public SolverBase<ValueType, IndexType>
397 {
398 public:
403 {};
404
417 const std::string & exec_type,
418 const AdditionalData &data = AdditionalData());
419
434 const std::string & exec_type,
435 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
436 const AdditionalData &data = AdditionalData());
437
438 protected:
443 };
444
450 template <typename ValueType = double, typename IndexType = int32_t>
451 class SolverGMRES : public SolverBase<ValueType, IndexType>
452 {
453 public:
458 {
463 AdditionalData(const unsigned int restart_parameter = 30);
464
468 unsigned int restart_parameter;
469 };
470
483 const std::string & exec_type,
484 const AdditionalData &data = AdditionalData());
485
500 const std::string & exec_type,
501 const std::shared_ptr<gko::LinOpFactory> &preconditioner,
502 const AdditionalData &data = AdditionalData());
503
504 protected:
509 };
510
520 template <typename ValueType = double, typename IndexType = int32_t>
521 class SolverIR : public SolverBase<ValueType, IndexType>
522 {
523 public:
528 {};
529
542 const std::string & exec_type,
543 const AdditionalData &data = AdditionalData());
544
559 const std::string & exec_type,
560 const std::shared_ptr<gko::LinOpFactory> &inner_solver,
561 const AdditionalData & data = AdditionalData());
562
563 protected:
568 };
569
570
571} // namespace GinkgoWrappers
572
574
575# endif // DEAL_II_WITH_GINKGO
576
577#endif
578/*---------------------------- ginkgo_solver.h ---------------------------*/
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
SolverBase(SolverControl &solver_control, const std::string &exec_type)
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
SolverBicgstab(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
const AdditionalData additional_data
const AdditionalData additional_data
SolverCGS(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
SolverCG(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
const AdditionalData additional_data
const AdditionalData additional_data
SolverFCG(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
const AdditionalData additional_data
SolverGMRES(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
const AdditionalData additional_data
SolverIR(SolverControl &solver_control, const std::string &exec_type, const AdditionalData &data=AdditionalData())
Definition: vector.h:110
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
@ matrix
Contents is actually a matrix.
AdditionalData(const unsigned int restart_parameter=30)