Skip to content

Commit

Permalink
Merge pull request #13788 from drwells/kinsol-sundials-6
Browse files Browse the repository at this point in the history
Kinsol sundials 6
  • Loading branch information
marcfehling committed May 24, 2022
2 parents de3c59a + b2fe65c commit 425bf33
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions source/sundials/kinsol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ namespace SUNDIALS
, kinsol_mem(nullptr)
{
set_functions_to_trigger_an_assert();

# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
const int status = SUNContext_Create(&mpi_communicator, &kinsol_ctx);
(void)status;
AssertKINSOL(status);
# endif
}


Expand All @@ -325,12 +331,11 @@ namespace SUNDIALS
if (kinsol_mem)
{
KINFree(&kinsol_mem);

# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
status = SUNContext_Free(&kinsol_ctx);
AssertKINSOL(status);
# endif
}
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
status = SUNContext_Free(&kinsol_ctx);
AssertKINSOL(status);
# endif

# ifdef DEAL_II_WITH_MPI
if (is_serial_vector<VectorType>::value == false)
Expand All @@ -350,7 +355,7 @@ namespace SUNDIALS

if (get_solution_scaling)
u_scale = internal::make_nvector_view(get_solution_scaling()
# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
,
kinsol_ctx
# endif
Expand All @@ -360,7 +365,7 @@ namespace SUNDIALS
reinit_vector(u_scale_temp);
u_scale_temp = 1.0;
u_scale = internal::make_nvector_view(u_scale_temp
# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
,
kinsol_ctx
# endif
Expand All @@ -369,7 +374,7 @@ namespace SUNDIALS

if (get_function_scaling)
f_scale = internal::make_nvector_view(get_function_scaling()
# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
,
kinsol_ctx
# endif
Expand All @@ -379,7 +384,7 @@ namespace SUNDIALS
reinit_vector(f_scale_temp);
f_scale_temp = 1.0;
f_scale = internal::make_nvector_view(f_scale_temp
# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
,
kinsol_ctx
# endif
Expand All @@ -401,7 +406,7 @@ namespace SUNDIALS
}

auto solution = internal::make_nvector_view(initial_guess_and_solution
# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
,
kinsol_ctx
# endif
Expand All @@ -414,7 +419,7 @@ namespace SUNDIALS
{
KINFree(&kinsol_mem);

# if !DEAL_II_SUNDIALS_VERSION_LT(6, 0, 0)
# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
status = SUNContext_Free(&kinsol_ctx);
AssertKINSOL(status);
# endif
Expand Down

0 comments on commit 425bf33

Please sign in to comment.