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>
193 template <
typename VectorType>
216 content->preconditioner_solve,
222 return call_and_possibly_capture_exception(content->lsolve,
223 content->pending_exception,
233 template <
typename VectorType>
239 if (content->preconditioner_setup)
240 return content->preconditioner_setup(content->P_data);
246 template <
typename VectorType>
256 template <
typename VectorType>
262 content->A_data = A_data;
263 content->a_times_fn =
ATimes;
269 template <
typename VectorType>
278 content->P_data = P_data;
279 content->preconditioner_setup =
p_setup;
280 content->preconditioner_solve =
p_solve;
287 template <
typename VectorType>
290 std::exception_ptr & pending_exception
299# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
314# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
315 content->linsol_ctx = linsol_ctx;
324 template <
typename VectorType>
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
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
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)
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)