Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58243 - in sandbox/odeint/branches: . karsten karsten/boost karsten/boost/numeric karsten/boost/numeric/odeint karsten/libs karsten/libs/numeric/odeint/examples
From: karsten.ahnert_at_[hidden]
Date: 2009-12-08 16:01:00


Author: karsten
Date: 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
New Revision: 58243
URL: http://svn.boost.org/trac/boost/changeset/58243

Log:
create new branch
Added:
   sandbox/odeint/branches/
   sandbox/odeint/branches/karsten/
   sandbox/odeint/branches/karsten/Jamroot (contents, props changed)
      - copied, changed from r58238, /sandbox/odeint/Jamroot
   sandbox/odeint/branches/karsten/boost/ (props changed)
      - copied from r58238, /sandbox/odeint/boost/
   sandbox/odeint/branches/karsten/boost-build.jam (props changed)
      - copied unchanged from r58238, /sandbox/odeint/boost-build.jam
   sandbox/odeint/branches/karsten/libs/ (props changed)
      - copied from r58238, /sandbox/odeint/libs/
Binary files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk5_ck.hpp
Text files modified:
   sandbox/odeint/branches/karsten/Jamroot | 3 -
   sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp | 10 ++++
   sandbox/odeint/branches/karsten/boost/numeric/odeint/controlled_stepper_standard.hpp | 26 ++++++-------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/integrator_adaptive_stepsize.hpp | 8 ++-
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp | 36 ++++++-------------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp | 25 +++++--------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp | 73 +++++++++++++++++++++------------------
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp | 47 ++++++++++++++-----------
   sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile | 14 +++---
   9 files changed, 120 insertions(+), 122 deletions(-)

Copied: sandbox/odeint/branches/karsten/Jamroot (from r58238, /sandbox/odeint/Jamroot)
==============================================================================
--- /sandbox/odeint/Jamroot (original)
+++ sandbox/odeint/branches/karsten/Jamroot 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -26,7 +26,4 @@
 local boost-root = [ modules.peek : BOOST_ROOT ] ;
 local explore-header-include = $(top)/../.. ;
 
-use-project /boost/regex : $(boost-root)/libs/regex/build ;
-
-
 ##################################################################

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -15,14 +15,22 @@
 #ifndef BOOST_NUMERIC_ODEINT_HPP
 #define BOOST_NUMERIC_ODEINT_HPP
 
+#include <boost/config.hpp>
+
+#include <boost/numeric/odeint/container_traits.hpp>
+#include <boost/numeric/odeint/container_traits_tr1_array.hpp>
+
 #include <boost/numeric/odeint/stepper_euler.hpp>
+#include <boost/numeric/odeint/stepper_half_step.hpp>
 #include <boost/numeric/odeint/stepper_rk4.hpp>
 #include <boost/numeric/odeint/stepper_rk4_classical.hpp>
 #include <boost/numeric/odeint/stepper_rk5_ck.hpp>
+
+/*
 #include <boost/numeric/odeint/stepper_rk_generic.hpp>
-#include <boost/numeric/odeint/stepper_half_step.hpp>
 #include <boost/numeric/odeint/stepper_midpoint.hpp>
 #include <boost/numeric/odeint/stepper_rk78_fehlberg.hpp>
+*/
 
 #include <boost/numeric/odeint/controlled_stepper_standard.hpp>
 #include <boost/numeric/odeint/controlled_stepper_bs.hpp>

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/controlled_stepper_standard.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/controlled_stepper_standard.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/controlled_stepper_standard.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -55,27 +55,27 @@
        the increase factor to 5.0.
     */
 
- template<
- class ErrorStepper,
- class ResizeType = resizer< typename ErrorStepper::container_type > >
+ template< class ErrorStepper >
     class controlled_stepper_standard
     {
 
     public:
 
         // forward types from ErrorStepper
- typedef typename ErrorStepper::container_type container_type;
- typedef typename ErrorStepper::resizer_type resizer_type;
- typedef typename ErrorStepper::time_type time_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef ErrorStepper stepper_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::container_type container_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::traits_type traits_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::iterator iterator;
+ typedef typename stepper_type::const_iterator const_iterator;
 
- typedef unsigned short order_type;
 
         // private members
     private:
 
- ErrorStepper &m_stepper;
+ stepper_type &m_stepper;
 
         time_type m_eps_abs;
         time_type m_eps_rel;
@@ -84,8 +84,6 @@
         container_type m_dxdt;
         container_type m_x_tmp;
         container_type m_x_err;
- resizer_type m_resizer;
-
 
 
         // private methods
@@ -145,8 +143,8 @@
                 time_type &t,
                 time_type &dt )
         {
- m_resizer.adjust_size( x , m_x_err );
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_x_err );
+ traits_type::adjust_size( x , m_dxdt );
 
             m_x_tmp = x;
             system( x , m_dxdt , t );

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrator_adaptive_stepsize.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrator_adaptive_stepsize.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -117,7 +117,8 @@
         if( times.empty() ) return 0;
         else
         {
- state_copy_observer<InsertIterator, TimeSequence> observer(times, state_inserter);
+ state_copy_observer<InsertIterator, TimeSequence>
+ observer(times, state_inserter);
             return integrate_adaptive(stepper, system, state,
                                       times.front() , times.back(), dt , observer);
         }
