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>
198 template <
typename VectorType>
221 content->preconditioner_solve,
228 content->pending_exception,
238 template <
typename VectorType>
244 if (content->preconditioner_setup)
245 return content->preconditioner_setup(content->P_data);
251 template <
typename VectorType>
261 template <
typename VectorType>
274 content->A_data = A_data;
275 content->a_times_fn =
ATimes;
281 template <
typename VectorType>
296 content->P_data = P_data;
297 content->preconditioner_setup =
p_setup;
298 content->preconditioner_solve =
p_solve;
305 template <
typename VectorType>
308 std::exception_ptr &pending_exception
317# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
332# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
333 content->linsol_ctx = linsol_ctx;
342 template <
typename VectorType>
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
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
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)
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)