20#ifdef DEAL_II_WITH_SUNDIALS
21# if DEAL_II_SUNDIALS_VERSION_GTE(4, 0, 0)
29# ifdef DEAL_II_WITH_TRILINOS
33# ifdef DEAL_II_WITH_PETSC
40# if DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0)
52 <<
"One of the SUNDIALS linear solver internal"
53 <<
" functions returned a negative error code: " << arg1
54 <<
". Please consult SUNDIALS manual.");
56# define AssertSundialsSolver(code) \
57 Assert(code >= 0, ExcSundialsSolverError(code))
64 template <
typename VectorType>
86 template <
typename VectorType>
98 return SUNLINEARSOLVER_ITERATIVE;
103 template <
typename VectorType>
111 auto content = access_content<VectorType>(LS);
113 auto *src_b = unwrap_nvector_const<VectorType>(
b);
114 auto *dst_x = unwrap_nvector<VectorType>(x);
119 content->P_data, content->preconditioner_solve, tol);
121 return content->lsolve(op, preconditioner, *dst_x, *src_b, tol);
126 template <
typename VectorType>
130 auto content = access_content<VectorType>(LS);
131 if (content->preconditioner_setup)
132 return content->preconditioner_setup(content->P_data);
138 template <
typename VectorType>
148 template <
typename VectorType>
152 auto content = access_content<VectorType>(LS);
153 content->A_data = A_data;
154 content->a_times_fn = ATimes;
160 template <
typename VectorType>
167 auto content = access_content<VectorType>(LS);
168 content->P_data = P_data;
169 content->preconditioner_setup = p_setup;
170 content->preconditioner_solve = p_solve;
177 template <
typename VectorType>
189 arkode_linsol_set_preconditioner<VectorType>;
199 template <
typename VectorType>
207 template <
typename VectorType>
210 return sun_linear_solver;
216 template <
typename VectorType>
220 , a_times_fn(a_times_fn)
228 template <
typename VectorType>
231 const VectorType &src)
const
233 auto sun_dst = internal::make_nvector_view(dst);
234 auto sun_src = internal::make_nvector_view(src);
235 int status = a_times_fn(A_data, sun_src, sun_dst);
242 template <
typename VectorType>
248 , p_solve_fn(p_solve_fn)
254 template <
typename VectorType>
257 const VectorType &src)
const
266 auto sun_dst = internal::make_nvector_view(dst);
267 auto sun_src = internal::make_nvector_view(src);
271 p_solve_fn(P_data, sun_src, sun_dst, tol, 0 );
296# ifdef DEAL_II_WITH_MPI
297# ifdef DEAL_II_WITH_TRILINOS
309# ifdef DEAL_II_WITH_PETSC
310# ifndef PETSC_USE_COMPLEX
LinearSolverWrapper(LinearSolveFunction< VectorType > lsolve)
std::unique_ptr< LinearSolverContent< VectorType > > content
SUNLinearSolver sun_linear_solver
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcSundialsSolverError(int arg1)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
void SUNLinSolFreeEmpty(SUNLinearSolver solver)
SUNLinearSolver SUNLinSolNewEmpty()
std::function< int(SundialsOperator< VectorType > &op, SundialsPreconditioner< VectorType > &prec, VectorType &x, const VectorType &b, double tol)> LinearSolveFunction
DeclException1(ExcARKodeError, int,<< "One of the SUNDIALS ARKode internal functions "<< " returned a negative error code: "<< arg1<< ". Please consult SUNDIALS manual.")
SundialsOperator(void *A_data, ATimesFn a_times_fn)
void vmult(VectorType &dst, const VectorType &src) const
SundialsPreconditioner(void *P_data, PSolveFn p_solve_fn, double tol)
void vmult(VectorType &dst, const VectorType &src) const
LinearSolveFunction< VectorType > lsolve
PSolveFn preconditioner_solve
PSetupFn preconditioner_setup
#define AssertSundialsSolver(code)