@@ -149,10 +150,11 @@
             T a_dxdt = 1.0
                      )
     {
+ typedef stepper_euler< ContainerType , T > stepper_type;
         // we use cash karp stepper as base stepper
- stepper_rk5_ck< ContainerType > stepper_cash_karp;
+ stepper_type stepper_cash_karp;
         // we use the standard controller for this adaptive integrator
- controlled_stepper_standard< ContainerType, T>
+ controlled_stepper_standard< stepper_type >
             controlled_stepper(stepper_cash_karp, eps_abs, eps_rel, a_x, a_dxdt );
         // initialized with values from above
         

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -18,12 +18,8 @@
 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP
 #define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP
 
-#include <boost/concept_check.hpp>
-
 #include <boost/numeric/odeint/detail/iterator_algebra.hpp>
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
-
+#include <boost/numeric/odeint/container_traits.hpp>
 
 
 namespace boost {
@@ -33,29 +29,20 @@
     template<
         class Container ,
         class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
     class stepper_euler
     {
         // provide basic typedefs
     public:
 
+ typedef const unsigned short order_type;
         typedef Container container_type;
- typedef Resizer resizer_type;
         typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
-
-
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator constiterator;
 
 
 
@@ -63,8 +50,6 @@
     private:
 
         container_type m_dxdt;
- resizer_type m_resizer;
-
 
 
 
@@ -83,7 +68,10 @@
                         time_type dt )
         {
             //x = x + dt*dxdt
- detail::it_algebra::increment( x.begin() , x.end() , dxdt.begin() , dt );
+ detail::it_algebra::increment( traits_type::begin(x) ,
+ traits_type::end(x) ,
+ traits_type::begin(dxdt) ,
+ dt );
         }
 
         template< class DynamicalSystem >
@@ -92,7 +80,7 @@
                         time_type t ,
                         time_type dt )
         {
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
             system( x , m_dxdt , t );
             do_step( system , x , m_dxdt , t , dt );
         }

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/stepper_half_step.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -29,24 +29,20 @@
 namespace odeint {
 
 
- template<
- class Stepper
- >
+ template< class Stepper >
     class stepper_half_step
     {
         // provide basic typedefs
     public:
 
         typedef Stepper stepper_type;
- typedef typename Stepper::container_type container_type;
- typedef typename Stepper::resizer_type resizer_type;
- typedef typename Stepper::time_type time_type;
- typedef typename Stepper::order_type order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
-
+ typedef typename stepper_type::container_type container_type;
+ typedef typename stepper_type::traits_type traits_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::iterator iterator;
+ typedef typename stepper_type::const_iterator const_iterator;
 
 
 
@@ -56,7 +52,6 @@
 
         container_type m_dxdt;
         container_type m_xtemp;
- resizer_type m_resizer;
         stepper_type m_stepper;
         
 
@@ -99,7 +94,7 @@
                         time_type dt ,
                         container_type &xerr )
         {
- m_resizer.adjust_size( x , xerr );
+ traits_type::adjust_size( x , xerr );
 
             m_xtemp = x;
             time_type dt2 = static_cast<time_type>(0.5) * dt;
@@ -123,7 +118,7 @@
                         time_type dt ,
                         container_type &xerr )
         {
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
             system( x , m_dxdt , t );
             do_step( system , x , m_dxdt , t , dt , xerr );
         }

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -20,7 +20,7 @@
 #include <boost/concept_check.hpp>
 
 #include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
 
 namespace boost {
 namespace numeric {
@@ -29,7 +29,7 @@
     template<
         class Container ,
         class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
     class stepper_rk4
     {
@@ -37,12 +37,13 @@
         // provide basic typedefs
     public:
 
+ typedef const unsigned short order_type;
         typedef Container container_type;
- typedef Resizer resizer_type;
         typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator constiterator;
 
 
 
@@ -65,7 +66,6 @@
         container_type m_dxm;
         container_type m_dxh;
         container_type m_xt;
- resizer_type m_resizer;
 
 
         // private member functions
@@ -75,71 +75,76 @@
         // public interface
     public:
 
- stepper_rk4( void )
- {
- }
 
         order_type order() const { return 4; }
 
+
+
         template< class DynamicalSystem >
         void do_step( DynamicalSystem &system ,
- container_type &x ,
- container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ container_type &dxdt ,
+ time_type t ,
+ time_type dt )
         {
             using namespace detail::it_algebra;
 
             const time_type val1 = static_cast<time_type>( 1.0 );
 
- m_resizer.adjust_size( x , m_dxt );
- m_resizer.adjust_size( x , m_dxm );
- m_resizer.adjust_size( x , m_xt );
- m_resizer.adjust_size( x , m_dxh );
+ traits_type::adjust_size( x , m_dxt );
+ traits_type::adjust_size( x , m_dxm );
+ traits_type::adjust_size( x , m_xt );
+ traits_type::adjust_size( x , m_dxh );
 
             time_type dh = static_cast<time_type>( 0.5 ) * dt;
             time_type th = t + dh;
 
             // dt * dxdt = k1
             // m_xt = x + dh*dxdt
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dh, dxdt.begin() );
+ scale_sum( traits_type::begin(m_xt),
+ traits_type::end(m_xt),
+ val1, traits_type::begin(x),
+ dh, traits_type::begin(dxdt) );
 
             // dt * m_dxt = k2
             system( m_xt , m_dxt , th );
             //m_xt = x + dh*m_dxt
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dh, m_dxt.begin() );
+ scale_sum( traits_type::begin(m_xt) ,
+ traits_type::end(m_xt) ,
+ val1, traits_type::begin(x) ,
+ dh, traits_type::begin(m_dxt) );
 
             // dt * m_dxm = k3
             system( m_xt , m_dxm , th );
             //m_xt = x + dt*m_dxm
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dt, m_dxm.begin() );
+ scale_sum( traits_type::begin(m_xt), traits_type::end(m_xt),
+ val1, traits_type::begin(x) ,
+ dt, traits_type::begin(m_dxm) );
 
             // dt * m_dxh = k4
             system( m_xt , m_dxh , t + dt );
             //x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
- scale_sum( x.begin(), x.end(),
- val1, x.begin(),
- dt / static_cast<time_type>( 6.0 ), dxdt.begin(),
- dt / static_cast<time_type>( 3.0 ), m_dxt.begin(),
- dt / static_cast<time_type>( 3.0 ), m_dxm.begin(),
- dt / static_cast<time_type>( 6.0 ), m_dxh.begin() );
+ time_type dt6 = dt / static_cast<time_type>( 6.0 );
+ time_type dt3 = dt / static_cast<time_type>( 3.0 );
+ scale_sum( traits_type::begin(x) , traits_type::end(x),
+ val1, traits_type::begin(x),
+ dt6 , traits_type::begin(dxdt),
+ dt3 , traits_type::begin(m_dxt),
+ dt3 , traits_type::begin(m_dxm),
+ dt6 , traits_type::begin(m_dxh) );
         }
 
 
 
+
+
         template< class DynamicalSystem >
         void do_step( DynamicalSystem &system ,
                         container_type &x ,
                         time_type t ,
                         time_type dt )
         {
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
             system( x , m_dxdt , t );
             do_step( system , x , m_dxdt , t , dt );
         }

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp
==============================================================================
--- /sandbox/odeint/boost/numeric/odeint/stepper_rk4_classical.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -20,7 +20,7 @@
 #include <boost/concept_check.hpp>
 
 #include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
 
 namespace boost {
 namespace numeric {
@@ -29,7 +29,7 @@
     template<
         class Container ,
         class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
     class stepper_rk4_classical
     {
@@ -37,12 +37,13 @@
         // provide basic typedefs
     public:
 
+ typedef const unsigned short order_type;
         typedef Container container_type;
- typedef Resizer resizer_type;
         typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator constiterator;
 
 
 
@@ -65,7 +66,6 @@
         container_type m_dxm;
         container_type m_dxh;
         container_type m_xt;
- resizer_type m_resizer;
 
         
 
@@ -78,38 +78,43 @@
 
         template< class DynamicalSystem >
         void do_step( DynamicalSystem &system ,
- container_type &x ,
- container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ container_type &dxdt ,
+ time_type t ,
+ time_type dt )
         {
             using namespace detail::it_algebra;
 
             const time_type val2 = time_type( 2.0 );
 
- m_resizer.adjust_size( x , m_dxt );
- m_resizer.adjust_size( x , m_dxm );
- m_resizer.adjust_size( x , m_xt );
+ traits_type::adjust_size( x , m_dxt );
+ traits_type::adjust_size( x , m_dxm );
+ traits_type::adjust_size( x , m_xt );
 
             time_type dh = time_type( 0.5 ) * dt;
             time_type th = t + dh;
 
             //m_xt = x + dh*dxdt
- assign_sum( m_xt.begin() , m_xt.end() , x.begin() , dxdt.begin() , dh );
+ assign_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(dxdt) , dh );
 
             system( m_xt , m_dxt , th );
             //m_xt = x + dh*m_dxdt
- assign_sum( m_xt.begin() , m_xt.end() , x.begin() , m_dxt.begin() , dh );
+ assign_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(m_dxt) , dh );
 
             system( m_xt , m_dxm , th );
             //m_xt = x + dt*m_dxm ; m_dxm += m_dxt
- assign_sum_increment( m_xt.begin() , m_xt.end() , x.begin() ,
- m_dxm.begin() , m_dxt.begin() , dt );
+ assign_sum_increment( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(m_dxm) ,
+ traits_type::begin(m_dxt) , dt );
 
             system( m_xt , m_dxt , t + dt );
             //x = dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
- increment_sum_sum( x.begin() , x.end() , dxdt.begin() ,
- m_dxt.begin() , m_dxm.begin() ,
+ increment_sum_sum( traits_type::begin(x) , traits_type::end(x) ,
+ traits_type::begin(dxdt) ,
+ traits_type::begin(m_dxt) ,
+ traits_type::begin(m_dxm) ,
                                dt / time_type( 6.0 ) , val2 );
         }
 
@@ -121,7 +126,7 @@
                         time_type t ,
                         time_type dt )
         {
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
             system( x , m_dxdt , t );
             do_step( system , x , m_dxdt , t , dt );
         }

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk5_ck.hpp
==============================================================================
Binary files. No diff available.

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile
==============================================================================
--- /sandbox/odeint/libs/numeric/odeint/examples/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile 2009-12-08 16:00:59 EST (Tue, 08 Dec 2009)
@@ -13,10 +13,10 @@
     ;
 
 exe harmonic_oscillator : harmonic_oscillator.cpp ;
-exe lorenz_cmp_rk4_rk_generic : lorenz_cmp_rk4_rk_generic.cpp ;
-exe lorenz_controlled : lorenz_controlled.cpp ;
-exe lorenz_integrate_constant_step : lorenz_integrate_constant_step.cpp ;
-exe lorenz_integrator : lorenz_integrator.cpp ;
-exe lorenz_stepper : lorenz_stepper.cpp ;
-exe pendulum_vibrating_pivot : pendulum_vibrating_pivot.cpp ;
-exe dnls_stepper_compare : dnls_stepper_compare.cpp ;
+# exe lorenz_cmp_rk4_rk_generic : lorenz_cmp_rk4_rk_generic.cpp ;
+# exe lorenz_controlled : lorenz_controlled.cpp ;
+# exe lorenz_integrate_constant_step : lorenz_integrate_constant_step.cpp ;
+# exe lorenz_integrator : lorenz_integrator.cpp ;
+# exe lorenz_stepper : lorenz_stepper.cpp ;
+# exe pendulum_vibrating_pivot : pendulum_vibrating_pivot.cpp ;
+# exe dnls_stepper_compare : dnls_stepper_compare.cpp ;


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