diff --git a/CHANGES.md b/CHANGES.md index 136db5d..43035a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,10 +2,15 @@ ## 2023 +#### v0.8.2 + +New Features: +- Added a helper flag to control if `CySolver.reset_state` is called at the end of initialization. + #### v0.8.1 New Features: -- Added more interp functions that take pointers as arguments +- Added more interp functions that take pointers as arguments. Changes: - Converted interp functions to use each other where possible, rather than having separate definitions. @@ -15,7 +20,7 @@ Performance: - Moved some backend functionality for CyRK.interp to pure c file for performance gains. Bug Fixes: -- Fixed issue with "cy/common.pyx" not having the correct cython flags during compliation. +- Fixed issue with "cy/common.pyx" not having the correct cython flags during compilation. ### v0.8.0 diff --git a/CyRK/cy/cysolver.pyx b/CyRK/cy/cysolver.pyx index 5aea470..712417a 100644 --- a/CyRK/cy/cysolver.pyx +++ b/CyRK/cy/cysolver.pyx @@ -246,6 +246,7 @@ cdef class CySolver: Py_ssize_t num_extra = 0, bool_cpp_t interpolate_extra = False, Py_ssize_t expected_size = 0, + bool_cpp_t call_first_reset = True, bool_cpp_t auto_solve = True): """ Initialize new CySolver instance. @@ -310,6 +311,9 @@ cdef class CySolver: Used to build temporary storage arrays for the solution results. If set to 0 (the default), then the solver will attempt to guess on a suitable expected size based on the relative tolerances and size of the integration domain. + call_first_reset : bool, default=True + If set to True, then the solver will call its `reset_state` method at the end of initialization. This flag + is overridden by the `auto_solve` flag. auto_solve : bool_cpp_t, default=True If set to True, then the solver's `solve` method will be called at the end of initialization. Otherwise, the user will have to call `solver_instance = CySolver(...); solver_instance.solve()` @@ -583,7 +587,8 @@ cdef class CySolver: # Parameters are initialized but may not be set to correct values. # Call reset state to ensure everything is ready. - self.reset_state() + if call_first_reset or auto_solve: + self.reset_state() # Run solver if requested if auto_solve: diff --git a/pyproject.toml b/pyproject.toml index e7e91a4..46ecaa8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name='CyRK' -version = '0.8.1' +version = '0.8.2' description='Runge-Kutta ODE Integrator Implemented in Cython and Numba.' authors= [ {name = 'Joe P. Renaud', email = 'joe.p.renaud@gmail.com'}