20#ifdef DEAL_II_WITH_SUNDIALS
28# ifdef DEAL_II_WITH_TRILINOS
32# 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>
147# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
180 template <
typename VectorType>
193 return SUNLINEARSOLVER_ITERATIVE;
198 template <
typename VectorType>
238 template <
typename VectorType>
251 template <
typename VectorType>
261 template <
typename VectorType>
281 template <
typename VectorType>
305 template <
typename VectorType>
308 std::exception_ptr &pending_exception
317# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
329 arkode_linsol_set_preconditioner<VectorType>;
332# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
333 content->linsol_ctx = linsol_ctx;
342 template <
typename VectorType>
345 SUNLinSolFreeEmpty(sun_linear_solver);
350 template <
typename VectorType>
353 return sun_linear_solver;
359# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
360 template <
typename VectorType>
365 , a_times_fn(a_times_fn)
366 , linsol_ctx(linsol_ctx)
373 template <
typename VectorType>
377 , a_times_fn(a_times_fn)
386 template <
typename VectorType>
389 const VectorType &src)
const
391 auto sun_dst = internal::make_nvector_view(dst
397 auto sun_src = internal::make_nvector_view(src
403 int status = a_times_fn(A_data, sun_src, sun_dst);
410# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
411 template <
typename VectorType>
418 , p_solve_fn(p_solve_fn)
419 , linsol_ctx(linsol_ctx)
423 template <
typename VectorType>
429 , p_solve_fn(p_solve_fn)
436 template <
typename VectorType>
439 const VectorType &src)
const
448 auto sun_dst = internal::make_nvector_view(dst
454 auto sun_src = internal::make_nvector_view(src
463 p_solve_fn(P_data, sun_src, sun_dst, tol, 0 );
488# ifdef DEAL_II_WITH_MPI
489# ifdef DEAL_II_WITH_TRILINOS
501# ifdef DEAL_II_WITH_PETSC
502# 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)
int call_and_possibly_capture_exception(const F &f, std::exception_ptr &eptr, Args &&...args)
VectorType * unwrap_nvector(N_Vector v)
const VectorType * unwrap_nvector_const(N_Vector v)
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
std::exception_ptr & pending_exception
SUNPSetupFn preconditioner_setup
LinearSolveFunction< VectorType > lsolve
LinearSolverContent(std::exception_ptr &pending_exception)
SUNPSolveFn preconditioner_solve
#define AssertSundialsSolver(code)