]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix KINSOL for SUNDIALS 6.
authorDavid Wells <drwells@email.unc.edu>
Mon, 23 May 2022 02:33:13 +0000 (22:33 -0400)
committerDavid Wells <drwells@email.unc.edu>
Tue, 24 May 2022 02:33:44 +0000 (22:33 -0400)
source/sundials/kinsol.cc

index 1da183345060b37e4626213739e7c80c85f86e81..dd6796bdfc7f4483c5adaf7f0084d56ce7c4686d 100644 (file)
@@ -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<VectorType>::value == false)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.