From: Wolfgang Bangerth Date: Thu, 8 Apr 2021 21:53:16 +0000 (-0600) Subject: Support different KINSOL versions. X-Git-Tag: v9.3.0-rc1~220^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12030%2Fhead;p=dealii.git Support different KINSOL versions. --- diff --git a/include/deal.II/sundials/kinsol.h b/include/deal.II/sundials/kinsol.h index f37bc2723c..7afe2760ed 100644 --- a/include/deal.II/sundials/kinsol.h +++ b/include/deal.II/sundials/kinsol.h @@ -33,7 +33,7 @@ # include # include -# if DEAL_II_SUNDIALS_VERSION_LT(5, 0, 0) +# if DEAL_II_SUNDIALS_VERSION_LT(4, 1, 0) # include # endif # include diff --git a/source/sundials/kinsol.cc b/source/sundials/kinsol.cc index 0c27dc2369..6ac153216e 100644 --- a/source/sundials/kinsol.cc +++ b/source/sundials/kinsol.cc @@ -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 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(kinsol_mem); KIN_mem->kin_lsolve = solve_with_jacobian_callback; if (setup_jacobian) // user assigned a function object to the Jacobian // set-up slot KIN_mem->kin_lsetup = setup_jacobian_callback; -# 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