-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace take_state with set_state #44
Comments
I'm leaning towards option B for this so you don't have to do the |
actually, I think this would be better: solver.state_mut()[0] += 1.0;
solver.step(); where This would complicate the solvers, which would need to keep track if state has been mutated or not, but user code would be nicer and would reduce the size of the api |
I ended up keeping take_state and adding state_mut, take_state would still be useful for transferring state to another solver |
* feat: add state_mut to methods #44 * feat: generating a new state automatically does the setup * docs: fix some docs
at the moment OdeEquations has the following function for take state:
However, when you set the state again with
set_problem
, there is a lot of unnecessary initialisation done, e.g. setting the initial timestep (see #34 ).Option A:
I'm thinking of replacing
take_step
by aset_state
, which would allow a user to set the internal OdeSolverState, while keeping the initialisation of other internal variables to a minimumSo user code would be:
Option B:
An alternative is to keep
take_step
, and addset_state
that takes ownership of the vector, like soSo then in user code you have:
This allows you to mutate the state in-place so you don't have to have two versions of the state vector
The text was updated successfully, but these errors were encountered: