]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Support different KINSOL versions. 12030/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 8 Apr 2021 21:53:16 +0000 (15:53 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 15 Apr 2021 23:32:31 +0000 (17:32 -0600)
include/deal.II/sundials/kinsol.h
source/sundials/kinsol.cc

index f37bc2723c0724c2905d90dd87ccbaa5c464c38c..7afe2760ed782e60d27f4e50a230492c6bdab495 100644 (file)
@@ -33,7 +33,7 @@
 #  include <boost/signals2.hpp>
 
 #  include <kinsol/kinsol.h>
-#  if DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0)
+#  if DEAL_II_SUNDIALS_VERSION_LT(4, 1, 0)
 #    include <kinsol/kinsol_impl.h>
 #  endif
 #  include <nvector/nvector_serial.h>
index 0c27dc2369b4415ff36d41c0ef128a62ae7458f7..6ac153216ebdffc75f16ed18d0ef73f83719f091 100644 (file)
@@ -160,7 +160,7 @@ namespace SUNDIALS
 
 
 
-#  if DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0)
+#  if DEAL_II_SUNDIALS_VERSION_LT(4, 1, 0)
     template <typename VectorType>
     int
     setup_jacobian_callback(KINMem kinsol_mem)
@@ -431,13 +431,25 @@ namespace SUNDIALS
     if (solve_jacobian_system) // user assigned a function object to the solver
                                // slot
       {
-#  if DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0)
+/* interface up to and including 4.0 */
+#  if DEAL_II_SUNDIALS_VERSION_LT(4, 1, 0)
         auto KIN_mem        = static_cast<KINMem>(kinsol_mem);
         KIN_mem->kin_lsolve = solve_with_jacobian_callback<VectorType>;
         if (setup_jacobian) // user assigned a function object to the Jacobian
           // set-up slot
           KIN_mem->kin_lsetup = setup_jacobian_callback<VectorType>;
-#  else
+
+/* interface up to and including 4.1 */
+#  elif DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0)
+
+        // deal.II does not currently have support for KINSOL in
+        // SUNDIALS 4.1. One could write this and update this section,
+        // but it does not seem worthwhile spending the time to
+        // interface with an old version of SUNDIAL given that the
+        // code below supports modern SUNDIAL versions just fine.
+        Assert(false, ExcNotImplemented());
+
+#  else /* interface starting with SUNDIALS 5.0 */
         // Set the operations we care for in the sun_linear_solver object
         // and attach it to the KINSOL object. The functions that will get
         // called do not actually receive the KINSOL object, just the LS

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.