From cdef39c109a2fbbf5decd1b8ceb312081b98e4d5 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 22 May 2022 22:33:13 -0400 Subject: [PATCH] Fix KINSOL for SUNDIALS 6. --- source/sundials/kinsol.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/sundials/kinsol.cc b/source/sundials/kinsol.cc index 1da1833450..dd6796bdfc 100644 --- a/source/sundials/kinsol.cc +++ b/source/sundials/kinsol.cc @@ -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 } @@ -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::value == false) -- 2.39.5