headmyshoulder / odeint-v2

odeint - solving ordinary differential equations in c++ v2
http://headmyshoulder.github.com/odeint-v2/
Other
337 stars 102 forks source link

inetgrate_n_steps does not affect the internal state of a stepper #207

Closed vhartman closed 5 years ago

vhartman commented 7 years ago

Hey In the controlled Adams-Bashforth-Moulton stepper I am implementing, I am working with an internal state which keeps track of the previous steps and derivatives. Since this is a controlled stepper, using integrate_n_steps results in a call to integrate_adaptive. However, since the stepper is passed by value, the internal state of the stepper in integrate_n_steps does not change. I think a similar problem occurs in the rosenbrock4 stepper, and every step is treated like a first step.

I am not sure if this is intended.

Best regards, Valentin

mariomulansky commented 5 years ago

You can pass explicit references to the stepper (ie std::ref(stepper)). For steppers with internal state this is required.