Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69525 - in sandbox/odeint/branches/karsten: . boost/numeric/odeint/integrate boost/numeric/odeint/integrate/detail libs/numeric/odeint/regression_test
From: karsten.ahnert_at_[hidden]
Date: 2011-03-03 13:13:10


Author: karsten
Date: 2011-03-03 13:13:08 EST (Thu, 03 Mar 2011)
New Revision: 69525
URL: http://svn.boost.org/trac/boost/changeset/69525

Log:
integrate function, sry will not compile atm
Text files modified:
   sandbox/odeint/branches/karsten/TODO | 1
   sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp | 4 ++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp | 2
   sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/integrate_functions.cpp | 54 ++++++++++++++++++++++++++++++++++-----
   4 files changed, 53 insertions(+), 8 deletions(-)

Modified: sandbox/odeint/branches/karsten/TODO
==============================================================================
--- sandbox/odeint/branches/karsten/TODO (original)
+++ sandbox/odeint/branches/karsten/TODO 2011-03-03 13:13:08 EST (Thu, 03 Mar 2011)
@@ -11,6 +11,7 @@
   * include test/thrust in jam system, use system from
 * implicit euler, include dfdt
 * same interface for implicit_euler and rosenbrock4
+* integrate functions
 DIFFICULT * finishing change of controlled_stepper to units
   * check if rosenbrock controller and controlled_stepper can both be used with the explicit steppers
   OK * move error_checker into controlled_stepper

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp 2011-03-03 13:13:08 EST (Thu, 03 Mar 2011)
@@ -17,24 +17,28 @@
 template< class Stepper , class System , class State , class Time , class Observer >
 size_t integrate_const( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , const Time &dt , Observer observer , stepper_tag )
 {
+ observer( start_state , start_time );
         return 0;
 }
 
 template< class Stepper , class System , class State , class Time , class Observer >
 size_t integrate_const( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , const Time &dt , Observer observer , error_stepper_tag )
 {
+ observer( start_state , start_time );
         return 0;
 }
 
 template< class Stepper , class System , class State , class Time , class Observer >
 size_t integrate_const( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , const Time &dt , Observer observer , controlled_stepper_tag )
 {
+ observer( start_state , start_time );
         return 0;
 }
 
 template< class Stepper , class System , class State , class Time , class Observer >
 size_t integrate_const( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , const Time &dt , Observer observer , dense_output_stepper_tag )
 {
+ observer( start_state , start_time );
         return 0;
 }
 

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp 2011-03-03 13:13:08 EST (Thu, 03 Mar 2011)
@@ -66,7 +66,7 @@
 }
 
 template< class Stepper , class System , class State , class Time , class Observer >
-size_t integrate_adaptive( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , Time &dt , Observer observer )
+size_t integrate_adaptive( Stepper stepper , System system , State &start_state , const Time &start_time , const Time &end_time , const Time &dt , Observer observer )
 {
         return detail::integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , observer , typename Stepper::stepper_category() );
 }

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/integrate_functions.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/integrate_functions.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/integrate_functions.cpp 2011-03-03 13:13:08 EST (Thu, 03 Mar 2011)
@@ -20,6 +20,16 @@
 
 #include <boost/numeric/odeint/integrate/integrate.hpp>
 
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/if.hpp>
+#include <boost/lambda/loops.hpp>
+#include <boost/lambda/switch.hpp>
+#include <boost/lambda/construct.hpp>
+#include <boost/lambda/casts.hpp>
+#include <boost/lambda/exceptions.hpp>
+#include <boost/lambda/numeric.hpp>
+#include <boost/lambda/algorithm.hpp>
 
 
 const double sigma = 10.0;
@@ -61,12 +71,43 @@
 typedef boost::numeric::ublas::vector< double > vector_type;
 typedef std::tr1::array< double , 3 > state_type;
 
+std::ostream& operator<<( std::ostream &out , const vector_type &x )
+{
+ if( x.size() != 0 ) out << x[0];
+ for( size_t i=1 ; i<x.size() ; ++i )
+ out << " " << x[i];
+ return out;
+}
+
+std::ostream& operator<<( std::ostream &out , const state_type &x )
+{
+ if( x.size() != 0 ) out << x[0];
+ for( size_t i=1 ; i<x.size() ; ++i )
+ out << " " << x[i];
+ return out;
+}
+
+
+
+
 using namespace std;
 using namespace boost::numeric::odeint;
 
+using boost::lambda::_1;
+using namespace boost::lambda;
+
+struct tmp_func
+{
+ template< class T1 , class T2 >
+ void operator()( const T1 &t1 , const T2 &t2 ) const
+ {
+ cout << t1 << " " << t2 << "\n";
+ }
+};
+
 int main( int argc , char **argv )
 {
- state_type x1;
+ state_type x1 = { { 10.0 , 10.0 , 10.0 } };
         vector_type x2( 3 );
 
 // integrate( implicit_euler< double >() , make_pair( lorenz() , lorenz_jacobi() ) , x2 , 0.0 , 10.0 , 0.1 , do_nothing_observer() );
@@ -81,13 +122,12 @@
 // integrate_n_steps( rosenbrock4_controller< rosenbrock4< double > >() , make_pair( lorenz() , lorenz_jacobi() ) , x2 , 0.0 , 1000 , 0.1 );
 // integrate_adaptive( rosenbrock4_controller< rosenbrock4< double > >() , make_pair( lorenz() , lorenz_jacobi() ) , x2 , 0.0 , 10.0 , 0.1 );
 
+ integrate( explicit_euler< state_type >() , lorenz() , x1 , 0.0 , 10.0 , 0.1 , tmp_func() );
+// integrate( explicit_euler< state_type >() , lorenz() , x1 , 0.0 , 10.0 , 0.1 , cout << _1 << "\n" );
+// integrate_n_steps( explicit_euler< state_type >() , lorenz() , x1 , 0.0 , 0.1 , 100 , cout << _1 << "\n" );
+// integrate_adaptive( explicit_euler< state_type >() , lorenz() , x1 , 0.0 , 10.0 , 0.1 , cout << _1 << "\n" );
+
 
-//#include <boost/numeric/odeint/stepper/explicit_euler.hpp>
-//#include <boost/numeric/odeint/stepper/explicit_error_dopri5.hpp>
-//#include <boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp>
-//#include <boost/numeric/odeint/stepper/controlled_error_stepper.hpp>
-//#include <boost/numeric/odeint/stepper/dense_output_explicit.hpp>
-//#include <boost/numeric/odeint/stepper/dense_output_controlled_explicit_fsal.hpp>
 
 
         return true;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk