diff libinterp/dldfcn/__ode15__.cc @ 26898:d94876e7a0aa

Remove calls to deprecated sundials functions. * libinterp/dldfcn/__ode15__.cc : Simplify list of includes and remove use of deprecated functions. * m4/acinclude.m4 : do not check for headers that are not actually included
author Carlo de Falco <carlo.defalco@polimi.it>
date Wed, 13 Mar 2019 08:03:10 +0100
parents ba0c9e84f6a8
children 73b141d5a888
line wrap: on
line diff
--- a/libinterp/dldfcn/__ode15__.cc	Wed Mar 13 05:54:28 2019 +0000
+++ b/libinterp/dldfcn/__ode15__.cc	Wed Mar 13 08:03:10 2019 +0100
@@ -41,31 +41,18 @@
 
 #if defined (HAVE_SUNDIALS)
 
-#  if defined (HAVE_IDA_IDA_H)
-#    include <ida/ida.h>
+#  if defined (HAVE_NVECTOR_NVECTOR_SERIAL_H)
+#    include <nvector/nvector_serial.h>
 #  endif
 
-#  if defined (HAVE_SUNDIALS_SUNDIALS_MATRIX_H)
-#    include <sundials/sundials_matrix.h>
-#  endif
-
-#  if defined (HAVE_SUNDIALS_SUNDIALS_LINEARSOLVER_H)
-#    include <sundials/sundials_linearsolver.h>
+#  if defined (HAVE_IDA_IDA_H)
+#    include <ida/ida.h>
 #  endif
 
 #  if defined (HAVE_SUNLINSOL_SUNLINSOL_DENSE_H)
 #    include <sunlinsol/sunlinsol_dense.h>
 #  endif
 
-#  if defined (HAVE_IDA_IDA_DIRECT_H)
-#    include <ida/ida_direct.h>
-#  endif
-
-#  if defined (HAVE_SUNDIALS_SUNDIALS_SPARSE_H)
-#    include <sundials/sundials_sparse.h>
-#  endif
-
-
 #  if defined (HAVE_SUNLINSOL_SUNLINSOL_KLU_H)
 #    if defined (HAVE_KLU_H)
 #      include <klu.h>
@@ -82,10 +69,6 @@
 #    include <sunlinsol/sunlinsol_klu.h>
 #  endif
 
-#  if defined (HAVE_NVECTOR_NVECTOR_SERIAL_H)
-#    include <nvector/nvector_serial.h>
-#  endif
-
 static inline realtype *
 nv_data_s (N_Vector& v)
 {
@@ -263,7 +246,7 @@
     void
     jacsparse_impl (realtype t, realtype cj, N_Vector& yy,
                     N_Vector& yyp, SUNMatrix& Jac);
-#endif
+#  endif
 
     void set_maxstep (realtype maxstep);
 
@@ -366,7 +349,7 @@
 
     if (havejacsparse)
       {
-#if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
+#  if defined (HAVE_SUNDIALS_SUNLINSOL_KLU)
         // FIXME : one should not allocate space for a full Jacobian
         // when using a sparse format. Consider allocating less space
         // then possibly using SUNSparseMatrixReallocate to increase it.
@@ -374,14 +357,14 @@
         if (! sunJacMatrix)
           error ("Unable to create sparse Jacobian for Sundials");
 
-        sunLinearSolver = SUNKLU (yy, sunJacMatrix);
+        sunLinearSolver = SUNLinSol_KLU (yy, sunJacMatrix);
         if (! sunLinearSolver)
           error ("Unable to create KLU sparse solver");
 
-        if (IDADlsSetLinearSolver (mem, sunLinearSolver, sunJacMatrix))
+        if (IDASetLinearSolver (mem, sunLinearSolver, sunJacMatrix))
           error ("Unable to set sparse linear solver");
 
-        IDADlsSetJacFn (mem, IDA::jacsparse);
+        IDASetJacFn (mem, IDA::jacsparse);
 
 #  else
         error ("SUNDIALS SUNLINSOL KLU is not available in this version of Octave");
@@ -395,14 +378,14 @@
         if (! sunJacMatrix)
           error ("Unable to create dense Jacobian for Sundials");
 
-        sunLinearSolver = SUNDenseLinearSolver (yy, sunJacMatrix);
+        sunLinearSolver = SUNLinSol_Dense (yy, sunJacMatrix);
         if (! sunLinearSolver)
           error ("Unable to create dense linear solver");
 
-        if (IDADlsSetLinearSolver (mem, sunLinearSolver, sunJacMatrix))
+        if (IDASetLinearSolver (mem, sunLinearSolver, sunJacMatrix))
           error ("Unable to set dense linear solver");
 
-        if (havejac && IDADlsSetJacFn (mem, IDA::jacdense) != 0)
+        if (havejac && IDASetJacFn (mem, IDA::jacdense) != 0)
           error ("Unable to set dense Jacobian function");
 
       }
@@ -470,7 +453,7 @@
 
     END_INTERRUPT_WITH_EXCEPTIONS;
   }
-#endif
+#  endif
 
   ColumnVector
   IDA::NVecToCol (N_Vector& v, long int n)