Reference documentation for deal.II version 9.6.0
\(\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
sunlinsol_wrapper.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 2024 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
16#ifndef dealii_sundials_sunlinsol_wrapper_h
17#define dealii_sundials_sunlinsol_wrapper_h
18
19#include <deal.II/base/config.h>
20
21#ifdef DEAL_II_WITH_SUNDIALS
22
23# include <sundials/sundials_linearsolver.h>
24
25# include <exception>
26# include <functional>
27# include <memory>
28
30
31namespace SUNDIALS
32{
33# ifndef DOXYGEN
34 // forward declarations
35 namespace internal
36 {
37 template <typename VectorType>
38 struct LinearSolverContent;
39 }
40# endif
41
45 template <typename VectorType>
47 {
51 void
52 vmult(VectorType &dst, const VectorType &src) const;
53
54# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
65# else
72 SundialsOperator(void *A_data, ATimesFn a_times_fn);
73# endif
74
75 private:
79 void *A_data;
80
81# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
87
92# else
97 ATimesFn a_times_fn;
98# endif
99 };
100
101
102
108 template <typename VectorType>
110 {
118 void
119 vmult(VectorType &dst, const VectorType &src) const;
120
121# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
138 double tol);
139# else
152 SundialsPreconditioner(void *P_data, PSolveFn p_solve_fn, double tol);
153# endif
154
155 private:
159 void *P_data;
160
161# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
167
172# else
177 PSolveFn p_solve_fn;
178# endif
179
184 double tol;
185 };
186
213 template <typename VectorType>
215 std::function<void(SundialsOperator<VectorType> &op,
217 VectorType &x,
218 const VectorType &b,
219 double tol)>;
220
221 namespace internal
222 {
229 template <typename VectorType>
231 {
232 public:
233 explicit LinearSolverWrapper(
235 std::exception_ptr &pending_exception
237 ,
238 SUNContext linsol_ctx
239# endif
240 );
241
243
247 operator SUNLinearSolver();
248
249 private:
251 std::unique_ptr<LinearSolverContent<VectorType>> content;
252 };
253 } // namespace internal
254} // namespace SUNDIALS
255
257
258#endif
259#endif
std::unique_ptr< LinearSolverContent< VectorType > > content
LinearSolverWrapper(const LinearSolveFunction< VectorType > &lsolve, std::exception_ptr &pending_exception, SUNContext linsol_ctx)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_SUNDIALS_VERSION_GTE(major, minor, patch)
Definition config.h:404
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
std::function< void(SundialsOperator< VectorType > &op, SundialsPreconditioner< VectorType > &prec, VectorType &x, const VectorType &b, double tol)> LinearSolveFunction
SundialsOperator(void *A_data, SUNATimesFn a_times_fn, SUNContext linsol_ctx)
void vmult(VectorType &dst, const VectorType &src) const
SundialsPreconditioner(void *P_data, SUNPSolveFn p_solve_fn, SUNContext linsol_ctx, double tol)
void vmult(VectorType &dst, const VectorType &src) const