21#ifdef DEAL_II_WITH_SUNDIALS
29# ifdef DEAL_II_WITH_TRILINOS
33# ifdef DEAL_II_WITH_PETSC
48 <<
"One of the SUNDIALS linear solver internal"
49 <<
" functions returned a negative error code: " << arg1
50 <<
". Please consult SUNDIALS manual.");
52# define AssertSundialsSolver(code) \
53 Assert(code >= 0, ExcSundialsSolverError(code))
69 template <
typename F,
typename... Args>
71 call_and_possibly_capture_exception(
const F & f,
72 std::exception_ptr &eptr,
86 std::rethrow_exception(eptr);
103 f(std::forward<Args>(args)...);
113 eptr = std::current_exception();
118 catch (
const std::exception &)
120 eptr = std::current_exception();
132 template <
typename VectorType>
151# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
176 template <
typename VectorType>
188 return SUNLINEARSOLVER_ITERATIVE;
193 template <
typename VectorType>
203 auto *src_b = unwrap_nvector_const<VectorType>(b);
204 auto *dst_x = unwrap_nvector<VectorType>(x);
222 return call_and_possibly_capture_exception(content->
lsolve,
233 template <
typename VectorType>
246 template <
typename VectorType>
256 template <
typename VectorType>
269 template <
typename VectorType>
287 template <
typename VectorType>
290 std::exception_ptr & pending_exception
299# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
311 arkode_linsol_set_preconditioner<VectorType>;
314# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
315 content->linsol_ctx = linsol_ctx;
324 template <
typename VectorType>
327 SUNLinSolFreeEmpty(sun_linear_solver);
332 template <
typename VectorType>
335 return sun_linear_solver;
341# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
342 template <
typename VectorType>
347 , a_times_fn(a_times_fn)
348 , linsol_ctx(linsol_ctx)
355 template <
typename VectorType>
359 , a_times_fn(a_times_fn)
368 template <
typename VectorType>
371 const VectorType &src)
const
373 auto sun_dst = internal::make_nvector_view(dst
379 auto sun_src = internal::make_nvector_view(src
385 int status = a_times_fn(A_data, sun_src, sun_dst);
392# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
393 template <
typename VectorType>
400 , p_solve_fn(p_solve_fn)
401 , linsol_ctx(linsol_ctx)
405 template <
typename VectorType>
411 , p_solve_fn(p_solve_fn)
418 template <
typename VectorType>
421 const VectorType &src)
const
430 auto sun_dst = internal::make_nvector_view(dst
436 auto sun_src = internal::make_nvector_view(src
445 p_solve_fn(P_data, sun_src, sun_dst, tol, 0 );
470# ifdef DEAL_II_WITH_MPI
471# ifdef DEAL_II_WITH_TRILINOS
483# ifdef DEAL_II_WITH_PETSC
484# ifndef PETSC_USE_COMPLEX
std::unique_ptr< LinearSolverContent< VectorType > > content
SUNLinearSolver sun_linear_solver
LinearSolverWrapper(const LinearSolveFunction< VectorType > &lsolve, std::exception_ptr &pending_exception, SUNContext linsol_ctx)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_SUNDIALS_VERSION_GTE(major, minor, patch)
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & RecoverableUserCallbackError()
static ::ExceptionBase & ExcSundialsSolverError(int arg1)
#define AssertThrow(cond, exc)
std::function< void(SundialsOperator< VectorType > &op, SundialsPreconditioner< VectorType > &prec, VectorType &x, const VectorType &b, double tol)> LinearSolveFunction
void vmult(VectorType &dst, const VectorType &src) const
SundialsOperator(void *A_data, ATimesFn a_times_fn, SUNContext linsol_ctx)
SundialsPreconditioner(void *P_data, PSolveFn p_solve_fn, SUNContext linsol_ctx, double tol)
void vmult(VectorType &dst, const VectorType &src) const
std::exception_ptr & pending_exception
LinearSolveFunction< VectorType > lsolve
LinearSolverContent(std::exception_ptr &pending_exception)
PSolveFn preconditioner_solve
PSetupFn preconditioner_setup
#define AssertSundialsSolver(code)