diff --git a/CHANGELOG b/CHANGELOG index b9482f0e..9dde4236 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ --- CHANGELOG --- +--- Assimulo-3.5.x --- + * Added get_sundials_version function (import from assimulo.solvers.sundials). + --- Assimulo-3.5.2 --- * Allow to build without distutils for Python>=3.12 support diff --git a/src/solvers/sundials.pyx b/src/solvers/sundials.pyx index a019f539..c5f1424b 100644 --- a/src/solvers/sundials.pyx +++ b/src/solvers/sundials.pyx @@ -45,6 +45,12 @@ include "../lib/sundials_constants.pxi" #Sundials related constants include "../lib/sundials_callbacks.pxi" include "../lib/sundials_callbacks_ida_cvode.pxi" +_sundials_version = SUNDIALS_VERSION + +cpdef get_sundials_version(): + """Return SUNDIALS version as tuple.""" + a = 11 + return _sundials_version cdef class IDA(Implicit_ODE): """ diff --git a/tests/solvers/test_sundials.py b/tests/solvers/test_sundials.py index 39bbd30f..de166834 100644 --- a/tests/solvers/test_sundials.py +++ b/tests/solvers/test_sundials.py @@ -17,7 +17,7 @@ import nose from assimulo import testattr -from assimulo.solvers.sundials import CVode, IDA, CVodeError +from assimulo.solvers.sundials import CVode, IDA, CVodeError, get_sundials_version from assimulo.problem import Explicit_Problem from assimulo.problem import Implicit_Problem from assimulo.exception import AssimuloException, TimeLimitExceeded, TerminateSimulation @@ -1569,3 +1569,9 @@ def test_pbar(self): nose.tools.assert_almost_equal(imp_sim.pbar[0], 1000.00000,4) nose.tools.assert_almost_equal(imp_sim.pbar[1], 100.000000,4) + + @testattr(stddist = True) + def test_get_sundials_version(self): + """Test fetching the sundials version.""" + version = get_sundials_version() + assert isinstance(version, tuple), "Expected version to be a tuple"