* @param a_times_fn A function pointer to the function that computes A*v
* @param linsol_ctx The context object used to set up the linear solver and all vectors
*/
- SundialsOperator(void *A_data, ATimesFn a_times_fn, SUNContext linsol_ctx);
+ SundialsOperator(void *A_data,
+ SUNATimesFn a_times_fn,
+ SUNContext linsol_ctx);
# else
/**
* Constructor.
*/
void *A_data;
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
/**
* %Function pointer declared by SUNDIALS to evaluate the matrix vector
* product.
*/
- ATimesFn a_times_fn;
+ SUNATimesFn a_times_fn;
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
/**
* Context object used for SUNDIALS logging.
*/
SUNContext linsol_ctx;
+# else
+ /**
+ * %Function pointer declared by SUNDIALS to evaluate the matrix vector
+ * product.
+ */
+ ATimesFn a_times_fn;
# endif
};
* 6.0.0. If you are using an earlier version of SUNDIALS then you need to
* use the other constructor.
*/
- SundialsPreconditioner(void *P_data,
- PSolveFn p_solve_fn,
- SUNContext linsol_ctx,
- double tol);
+ SundialsPreconditioner(void *P_data,
+ SUNPSolveFn p_solve_fn,
+ SUNContext linsol_ctx,
+ double tol);
# else
/**
* Constructor.
*/
void *P_data;
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
/**
* %Function pointer to a function that computes the preconditioner
* application.
*/
- PSolveFn p_solve_fn;
+ SUNPSolveFn p_solve_fn;
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
/**
* Context object used for SUNDIALS logging.
*/
SUNContext linsol_ctx;
+# else
+ /**
+ * %Function pointer to a function that computes the preconditioner
+ * application.
+ */
+ PSolveFn p_solve_fn;
# endif
/**
{
set_functions_to_trigger_an_assert();
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
// SUNDIALS will always duplicate communicators if we provide them. This
// can cause problems if SUNDIALS is configured with MPI and we pass along
// MPI_COMM_SELF in a serial application as MPI won't be
// initialized. Hence, work around that by just not providing a
// communicator in that case.
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
+ const int status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &arkode_ctx);
+ (void)status;
+ AssertARKode(status);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
const int status =
SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? nullptr :
&mpi_communicator,
int status;
(void)status;
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
status = SUNContext_Free(&arkode_ctx);
AssertARKode(status);
+
+ // Same comment applies as in class constructor:
+ status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &arkode_ctx);
+ AssertARKode(status);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ status = SUNContext_Free(&arkode_ctx);
+ AssertARKode(status);
+
// Same comment applies as in class constructor:
status =
SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? nullptr :
# else
sun_linear_solver =
SUNLinSol_SPGMR(y_template,
- PREC_NONE,
+ SUN_PREC_NONE,
0 /*krylov subvectors, 0 uses default*/,
arkode_ctx);
# endif
auto jacobian_solver_setup_callback = [](SUNDIALS::realtype t,
N_Vector y,
N_Vector fy,
- booleantype jok,
- booleantype *jcurPtr,
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ sunbooleantype jok,
+ sunbooleantype *jcurPtr,
+# else
+ booleantype jok,
+ booleantype *jcurPtr,
+# endif
SUNDIALS::realtype gamma,
void *user_data) -> int {
Assert(user_data != nullptr, ExcInternalError());
# else
sun_mass_linear_solver =
SUNLinSol_SPGMR(y_template,
- PREC_NONE,
+ SUN_PREC_NONE,
0 /*krylov subvectors, 0 uses default*/,
arkode_ctx);
# endif
}
+
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ sunbooleantype mass_time_dependent =
+ data.mass_is_time_independent ? SUNFALSE : SUNTRUE;
+# else
booleantype mass_time_dependent =
data.mass_is_time_independent ? SUNFALSE : SUNTRUE;
+# endif
+
status = ARKStepSetMassLinearSolver(arkode_mem,
sun_mass_linear_solver,
nullptr,
, mpi_communicator(mpi_comm)
, pending_exception(nullptr)
{
+ set_functions_to_trigger_an_assert();
+
// SUNDIALS will always duplicate communicators if we provide them. This
// can cause problems if SUNDIALS is configured with MPI and we pass along
// MPI_COMM_SELF in a serial application as MPI won't be
// initialized. Hence, work around that by just not providing a
// communicator in that case.
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
+ const int status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &ida_ctx);
+ (void)status;
+ AssertIDA(status);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
const int status =
SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? nullptr :
&mpi_communicator,
(void)status;
AssertIDA(status);
# endif
- set_functions_to_trigger_an_assert();
}
int status;
(void)status;
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
+ status = SUNContext_Free(&ida_ctx);
+ AssertIDA(status);
+
+ // Same comment applies as in class constructor:
+ status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &ida_ctx);
+ AssertIDA(status);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
status = SUNContext_Free(&ida_ctx);
AssertIDA(status);
// Make sure we #include the SUNDIALS config file...
# include <sundials/sundials_config.h>
// ...before the rest of the SUNDIALS files:
-# include <kinsol/kinsol_direct.h>
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+# include <kinsol/kinsol_ls.h>
+# else
+# include <kinsol/kinsol_direct.h>
+# endif
# include <sunlinsol/sunlinsol_dense.h>
# include <sunmatrix/sunmatrix_dense.h>
{
set_functions_to_trigger_an_assert();
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
// SUNDIALS will always duplicate communicators if we provide them. This
// can cause problems if SUNDIALS is configured with MPI and we pass along
// MPI_COMM_SELF in a serial application as MPI won't be
// initialized. Hence, work around that by just not providing a
// communicator in that case.
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
+ const int status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &kinsol_ctx);
+ (void)status;
+ AssertKINSOL(status);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
const int status =
SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? nullptr :
&mpi_communicator,
AssertKINSOL(status);
# endif
-# if DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
- kinsol_mem = KINCreate();
-# else
+
+# if DEAL_II_SUNDIALS_VERSION_GTE(7, 0, 0)
+ // Same comment applies as in class constructor:
+ status =
+ SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? SUN_COMM_NULL :
+ mpi_communicator,
+ &kinsol_ctx);
+ AssertKINSOL(status);
+
+ kinsol_mem = KINCreate(kinsol_ctx);
+# elif DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
// Same comment applies as in class constructor:
status =
SUNContext_Create(mpi_communicator == MPI_COMM_SELF ? nullptr :
AssertKINSOL(status);
kinsol_mem = KINCreate(kinsol_ctx);
+# else
+ kinsol_mem = KINCreate();
# endif
status = KINSetUserData(kinsol_mem, static_cast<void *>(this));
, pending_exception(pending_exception)
{}
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ SUNATimesFn a_times_fn;
+ SUNPSetupFn preconditioner_setup;
+ SUNPSolveFn preconditioner_solve;
+
+ SUNContext linsol_ctx;
+# else
ATimesFn a_times_fn;
PSetupFn preconditioner_setup;
PSolveFn preconditioner_solve;
-
-# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
- SUNContext linsol_ctx;
# endif
LinearSolveFunction<VectorType> lsolve;
}
-
template <typename VectorType>
int
- arkode_linsol_set_a_times(SUNLinearSolver LS, void *A_data, ATimesFn ATimes)
+ arkode_linsol_set_a_times(SUNLinearSolver LS,
+ void *A_data,
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ SUNATimesFn ATimes)
+# else
+ ATimesFn ATimes)
+# endif
{
LinearSolverContent<VectorType> *content = access_content<VectorType>(LS);
int
arkode_linsol_set_preconditioner(SUNLinearSolver LS,
void *P_data,
- PSetupFn p_setup,
- PSolveFn p_solve)
+# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
+ SUNPSetupFn p_setup,
+ SUNPSolveFn p_solve)
+# else
+ PSetupFn p_setup,
+ PSolveFn p_solve)
+# endif
{
LinearSolverContent<VectorType> *content = access_content<VectorType>(LS);
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
template <typename VectorType>
- SundialsOperator<VectorType>::SundialsOperator(void *A_data,
- ATimesFn a_times_fn,
- SUNContext linsol_ctx)
+ SundialsOperator<VectorType>::SundialsOperator(void *A_data,
+ SUNATimesFn a_times_fn,
+ SUNContext linsol_ctx)
: A_data(A_data)
, a_times_fn(a_times_fn)
, linsol_ctx(linsol_ctx)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
template <typename VectorType>
SundialsPreconditioner<VectorType>::SundialsPreconditioner(
- void *P_data,
- PSolveFn p_solve_fn,
- SUNContext linsol_ctx,
- double tol)
+ void *P_data,
+ SUNPSolveFn p_solve_fn,
+ SUNContext linsol_ctx,
+ double tol)
: P_data(P_data)
, p_solve_fn(p_solve_fn)
, linsol_ctx(linsol_ctx)