headmyshoulder / odeint-v2

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

observable make_adaptive_range #167

Closed mihersch closed 7 years ago

mihersch commented 9 years ago

Hello,

I adapted odeint to enable the inclusion of an observer to the make_adaptive_range construct, so that it can be called as auto iter= boost::find_if(make_adaptive_range(stepper,system, x ,t_start, t_end, dt, obs), stop); where obs in an observer.

Is it worth sharing my code and if so, how should I do it?

Thanks!

headmyshoulder commented 9 years ago

Hi,

I think your use case could be easily implemented with a custom range adapter which decorates the adaptive range (or any other range):

auto r = make_adaptive_range(stepper,system, x ,t_start, t_end, dt );
// maybe find a better name for observable range?
auto r2 = make_observable_range( r , obs );  
auto iter = boost::find_if( r2 , stop );

I think such a range should be part of a range framework, like Boost.Range or range-v3. Maybe it is worth to ask if it should be included there.

mihersch commented 9 years ago

Hi,

Thanks for your answer (and for odeint!). I think I see what you mean but isn't the observer an odeint concept? Anyway, I don't think I can now dig into the range code and concepts.

Best