From 0a54ed3e09affe7fbfd39a6f5c707e28d75eb86e Mon Sep 17 00:00:00 2001 From: Karsten Ahnert Date: Mon, 9 Jul 2012 10:19:45 +0200 Subject: [PATCH] adding find_if example --- .../odeint/examples/const_step_iterator.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/numeric/odeint/examples/const_step_iterator.cpp b/libs/numeric/odeint/examples/const_step_iterator.cpp index c530d07c..5e03da62 100644 --- a/libs/numeric/odeint/examples/const_step_iterator.cpp +++ b/libs/numeric/odeint/examples/const_step_iterator.cpp @@ -193,6 +193,18 @@ int main( int argc , char **argv ) } + // boost::range::find with time iterator + { + runge_kutta4< state_type > stepper; + state_type x = {{ 10.0 , 10.0 , 10.0 }}; + auto iter = boost::find_if( make_const_step_time_range( stepper , lorenz() , x , 0.0 , 1.0 , 0.01 ) , + []( const std::pair< state_type & , double > &x ) { + return ( x.first[0] < 0.0 ); } ); + cout << iter->second << "\t" << iter->first[0] << "\t" << iter->first[1] << "\t" << iter->first[2] << "\n"; + + } + + @@ -230,5 +242,8 @@ int main( int argc , char **argv ) + + + return 0; }