From 6efb5d47c761d7b6e3952fbd47360b7b20f918b7 Mon Sep 17 00:00:00 2001 From: Jrenaud-Desk Date: Fri, 8 Sep 2023 10:49:42 -0400 Subject: [PATCH 1/2] added helper flag to CySolver --- CHANGES.md | 7 ++++++- CyRK/cy/cysolver.pyx | 7 ++++++- pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 136db5d..4edd34a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,11 @@ ## 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: @@ -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..762728d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name='CyRK' -version = '0.8.1' +version = '0.8.2a0.dev0' description='Runge-Kutta ODE Integrator Implemented in Cython and Numba.' authors= [ {name = 'Joe P. Renaud', email = 'joe.p.renaud@gmail.com'} From 724bce021fd6489a2d0b6a27d28244bdb36a0537 Mon Sep 17 00:00:00 2001 From: Jrenaud-Desk Date: Mon, 25 Sep 2023 12:24:39 -0400 Subject: [PATCH 2/2] updated changes and version --- CHANGES.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4edd34a..43035a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,7 @@ New Features: #### 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. diff --git a/pyproject.toml b/pyproject.toml index 762728d..46ecaa8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name='CyRK' -version = '0.8.2a0.dev0' +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'}