Mercurial > octave
changeset 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 | 236d8f52cbb3 |
files | libinterp/dldfcn/__ode15__.cc m4/acinclude.m4 |
diffstat | 2 files changed, 17 insertions(+), 42 deletions(-) [+] |
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)
--- a/m4/acinclude.m4 Wed Mar 13 05:54:28 2019 +0000 +++ b/m4/acinclude.m4 Wed Mar 13 08:03:10 2019 +0100 @@ -2239,16 +2239,13 @@ dnl enabled. dnl AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU], [ - AC_CHECK_HEADERS([sundials/sundials_sparse.h sunlinsol/sunlinsol_klu.h]) + AC_CHECK_HEADERS([sunlinsol/sunlinsol_klu.h]) AC_CACHE_CHECK([whether SUNDIALS IDA is configured with SUNLINSOL_KLU enabled], [octave_cv_sundials_sunlinsol_klu], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if defined (HAVE_IDA_IDA_H) #include <ida/ida.h> #endif - #if defined (HAVE_SUNDIALS_SUNDIALS_SPARSE_H) - #include <sundials/sundials_sparse.h> - #endif #if defined (HAVE_KLU_H) #include <klu.h> #endif @@ -2283,21 +2280,16 @@ dnl The IDADENSE API was removed in SUNDIALS version 3.0.0. dnl AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE], [ - AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h sundials/sundials_matrix.h sundials/sundials_linearsolver.h ida/ida_direct.h]) + AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h]) AC_CACHE_CHECK([whether SUNDIALS IDA includes the SUNLINSOL_DENSE linear solver], [octave_cv_sundials_sunlinsol_dense], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if defined (HAVE_IDA_IDA_H) #include <ida/ida.h> #endif - #if defined (HAVE_SUNDIALS_SUNDIALS_MATRIX_H) - #include <sundials/sundials_matrix.h> + #if defined (HAVE_SUNLINSOL_SUNLINSOL_DENSE_H) + #include <sunlinsol/sunlinsol_dense.h> #endif - #if defined (HAVE_SUNDIALS_SUNDIALS_LINEARSOLVER_H) - #include <sundials/sundials_linearsolver.h> - #endif - #if defined (HAVE_IDA_IDA_DIRECT_H) - #include <ida/ida_direct.h> #endif ]], [[ void *mem = 0;