|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68299 - in sandbox/odeint/branches/karsten: . boost/numeric/odeint/stepper boost/numeric/odeint/stepper/base boost/numeric/odeint/stepper/detail libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-01-19 12:13:53
Author: karsten
Date: 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
New Revision: 68299
URL: http://svn.boost.org/trac/boost/changeset/68299
Log:
* starting conversion of stepper in order to work with units and ranges
Text files modified:
sandbox/odeint/branches/karsten/TODO | 7 +
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp | 29 +++--
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp | 44 ++++----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp | 51 +++++----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp | 29 +++--
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp | 48 +++++----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/macros.hpp | 18 ++-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp | 7 +
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp | 196 ++++++++++++++++++++-------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp | 189 ++++++++++++++++++++------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp | 16 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp | 80 ++++++++-------
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 16 +-
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp | 14 +-
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp | 26 ++--
15 files changed, 411 insertions(+), 359 deletions(-)
Modified: sandbox/odeint/branches/karsten/TODO
==============================================================================
--- sandbox/odeint/branches/karsten/TODO (original)
+++ sandbox/odeint/branches/karsten/TODO 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -4,8 +4,11 @@
OK * operations that fit units
* operations that fit result_of
* include test/thrust in jam system, use system from
-* change stepper to stepper_units
-* change error_stepper to rrror_stepper_units
+OK * change stepper to stepper_units
+OK * change error_stepper to error_stepper_units
+* finishing change of controlled_stepper to units
+* change error_checker to units
+* change dense_output to units
* include fusion_algebra in tests
* split check_concepts into check_stepper_concept, check_error_stepper_concept, check_controlled_stepper_concept
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -34,6 +34,8 @@
unsigned short StepperOrder ,
unsigned short ErrorOrder ,
class State ,
+ class Value ,
+ class Deriv ,
class Time ,
class Algebra ,
class Operations ,
@@ -43,8 +45,9 @@
{
public:
-
typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
typedef Time time_type;
typedef Algebra algebra_type;
typedef Operations operations_type;
@@ -82,8 +85,8 @@
// do_step( system , x , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class Err >
+ void do_step( System system , StateIn &x , const time_type &t , const time_type &dt , Err &xerr )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
@@ -92,15 +95,15 @@
}
// do_step( system , x , dxdt , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class Err >
+ void do_step( System system , StateIn &x , const DerivIn &dxdt , const time_type &t , const time_type &dt , Err &xerr )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
// do_step( system , in , t , out , dt , xerr )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
@@ -109,16 +112,16 @@
}
// do_step( system , in , dxdt , t , out , dt , xerr )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
-
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
m_size_adjuster.adjust_size( x );
}
@@ -138,8 +141,8 @@
}
- size_adjuster< state_type , 1 > m_size_adjuster;
- state_type m_dxdt;
+ size_adjuster< deriv_type , 1 > m_size_adjuster;
+ deriv_type m_dxdt;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -35,6 +35,8 @@
unsigned short StepperOrder ,
unsigned short ErrorOrder ,
class State ,
+ class Value ,
+ class Deriv ,
class Time ,
class Algebra ,
class Operations ,
@@ -44,8 +46,9 @@
{
public:
-
typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
typedef Time time_type;
typedef Algebra algebra_type;
typedef Operations operations_type;
@@ -93,8 +96,8 @@
// do_step( sys , x , t , dt )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt )
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
@@ -103,15 +106,15 @@
}
// do_step( sys , x , dxdt , t , dt )
- template< class System >
- void do_step( System system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt )
+ template< class System , class StateInOut , class DerivIn >
+ void do_step( System system , StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
// do_step( sys , in , t , out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
@@ -120,8 +123,8 @@
}
// do_step( sys , in , dxdt , t , out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
@@ -132,8 +135,8 @@
// do_step( sys , x , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt , Err &xerr )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
@@ -142,15 +145,15 @@
}
// do_step( sys , x , dxdt , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateInOut , class DerivIn , class Err >
+ void do_step( System system , StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt , Err &xerr )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
// do_step( sys , in , t , out , dt , xerr )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
@@ -159,8 +162,8 @@
}
// do_step( sys , in , dxdt , t , out , dt , xerr )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
@@ -168,7 +171,8 @@
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
m_size_adjuster.adjust_size( x );
}
@@ -187,8 +191,8 @@
}
- size_adjuster< state_type , 1 > m_size_adjuster;
- state_type m_dxdt;
+ size_adjuster< deriv_type , 1 > m_size_adjuster;
+ deriv_type m_dxdt;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -34,8 +34,10 @@
unsigned short StepperOrder ,
unsigned short ErrorOrder ,
class State ,
+ class Value ,
+ class Deriv ,
class Time ,
- class Algebra ,
+ class Algebra ,
class Operations ,
class AdjustSizePolicy
>
@@ -43,8 +45,9 @@
{
public:
-
typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
typedef Time time_type;
typedef Algebra algebra_type;
typedef Operations operations_type;
@@ -93,8 +96,8 @@
// do_step( sys , x , t , dt )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt )
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt )
{
if( m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() ) || m_first_call )
{
@@ -106,16 +109,16 @@
}
// do_step( sys , x , dxdt , t , dt )
- template< class System >
- void do_step( System system , state_type &x , state_type &dxdt , const time_type t , const time_type dt )
+ template< class System , class StateInOut , class DerivInOut >
+ void do_step( System system , StateInOut &x , DerivInOut &dxdt , const time_type &t , const time_type &dt )
{
m_first_call = true;
this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt );
}
// do_step( sys , in , t , out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
{
if( m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() ) || m_first_call )
{
@@ -127,9 +130,9 @@
}
// do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt_in , const time_type t ,
- state_type &out , state_type &dxdt_out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , const time_type &t ,
+ StateOut &out , DerivOut &dxdt_out , const time_type &dt )
{
m_first_call = true;
this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
@@ -141,8 +144,8 @@
// do_step( sys , x , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateInOut , class Err >
+ void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt , Err &xerr )
{
if( m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() ) || m_first_call )
{
@@ -154,16 +157,16 @@
}
// do_step( sys , x , dxdt , t , dt , xerr )
- template< class System >
- void do_step( System system , state_type &x , state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
+ template< class System , class StateInOut , class DerivInOut , class Err >
+ void do_step( System system , StateInOut &x , DerivInOut &dxdt , const time_type &t , const time_type &dt , Err &xerr )
{
m_first_call = true;
this->stepper().do_step_impl( system , x , dxdt , t , x , dxdt , dt , xerr );
}
// do_step( sys , in , t , out , dt , xerr )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class StateOut , class Err >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
if( m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() ) || m_first_call )
{
@@ -175,9 +178,9 @@
}
// do_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt_in , const time_type t ,
- state_type &out , state_type &dxdt_out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt_in , const time_type &t ,
+ StateOut &out , DerivOut &dxdt_out , const time_type &dt , Err &xerr )
{
m_first_call = true;
this->stepper().do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt , xerr );
@@ -187,8 +190,8 @@
-
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
if( m_size_adjuster.adjust_size( x ) )
m_first_call = true;
@@ -208,8 +211,8 @@
}
- size_adjuster< state_type , 1 > m_size_adjuster;
- state_type m_dxdt;
+ size_adjuster< deriv_type , 1 > m_size_adjuster;
+ deriv_type m_dxdt;
bool m_first_call;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -32,6 +32,8 @@
class Stepper ,
unsigned short Order ,
class State ,
+ class Value ,
+ class Deriv ,
class Time ,
class Algebra ,
class Operations ,
@@ -43,13 +45,15 @@
typedef State state_type;
+ typedef Value value_type;
+ typedef Deriv deriv_type;
typedef Time time_type;
typedef Algebra algebra_type;
typedef Operations operations_type;
typedef AdjustSizePolicy adjust_size_policy;
typedef Stepper stepper_type;
- typedef explicit_stepper_base< Stepper , Order , State , Time , Algebra , Operations , AdjustSizePolicy > internal_stepper_base_type;
+ typedef explicit_stepper_base< Stepper , Order , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > internal_stepper_base_type;
typedef unsigned short order_type;
static const order_type order_value = Order;
@@ -76,8 +80,8 @@
// do_step( sys , x , t , dt )
- template< class System >
- void do_step( System system , state_type &x , const time_type t , const time_type dt )
+ template< class System , class StateInOut >
+ void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
@@ -86,15 +90,15 @@
}
// do_step( sys , x , dxdt , t , dt )
- template< class System >
- void do_step( System system , state_type &x , const state_type dxdt , const time_type t , const time_type dt )
+ template< class System , class StateInOut , class DerivIn >
+ void do_step( System system , StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
// do_step( sys , in , t , out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class StateOut >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
@@ -103,15 +107,16 @@
}
// do_step( sys , in , dxdt , t , out , dt )
- template< class System >
- void do_step( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
m_size_adjuster.adjust_size( x );
}
@@ -130,8 +135,8 @@
}
- size_adjuster< state_type , 1 > m_size_adjuster;
- state_type m_dxdt;
+ size_adjuster< deriv_type , 1 > m_size_adjuster;
+ deriv_type m_dxdt;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -40,9 +40,9 @@
template<
class ErrorStepper ,
class ErrorChecker = error_checker_standard< typename ErrorStepper::state_type ,
- typename ErrorStepper::time_type ,
- typename ErrorStepper::algebra_type ,
- typename ErrorStepper::operations_type > ,
+ typename ErrorStepper::time_type ,
+ typename ErrorStepper::algebra_type ,
+ typename ErrorStepper::operations_type > ,
class AdjustSizePolicy = typename ErrorStepper::adjust_size_policy ,
class ErrorStepperCategory = typename ErrorStepper::stepper_category
>
@@ -65,6 +65,8 @@
typedef ErrorStepper stepper_type;
typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
typedef typename stepper_type::time_type time_type;
typedef typename stepper_type::order_type order_type;
typedef AdjustSizePolicy adjust_size_policy;
@@ -99,8 +101,8 @@
// try_step( sys , x , t , dt )
- template< class System >
- controlled_step_result try_step( System system , state_type &x , time_type &t , time_type &dt )
+ template< class System , class StateInOut >
+ controlled_step_result try_step( System system , StateInOut &x , time_type &t , time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_dxdt_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
@@ -109,8 +111,8 @@
}
// try_step( sys , x , dxdt , t , dt )
- template< class System >
- controlled_step_result try_step( System system , state_type &x , const state_type &dxdt , time_type &t , time_type &dt )
+ template< class System , class StateInOut , class DerivIn >
+ controlled_step_result try_step( System system , StateInOut &x , const DerivIn &dxdt , time_type &t , time_type &dt )
{
m_xnew_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
controlled_step_result res = try_step( system , x , dxdt , t , m_xnew , dt );
@@ -122,8 +124,8 @@
}
// try_step( sys , in , t , out , dt )
- template< class System >
- controlled_step_result try_step( System system , const state_type &in , time_type &t , state_type &out , time_type &dt )
+ template< class System , class StateIn , class StateOut >
+ controlled_step_result try_step( System system , const StateIn &in , time_type &t , StateOut &out , time_type &dt )
{
typename boost::unwrap_reference< System >::type &sys = system;
m_dxdt_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
@@ -133,8 +135,8 @@
// try_step( sys , in , dxdt , t , out , dt )
- template< class System >
- controlled_step_result try_step( System system , const state_type &in , const state_type &dxdt , time_type &t , state_type &out , time_type &dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ controlled_step_result try_step( System system , const StateIn &in , const DerivIn &dxdt , time_type &t , StateOut &out , time_type &dt )
{
using std::max;
using std::min;
@@ -170,15 +172,15 @@
}
}
- time_type last_error( void ) const
+ value_type last_error( void ) const
{
return m_max_rel_error;
}
-
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
m_dxdt_size_adjuster.adjust_size( x );
m_xerr_size_adjuster.adjust_size( x );
@@ -205,14 +207,14 @@
stepper_type &m_stepper;
error_checker_type m_error_checker;
- size_adjuster< state_type , 1 > m_dxdt_size_adjuster;
+ size_adjuster< deriv_type , 1 > m_dxdt_size_adjuster;
size_adjuster< state_type , 1 > m_xerr_size_adjuster;
size_adjuster< state_type , 1 > m_xnew_size_adjuster;
- state_type m_dxdt;
+ deriv_type m_dxdt;
state_type m_xerr;
state_type m_xnew;
- time_type m_max_rel_error;
+ value_type m_max_rel_error;
};
@@ -240,6 +242,8 @@
typedef ErrorStepper stepper_type;
typedef typename stepper_type::state_type state_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::deriv_type deriv_type;
typedef typename stepper_type::time_type time_type;
typedef typename stepper_type::order_type order_type;
typedef AdjustSizePolicy adjust_size_policy;
@@ -360,8 +364,8 @@
-
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
bool changed = false;
changed |= m_dxdt_size_adjuster.adjust_size( x );
@@ -390,14 +394,14 @@
stepper_type &m_stepper;
error_checker_type m_error_checker;
- size_adjuster< state_type , 1 > m_dxdt_size_adjuster;
+ size_adjuster< deriv_type , 1 > m_dxdt_size_adjuster;
size_adjuster< state_type , 1 > m_xerr_size_adjuster;
size_adjuster< state_type , 2 > m_new_size_adjuster;
- state_type m_dxdt;
+ deriv_type m_dxdt;
state_type m_xerr;
state_type m_xnew;
- state_type m_dxdtnew;
+ deriv_type m_dxdtnew;
bool m_first_call;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/macros.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/macros.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/macros.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -16,9 +16,11 @@
#define BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( STEPPER , ORDER ) \
typedef explicit_stepper_base< \
-STEPPER< State , Time , Algebra , Operations , AdjustSizePolicy > , \
-ORDER , State , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
+STEPPER< State , Value , Deriv ,Time , Algebra , Operations , AdjustSizePolicy > , \
+ORDER , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
typedef typename stepper_base_type::state_type state_type; \
+typedef typename stepper_base_type::value_type value_type; \
+typedef typename stepper_base_type::deriv_type deriv_type; \
typedef typename stepper_base_type::time_type time_type; \
typedef typename stepper_base_type::algebra_type algebra_type; \
typedef typename stepper_base_type::operations_type operations_type; \
@@ -28,9 +30,11 @@
#define BOOST_ODEINT_EXPLICIT_ERROR_STEPPERS_TYPEDEFS( STEPPER , STEPPER_ORDER , ERROR_ORDER ) \
typedef explicit_error_stepper_base< \
-STEPPER< State , Time , Algebra , Operations , AdjustSizePolicy > , \
-STEPPER_ORDER , ERROR_ORDER , State , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
+STEPPER< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > , \
+STEPPER_ORDER , ERROR_ORDER , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
typedef typename stepper_base_type::state_type state_type; \
+typedef typename stepper_base_type::value_type value_type; \
+typedef typename stepper_base_type::deriv_type deriv_type; \
typedef typename stepper_base_type::time_type time_type; \
typedef typename stepper_base_type::algebra_type algebra_type; \
typedef typename stepper_base_type::operations_type operations_type; \
@@ -40,9 +44,11 @@
#define BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_TYPEDEFS( STEPPER , ORDER , STEPPER_ORDER , ERROR_ORDER ) \
typedef explicit_stepper_and_error_stepper_base< \
-STEPPER< State , Time , Algebra , Operations , AdjustSizePolicy > , \
-ORDER , STEPPER_ORDER , ERROR_ORDER , State , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
+STEPPER< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > , \
+ORDER , STEPPER_ORDER , ERROR_ORDER , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > stepper_base_type; \
typedef typename stepper_base_type::state_type state_type; \
+typedef typename stepper_base_type::value_type value_type; \
+typedef typename stepper_base_type::deriv_type deriv_type; \
typedef typename stepper_base_type::time_type time_type; \
typedef typename stepper_base_type::algebra_type algebra_type; \
typedef typename stepper_base_type::operations_type operations_type; \
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/error_checker.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -41,10 +41,13 @@
error_checker_standard( void ) : m_eps_abs( 1E-6 ) , m_eps_rel( 1E-6 ) , m_a_x( 1.0 ) , m_a_dxdt( 1.0 )
{}
- /* ToDo: implement constructor with epsilons */
+ /*
+ * ToDo: implement constructor with epsilons
+ */
time_type error( const state_type &x_old , const state_type &dxdt_old , state_type &x_err , const time_type &dt )
- { // this overwrites x_err !
+ {
+ // this overwrites x_err !
algebra_type::for_each3( x_old , dxdt_old , x_err ,
typename operations_type::template rel_error< time_type >( m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt*dt ) );
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -31,6 +31,8 @@
*/
template<
class State ,
+ class Value = double ,
+ class Deriv = State ,
class Time = double ,
class Algebra = standard_algebra ,
class Operations = standard_operations ,
@@ -38,8 +40,8 @@
>
class explicit_error_dopri5
: public explicit_stepper_and_error_stepper_fsal_base<
- explicit_error_dopri5< State , Time , Algebra , Operations , AdjustSizePolicy > ,
- 5 , 5 , 4 , State , Time , Algebra , Operations , AdjustSizePolicy >
+ explicit_error_dopri5< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
{
public :
@@ -52,128 +54,128 @@
typedef explicit_error_stepper_fsal_tag stepper_category;
explicit_error_dopri5( void )
- : m_size_adjuster() , m_x1() , m_x2() , m_x3() , m_x4() , m_x5() , m_x6()
+ : m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
{
- boost::numeric::odeint::construct( m_x1 );
- boost::numeric::odeint::construct( m_x2 );
- boost::numeric::odeint::construct( m_x3 );
- boost::numeric::odeint::construct( m_x4 );
- boost::numeric::odeint::construct( m_x5 );
- boost::numeric::odeint::construct( m_x6 );
- m_size_adjuster.register_state( 0 , m_x1 );
- m_size_adjuster.register_state( 1 , m_x2 );
- m_size_adjuster.register_state( 2 , m_x3 );
- m_size_adjuster.register_state( 3 , m_x4 );
- m_size_adjuster.register_state( 4 , m_x5 );
- m_size_adjuster.register_state( 5 , m_x6 );
+ boost::numeric::odeint::construct( m_x_tmp );
+ boost::numeric::odeint::construct( m_k2 );
+ boost::numeric::odeint::construct( m_k3 );
+ boost::numeric::odeint::construct( m_k4 );
+ boost::numeric::odeint::construct( m_k5 );
+ boost::numeric::odeint::construct( m_k6 );
+ m_state_adjuster.register_state( 0 , m_x_tmp );
+ m_deriv_adjuster.register_state( 0 , m_k2 );
+ m_deriv_adjuster.register_state( 1 , m_k3 );
+ m_deriv_adjuster.register_state( 2 , m_k4 );
+ m_deriv_adjuster.register_state( 3 , m_k5 );
+ m_deriv_adjuster.register_state( 4 , m_k6 );
}
~explicit_error_dopri5( void )
{
- boost::numeric::odeint::destruct( m_x1 );
- boost::numeric::odeint::destruct( m_x2 );
- boost::numeric::odeint::destruct( m_x3 );
- boost::numeric::odeint::destruct( m_x4 );
- boost::numeric::odeint::destruct( m_x5 );
- boost::numeric::odeint::destruct( m_x6 );
+ boost::numeric::odeint::destruct( m_x_tmp );
+ boost::numeric::odeint::destruct( m_k2 );
+ boost::numeric::odeint::destruct( m_k3 );
+ boost::numeric::odeint::destruct( m_k4 );
+ boost::numeric::odeint::destruct( m_k5 );
+ boost::numeric::odeint::destruct( m_k6 );
}
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt_in , const time_type t ,
- state_type &out , state_type &dxdt_out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , const time_type &t ,
+ StateOut &out , DerivOut &dxdt_out , const time_type &dt )
{
const time_type a2 = static_cast<time_type> ( 0.2 );
const time_type a3 = static_cast<time_type> ( 0.3 );
- const time_type a4 = static_cast<time_type> ( 0.8 );
- const time_type a5 = static_cast<time_type> ( 8.0 )/static_cast<time_type> ( 9.0 );
+ const value_type a4 = static_cast<value_type> ( 0.8 );
+ const value_type a5 = static_cast<value_type> ( 8.0 )/static_cast<value_type> ( 9.0 );
- const time_type b21 = static_cast<time_type> ( 0.2 );
+ const value_type b21 = static_cast<value_type> ( 0.2 );
- const time_type b31 = static_cast<time_type> ( 3.0 ) / static_cast<time_type>( 40.0 );
- const time_type b32 = static_cast<time_type> ( 9.0 ) / static_cast<time_type>( 40.0 );
+ const value_type b31 = static_cast<value_type> ( 3.0 ) / static_cast<value_type>( 40.0 );
+ const value_type b32 = static_cast<value_type> ( 9.0 ) / static_cast<value_type>( 40.0 );
- const time_type b41 = static_cast<time_type> ( 44.0 ) / static_cast<time_type> ( 45.0 );
- const time_type b42 = static_cast<time_type> ( -56.0 ) / static_cast<time_type> ( 15.0 );
- const time_type b43 = static_cast<time_type> ( 32.0 ) / static_cast<time_type> ( 9.0 );
-
- const time_type b51 = static_cast<time_type> ( 19372.0 ) / static_cast<time_type>( 6561.0 );
- const time_type b52 = static_cast<time_type> ( -25360.0 ) / static_cast<time_type> ( 2187.0 );
- const time_type b53 = static_cast<time_type> ( 64448.0 ) / static_cast<time_type>( 6561.0 );
- const time_type b54 = static_cast<time_type> ( -212.0 ) / static_cast<time_type>( 729.0 );
-
- const time_type b61 = static_cast<time_type> ( 9017.0 ) / static_cast<time_type>( 3168.0 );
- const time_type b62 = static_cast<time_type> ( -355.0 ) / static_cast<time_type>( 33.0 );
- const time_type b63 = static_cast<time_type> ( 46732.0 ) / static_cast<time_type>( 5247.0 );
- const time_type b64 = static_cast<time_type> ( 49.0 ) / static_cast<time_type>( 176.0 );
- const time_type b65 = static_cast<time_type> ( -5103.0 ) / static_cast<time_type>( 18656.0 );
-
- const time_type c1 = static_cast<time_type> ( 35.0 ) / static_cast<time_type>( 384.0 );
- const time_type c3 = static_cast<time_type> ( 500.0 ) / static_cast<time_type>( 1113.0 );
- const time_type c4 = static_cast<time_type> ( 125.0 ) / static_cast<time_type>( 192.0 );
- const time_type c5 = static_cast<time_type> ( -2187.0 ) / static_cast<time_type>( 6784.0 );
- const time_type c6 = static_cast<time_type> ( 11.0 ) / static_cast<time_type>( 84.0 );
+ const value_type b41 = static_cast<value_type> ( 44.0 ) / static_cast<value_type> ( 45.0 );
+ const value_type b42 = static_cast<value_type> ( -56.0 ) / static_cast<value_type> ( 15.0 );
+ const value_type b43 = static_cast<value_type> ( 32.0 ) / static_cast<value_type> ( 9.0 );
+
+ const value_type b51 = static_cast<value_type> ( 19372.0 ) / static_cast<value_type>( 6561.0 );
+ const value_type b52 = static_cast<value_type> ( -25360.0 ) / static_cast<value_type> ( 2187.0 );
+ const value_type b53 = static_cast<value_type> ( 64448.0 ) / static_cast<value_type>( 6561.0 );
+ const value_type b54 = static_cast<value_type> ( -212.0 ) / static_cast<value_type>( 729.0 );
+
+ const value_type b61 = static_cast<value_type> ( 9017.0 ) / static_cast<value_type>( 3168.0 );
+ const value_type b62 = static_cast<value_type> ( -355.0 ) / static_cast<value_type>( 33.0 );
+ const value_type b63 = static_cast<value_type> ( 46732.0 ) / static_cast<value_type>( 5247.0 );
+ const value_type b64 = static_cast<value_type> ( 49.0 ) / static_cast<value_type>( 176.0 );
+ const value_type b65 = static_cast<value_type> ( -5103.0 ) / static_cast<value_type>( 18656.0 );
+
+ const value_type c1 = static_cast<value_type> ( 35.0 ) / static_cast<value_type>( 384.0 );
+ const value_type c3 = static_cast<value_type> ( 500.0 ) / static_cast<value_type>( 1113.0 );
+ const value_type c4 = static_cast<value_type> ( 125.0 ) / static_cast<value_type>( 192.0 );
+ const value_type c5 = static_cast<value_type> ( -2187.0 ) / static_cast<value_type>( 6784.0 );
+ const value_type c6 = static_cast<value_type> ( 11.0 ) / static_cast<value_type>( 84.0 );
- m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_state_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_deriv_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
typename boost::unwrap_reference< System >::type &sys = system;
- //m_x1 = x + dt*b21*dxdt
- algebra_type::for_each3( m_x1 , in , dxdt_in ,
- typename operations_type::template scale_sum2< time_type , time_type >( 1.0 , dt*b21 ) );
-
- sys( m_x1 , m_x2 , t + dt*a2 );
- // m_x1 = x + dt*b31*dxdt + dt*b32*m_x2
- algebra_type::for_each4( m_x1 , in , dxdt_in , m_x2 ,
- typename operations_type::template scale_sum3< time_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
-
- sys( m_x1 , m_x3 , t + dt*a3 );
- // m_x1 = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3)
- algebra_type::for_each5( m_x1 , in , dxdt_in , m_x2 , m_x3 ,
- typename operations_type::template scale_sum4< time_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
-
- sys( m_x1, m_x4 , t + dt*a4 );
- algebra_type::for_each6( m_x1 , in , dxdt_in , m_x2 , m_x3 , m_x4 ,
- typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
-
- sys( m_x1 , m_x5 , t + dt*a5 );
- algebra_type::for_each7( m_x1 , in , dxdt_in , m_x2 , m_x3 , m_x4 , m_x5 ,
- typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
-
- sys( m_x1 , m_x6 , t + dt );
- algebra_type::for_each7( out , in , dxdt_in , m_x3 , m_x4 , m_x5 , m_x6 ,
- typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 ));
+ //m_x_tmp = x + dt*b21*dxdt
+ algebra_type::for_each3( m_x_tmp , in , dxdt_in ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
+
+ sys( m_x_tmp , m_k2 , t + dt*a2 );
+ // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_k2
+ algebra_type::for_each4( m_x_tmp , in , dxdt_in , m_k2 ,
+ typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
+
+ sys( m_x_tmp , m_k3 , t + dt*a3 );
+ // m_x_tmp = x + dt * (b41*dxdt + b42*m_k2 + b43*m_k3)
+ algebra_type::for_each5( m_x_tmp , in , dxdt_in , m_k2 , m_k3 ,
+ typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
+
+ sys( m_x_tmp, m_k4 , t + dt*a4 );
+ algebra_type::for_each6( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
+
+ sys( m_x_tmp , m_k5 , t + dt*a5 );
+ algebra_type::for_each7( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 , m_k5 ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
+
+ sys( m_x_tmp , m_k6 , t + dt );
+ algebra_type::for_each7( out , in , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 ));
// the new derivative
sys( out , dxdt_out , t + dt );
}
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt_in , const time_type t ,
- state_type &out , state_type &dxdt_out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class StateOut , class DerivOut , class Err >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt_in , const time_type &t ,
+ StateOut &out , DerivOut &dxdt_out , const time_type &dt , Err &xerr )
{
-
- const time_type c1 = static_cast<time_type> ( 35.0 ) / static_cast<time_type>( 384.0 );
- const time_type c3 = static_cast<time_type> ( 500.0 ) / static_cast<time_type>( 1113.0 );
- const time_type c4 = static_cast<time_type> ( 125.0 ) / static_cast<time_type>( 192.0 );
- const time_type c5 = static_cast<time_type> ( -2187.0 ) / static_cast<time_type>( 6784.0 );
- const time_type c6 = static_cast<time_type> ( 11.0 ) / static_cast<time_type>( 84.0 );
-
- const time_type dc1 = c1 - static_cast<time_type> ( 5179.0 ) / static_cast<time_type>( 57600.0 );
- const time_type dc3 = c3 - static_cast<time_type> ( 7571.0 ) / static_cast<time_type>( 16695.0 );
- const time_type dc4 = c4 - static_cast<time_type> ( 393.0 ) / static_cast<time_type>( 640.0 );
- const time_type dc5 = c5 - static_cast<time_type> ( -92097.0 ) / static_cast<time_type>( 339200.0 );
- const time_type dc6 = c6 - static_cast<time_type> ( 187.0 ) / static_cast<time_type>( 2100.0 );
- const time_type dc7 = static_cast<time_type>( -0.025 );
+ const value_type c1 = static_cast<value_type> ( 35.0 ) / static_cast<value_type>( 384.0 );
+ const value_type c3 = static_cast<value_type> ( 500.0 ) / static_cast<value_type>( 1113.0 );
+ const value_type c4 = static_cast<value_type> ( 125.0 ) / static_cast<value_type>( 192.0 );
+ const value_type c5 = static_cast<value_type> ( -2187.0 ) / static_cast<value_type>( 6784.0 );
+ const value_type c6 = static_cast<value_type> ( 11.0 ) / static_cast<value_type>( 84.0 );
+
+ const value_type dc1 = c1 - static_cast<value_type> ( 5179.0 ) / static_cast<value_type>( 57600.0 );
+ const value_type dc3 = c3 - static_cast<value_type> ( 7571.0 ) / static_cast<value_type>( 16695.0 );
+ const value_type dc4 = c4 - static_cast<value_type> ( 393.0 ) / static_cast<value_type>( 640.0 );
+ const value_type dc5 = c5 - static_cast<value_type> ( -92097.0 ) / static_cast<value_type>( 339200.0 );
+ const value_type dc6 = c6 - static_cast<value_type> ( 187.0 ) / static_cast<value_type>( 2100.0 );
+ const value_type dc7 = static_cast<value_type>( -0.025 );
do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
//error estimate
- algebra_type::for_each7( xerr , dxdt_in , m_x3 , m_x4 , m_x5 , m_x6 , dxdt_out ,
+ algebra_type::for_each7( xerr , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 , dxdt_out ,
typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
}
@@ -182,15 +184,19 @@
void adjust_size( const state_type &x )
{
- m_size_adjuster.adjust_size( x );
+ m_state_adjuster.adjust_size( x );
+ m_deriv_adjuster.adjust_size( x );
stepper_base_type::adjust_size( x );
}
private:
- size_adjuster< state_type , 6 > m_size_adjuster;
- state_type m_x1, m_x2, m_x3, m_x4, m_x5, m_x6 ;
+ size_adjuster< state_type , 1 > m_state_adjuster;
+ size_adjuster< deriv_type , 5 > m_deriv_adjuster;
+
+ state_type m_x_tmp;
+ deriv_type m_k2 , m_k3 , m_k4 , m_k5 , m_k6 ;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -35,7 +35,9 @@
* ToDo: Check orders rk_ckc
*/
template<
- class State ,
+ class State ,
+ class Value = double ,
+ class Deriv = State ,
class Time = double ,
class Algebra = standard_algebra ,
class Operations = standard_operations ,
@@ -43,8 +45,8 @@
>
class explicit_error_rk54_ck
: public explicit_stepper_and_error_stepper_base<
- explicit_error_rk54_ck< State , Time , Algebra , Operations , AdjustSizePolicy > ,
- 5 , 5 , 4 , State , Time , Algebra , Operations , AdjustSizePolicy >
+ explicit_error_rk54_ck< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > ,
+ 5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
{
public :
@@ -53,131 +55,136 @@
typedef explicit_error_stepper_tag stepper_category;
- explicit_error_rk54_ck( void ) : m_size_adjuster() , m_x1() , m_x2() , m_x3() , m_x4() , m_x5() , m_x6()
+ explicit_error_rk54_ck( void ) : m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
{
- boost::numeric::odeint::construct( m_x1 );
- boost::numeric::odeint::construct( m_x2 );
- boost::numeric::odeint::construct( m_x3 );
- boost::numeric::odeint::construct( m_x4 );
- boost::numeric::odeint::construct( m_x5 );
- boost::numeric::odeint::construct( m_x6 );
- m_size_adjuster.register_state( 0 , m_x1 );
- m_size_adjuster.register_state( 1 , m_x2 );
- m_size_adjuster.register_state( 2 , m_x3 );
- m_size_adjuster.register_state( 3 , m_x4 );
- m_size_adjuster.register_state( 4 , m_x5 );
- m_size_adjuster.register_state( 5 , m_x6 );
+ boost::numeric::odeint::construct( m_x_tmp );
+ boost::numeric::odeint::construct( m_k2 );
+ boost::numeric::odeint::construct( m_k3 );
+ boost::numeric::odeint::construct( m_k4 );
+ boost::numeric::odeint::construct( m_k5 );
+ boost::numeric::odeint::construct( m_k6 );
+ m_state_adjuster.register_state( 0 , m_x_tmp );
+ m_deriv_adjuster.register_state( 0 , m_k2 );
+ m_deriv_adjuster.register_state( 1 , m_k3 );
+ m_deriv_adjuster.register_state( 2 , m_k4 );
+ m_deriv_adjuster.register_state( 3 , m_k5 );
+ m_deriv_adjuster.register_state( 4 , m_k6 );
}
~explicit_error_rk54_ck( void )
{
- boost::numeric::odeint::destruct( m_x1 );
- boost::numeric::odeint::destruct( m_x2 );
- boost::numeric::odeint::destruct( m_x3 );
- boost::numeric::odeint::destruct( m_x4 );
- boost::numeric::odeint::destruct( m_x5 );
- boost::numeric::odeint::destruct( m_x6 );
+ boost::numeric::odeint::destruct( m_x_tmp );
+ boost::numeric::odeint::destruct( m_k2 );
+ boost::numeric::odeint::destruct( m_k3 );
+ boost::numeric::odeint::destruct( m_k4 );
+ boost::numeric::odeint::destruct( m_k5 );
+ boost::numeric::odeint::destruct( m_k6 );
}
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
+ template< class System , class StateIn , class DerivIn , class StateOut , class Err >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt , Err &xerr )
{
- const time_type c1 = static_cast<time_type> ( 37.0 ) / static_cast<time_type>( 378.0 );
- const time_type c3 = static_cast<time_type> ( 250.0 ) / static_cast<time_type>( 621.0 );
- const time_type c4 = static_cast<time_type> ( 125.0 ) / static_cast<time_type>( 594.0 );
- const time_type c6 = static_cast<time_type> ( 512.0 ) / static_cast<time_type>( 1771.0 );
-
- const time_type dc1 = c1 - static_cast<time_type> ( 2825.0 ) / static_cast<time_type>( 27648 );
- const time_type dc3 = c3 - static_cast<time_type> ( 18575.0 ) / static_cast<time_type>( 48384.0 );
- const time_type dc4 = c4 - static_cast<time_type> ( 13525.0 ) / static_cast<time_type>( 55296.0 );
- const time_type dc5 = static_cast<time_type> ( -277.0 ) / static_cast<time_type>( 14336.0 );
- const time_type dc6 = c6 - static_cast<time_type> ( 0.25 );
+ const value_type c1 = static_cast<value_type> ( 37.0 ) / static_cast<value_type>( 378.0 );
+ const value_type c3 = static_cast<value_type> ( 250.0 ) / static_cast<value_type>( 621.0 );
+ const value_type c4 = static_cast<value_type> ( 125.0 ) / static_cast<value_type>( 594.0 );
+ const value_type c6 = static_cast<value_type> ( 512.0 ) / static_cast<value_type>( 1771.0 );
+
+ const value_type dc1 = c1 - static_cast<value_type> ( 2825.0 ) / static_cast<value_type>( 27648 );
+ const value_type dc3 = c3 - static_cast<value_type> ( 18575.0 ) / static_cast<value_type>( 48384.0 );
+ const value_type dc4 = c4 - static_cast<value_type> ( 13525.0 ) / static_cast<value_type>( 55296.0 );
+ const value_type dc5 = static_cast<value_type> ( -277.0 ) / static_cast<value_type>( 14336.0 );
+ const value_type dc6 = c6 - static_cast<value_type> ( 0.25 );
do_step_impl( system , in , dxdt , t , out , dt );
//error estimate
- algebra_type::for_each6( xerr , dxdt , m_x3 , m_x4 , m_x5 , m_x6 ,
+ algebra_type::for_each6( xerr , dxdt , m_k3 , m_k4 , m_k5 , m_k6 ,
typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 ));
}
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
- const time_type a2 = static_cast<time_type> ( 0.2 );
- const time_type a3 = static_cast<time_type> ( 0.3 );
- const time_type a4 = static_cast<time_type> ( 0.6 );
- const time_type a5 = static_cast<time_type> ( 1.0 );
- const time_type a6 = static_cast<time_type> ( 0.875 );
-
- const time_type b21 = static_cast<time_type> ( 0.2 );
- const time_type b31 = static_cast<time_type> ( 3.0 ) / static_cast<time_type>( 40.0 );
- const time_type b32 = static_cast<time_type> ( 9.0 ) / static_cast<time_type>( 40.0 );
- const time_type b41 = static_cast<time_type> ( 0.3 );
- const time_type b42 = static_cast<time_type> ( -0.9 );
- const time_type b43 = static_cast<time_type> ( 1.2 );
- const time_type b51 = static_cast<time_type> ( -11.0 ) / static_cast<time_type>( 54.0 );
- const time_type b52 = static_cast<time_type> ( 2.5 );
- const time_type b53 = static_cast<time_type> ( -70.0 ) / static_cast<time_type>( 27.0 );
- const time_type b54 = static_cast<time_type> ( 35.0 ) / static_cast<time_type>( 27.0 );
- const time_type b61 = static_cast<time_type> ( 1631.0 ) / static_cast<time_type>( 55296.0 );
- const time_type b62 = static_cast<time_type> ( 175.0 ) / static_cast<time_type>( 512.0 );
- const time_type b63 = static_cast<time_type> ( 575.0 ) / static_cast<time_type>( 13824.0 );
- const time_type b64 = static_cast<time_type> ( 44275.0 ) / static_cast<time_type>( 110592.0 );
- const time_type b65 = static_cast<time_type> ( 253.0 ) / static_cast<time_type>( 4096.0 );
-
- const time_type c1 = static_cast<time_type> ( 37.0 ) / static_cast<time_type>( 378.0 );
- const time_type c3 = static_cast<time_type> ( 250.0 ) / static_cast<time_type>( 621.0 );
- const time_type c4 = static_cast<time_type> ( 125.0 ) / static_cast<time_type>( 594.0 );
- const time_type c6 = static_cast<time_type> ( 512.0 ) / static_cast<time_type>( 1771.0 );
+ const value_type a2 = static_cast<value_type> ( 0.2 );
+ const value_type a3 = static_cast<value_type> ( 0.3 );
+ const value_type a4 = static_cast<value_type> ( 0.6 );
+ const value_type a5 = static_cast<value_type> ( 1.0 );
+ const value_type a6 = static_cast<value_type> ( 0.875 );
+
+ const value_type b21 = static_cast<value_type> ( 0.2 );
+ const value_type b31 = static_cast<value_type> ( 3.0 ) / static_cast<value_type>( 40.0 );
+ const value_type b32 = static_cast<value_type> ( 9.0 ) / static_cast<value_type>( 40.0 );
+ const value_type b41 = static_cast<value_type> ( 0.3 );
+ const value_type b42 = static_cast<value_type> ( -0.9 );
+ const value_type b43 = static_cast<value_type> ( 1.2 );
+ const value_type b51 = static_cast<value_type> ( -11.0 ) / static_cast<value_type>( 54.0 );
+ const value_type b52 = static_cast<value_type> ( 2.5 );
+ const value_type b53 = static_cast<value_type> ( -70.0 ) / static_cast<value_type>( 27.0 );
+ const value_type b54 = static_cast<value_type> ( 35.0 ) / static_cast<value_type>( 27.0 );
+ const value_type b61 = static_cast<value_type> ( 1631.0 ) / static_cast<value_type>( 55296.0 );
+ const value_type b62 = static_cast<value_type> ( 175.0 ) / static_cast<value_type>( 512.0 );
+ const value_type b63 = static_cast<value_type> ( 575.0 ) / static_cast<value_type>( 13824.0 );
+ const value_type b64 = static_cast<value_type> ( 44275.0 ) / static_cast<value_type>( 110592.0 );
+ const value_type b65 = static_cast<value_type> ( 253.0 ) / static_cast<value_type>( 4096.0 );
+
+ const value_type c1 = static_cast<value_type> ( 37.0 ) / static_cast<value_type>( 378.0 );
+ const value_type c3 = static_cast<value_type> ( 250.0 ) / static_cast<value_type>( 621.0 );
+ const value_type c4 = static_cast<value_type> ( 125.0 ) / static_cast<value_type>( 594.0 );
+ const value_type c6 = static_cast<value_type> ( 512.0 ) / static_cast<value_type>( 1771.0 );
- m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_state_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_deriv_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
typename boost::unwrap_reference< System >::type &sys = system;
//m_x1 = x + dt*b21*dxdt
- algebra_type::for_each3( m_x1 , in , dxdt ,
- typename operations_type::template scale_sum2< time_type , time_type >( 1.0 , dt*b21 ) );
+ algebra_type::for_each3( m_x_tmp , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
- sys( m_x1 , m_x2 , t + dt*a2 );
- // m_x1 = x + dt*b31*dxdt + dt*b32*m_x2
- algebra_type::for_each4( m_x1 , in , dxdt , m_x2 ,
- typename operations_type::template scale_sum3< time_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
-
- sys( m_x1 , m_x3 , t + dt*a3 );
- // m_x1 = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3)
- algebra_type::for_each5( m_x1 , in , dxdt , m_x2 , m_x3 ,
- typename operations_type::template scale_sum4< time_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
-
- sys( m_x1, m_x4 , t + dt*a4 );
- algebra_type::for_each6( m_x1 , in , dxdt , m_x2 , m_x3 , m_x4 ,
- typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
-
- sys( m_x1 , m_x5 , t + dt*a5 );
- algebra_type::for_each7( m_x1 , in , dxdt , m_x2 , m_x3 , m_x4 , m_x5 ,
- typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
-
- sys( m_x1 , m_x6 , t + dt*a6 );
- algebra_type::for_each6( out , in , dxdt , m_x3 , m_x4 , m_x6 ,
- typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c6 ));
+ sys( m_x_tmp , m_k2 , t + dt*a2 );
+ // m_x_tmp = x + dt*b31*dxdt + dt*b32*m_x2
+ algebra_type::for_each4( m_x_tmp , in , dxdt , m_k2 ,
+ typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
+
+ sys( m_x_tmp , m_k3 , t + dt*a3 );
+ // m_x_tmp = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3)
+ algebra_type::for_each5( m_x_tmp , in , dxdt , m_k2 , m_k3 ,
+ typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
+
+ sys( m_x_tmp, m_k4 , t + dt*a4 );
+ algebra_type::for_each6( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
+
+ sys( m_x_tmp , m_k5 , t + dt*a5 );
+ algebra_type::for_each7( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 , m_k5 ,
+ typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
+
+ sys( m_x_tmp , m_k6 , t + dt*a6 );
+ algebra_type::for_each6( out , in , dxdt , m_k3 , m_k4 , m_k6 ,
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c6 ));
}
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
- m_size_adjuster.adjust_size( x );
+ m_state_adjuster.adjust_size( x );
+ m_deriv_adjuster.adjust_size( x );
stepper_base_type::adjust_size( x );
}
private:
- size_adjuster< state_type , 6 > m_size_adjuster;
- state_type m_x1, m_x2, m_x3, m_x4, m_x5, m_x6;
+ size_adjuster< state_type , 1 > m_state_adjuster;
+ size_adjuster< deriv_type , 5 > m_deriv_adjuster;
+ state_type m_x_tmp;
+ deriv_type m_k2, m_k3, m_k4, m_k5, m_k6;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -28,26 +28,28 @@
template<
class State ,
- class Time = double ,
+ class Value = double ,
+ class Deriv = State ,
+ class Time = Value ,
class Algebra = standard_algebra ,
class Operations = standard_operations ,
class AdjustSizePolicy = adjust_size_initially_tag
>
class explicit_euler
: public explicit_stepper_base<
- explicit_euler< State , Time , Algebra , Operations , AdjustSizePolicy > ,
- 1 , State , Time , Algebra , Operations , AdjustSizePolicy >
+ explicit_euler< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > ,
+ 1 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
{
public :
- friend class dense_output_explicit_euler< State , Time , Algebra , Operations , AdjustSizePolicy >;
+ friend class dense_output_explicit_euler< Deriv , Time , Algebra , Operations , AdjustSizePolicy >;
BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_euler , 1 );
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type & out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
- algebra_type::for_each3( out , in , dxdt , typename operations_type::template scale_sum2< time_type , time_type >( 1.0 , dt ) );
+ algebra_type::for_each3( out , in , dxdt , typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
}
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -29,15 +29,17 @@
template<
class State ,
- class Time = double ,
+ class Value = double ,
+ class Deriv = State ,
+ class Time = Value ,
class Algebra = standard_algebra ,
class Operations = standard_operations ,
class AdjustSizePolicy = adjust_size_initially_tag
>
class explicit_rk4
: public explicit_stepper_base<
- explicit_rk4< State , Time , Algebra , Operations , AdjustSizePolicy > ,
- 4 , State , Time , Algebra , Operations , AdjustSizePolicy >
+ explicit_rk4< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > ,
+ 4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
{
public :
@@ -45,16 +47,16 @@
BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_rk4 , 1 );
- explicit_rk4( void ) : m_size_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_xt()
+ explicit_rk4( void ) : m_deriv_adjuster() , m_state_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_x_tmp()
{
boost::numeric::odeint::construct( m_dxt );
boost::numeric::odeint::construct( m_dxm );
boost::numeric::odeint::construct( m_dxh );
- boost::numeric::odeint::construct( m_xt );
- m_size_adjuster.register_state( 0 , m_dxt );
- m_size_adjuster.register_state( 1 , m_dxm );
- m_size_adjuster.register_state( 2 , m_dxh );
- m_size_adjuster.register_state( 3 , m_xt );
+ boost::numeric::odeint::construct( m_x_tmp );
+ m_deriv_adjuster.register_state( 0 , m_dxt );
+ m_deriv_adjuster.register_state( 1 , m_dxm );
+ m_deriv_adjuster.register_state( 2 , m_dxh );
+ m_state_adjuster.register_state( 0 , m_x_tmp );
}
~explicit_rk4( void )
@@ -62,69 +64,73 @@
boost::numeric::odeint::destruct( m_dxt );
boost::numeric::odeint::destruct( m_dxm );
boost::numeric::odeint::destruct( m_dxh );
- boost::numeric::odeint::destruct( m_xt );
+ boost::numeric::odeint::destruct( m_x_tmp );
}
- template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
+ template< class System , class StateIn , class DerivIn , class StateOut >
+ void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
// ToDo : check if size of in,dxdt,out are equal?
- const time_type val1 = static_cast<time_type>( 1.0 );
+ const time_type val1 = static_cast< value_type >( 1.0 );
- m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_deriv_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ m_state_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
typename boost::unwrap_reference< System >::type &sys = system;
- time_type dh = static_cast<time_type>( 0.5 ) * dt;
+ time_type dh = static_cast< value_type >( 0.5 ) * dt;
time_type th = t + dh;
// dt * dxdt = k1
- // m_xt = x + dh*dxdt
- algebra_type::for_each3( m_xt , in , dxdt ,
- typename operations_type::template scale_sum2< time_type , time_type >( val1 , dh ) );
+ // m_x_tmp = x + dh*dxdt
+ algebra_type::for_each3( m_x_tmp , in , dxdt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
// dt * m_dxt = k2
- sys( m_xt , m_dxt , th );
+ sys( m_x_tmp , m_dxt , th );
- // m_xt = x + dh*m_dxt
- algebra_type::for_each3( m_xt , in , m_dxt ,
- typename operations_type::template scale_sum2< time_type , time_type >( val1 , dh ) );
+ // m_x_tmp = x + dh*m_dxt
+ algebra_type::for_each3( m_x_tmp , in , m_dxt ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
// dt * m_dxm = k3
- sys( m_xt , m_dxm , th );
- //m_xt = x + dt*m_dxm
- algebra_type::for_each3( m_xt , in , m_dxm ,
- typename operations_type::template scale_sum2< time_type , time_type >( val1 , dt ) );
+ sys( m_x_tmp , m_dxm , th );
+ //m_x_tmp = x + dt*m_dxm
+ algebra_type::for_each3( m_x_tmp , in , m_dxm ,
+ typename operations_type::template scale_sum2< value_type , time_type >( val1 , dt ) );
// dt * m_dxh = k4
- sys( m_xt , m_dxh , t + dt );
+ sys( m_x_tmp , m_dxh , t + dt );
//x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
- time_type dt6 = dt / static_cast<time_type>( 6.0 );
- time_type dt3 = dt / static_cast<time_type>( 3.0 );
+ time_type dt6 = dt / static_cast< value_type >( 6.0 );
+ time_type dt3 = dt / static_cast< value_type >( 3.0 );
algebra_type::for_each6( out , in , dxdt , m_dxt , m_dxm , m_dxh ,
- typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( 1.0 , dt6 , dt3 , dt3 , dt6 ) );
+ typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt6 , dt3 , dt3 , dt6 ) );
}
- void adjust_size( const state_type &x )
+ template< class StateType >
+ void adjust_size( const StateType &x )
{
- m_size_adjuster.adjust_size( x );
+ m_deriv_adjuster.adjust_size( x );
+ m_state_adjuster.adjust_size( x );
stepper_base_type::adjust_size( x );
}
private:
- size_adjuster< state_type , 4 > m_size_adjuster;
+ size_adjuster< deriv_type , 3 > m_deriv_adjuster;
+ size_adjuster< state_type , 1 > m_state_adjuster;
- state_type m_dxt;
- state_type m_dxm;
- state_type m_dxh;
- state_type m_xt;
+ deriv_type m_dxt;
+ deriv_type m_dxm;
+ deriv_type m_dxh;
+ state_type m_x_tmp;
};
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -20,17 +20,17 @@
: check_stepper_concepts.cpp
check_resize.cpp
check_implicit_euler.cpp
- check_dense_output_explicit_euler.cpp
- check_dense_output_dopri5.cpp
+# check_dense_output_explicit_euler.cpp
+# check_dense_output_dopri5.cpp
:
: <library>/boost/test//boost_unit_test_framework
<link>static
;
-exe controlled_stepper_evolution
- : controlled_stepper_evolution.cpp
- ;
+# exe controlled_stepper_evolution
+# : controlled_stepper_evolution.cpp
+# ;
-exe dense_output_stepper_evolution
- : dense_output_stepper_evolution.cpp
- ;
\ No newline at end of file
+# exe dense_output_stepper_evolution
+# : dense_output_stepper_evolution.cpp
+# ;
\ No newline at end of file
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_resize.cpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -61,13 +61,13 @@
BOOST_AUTO_TEST_SUITE( check_resize_test )
-typedef explicit_euler< test_array_type , double , standard_algebra , standard_operations , adjust_size_manually_tag > euler_manual_type;
-typedef explicit_euler< test_array_type , double , standard_algebra , standard_operations , adjust_size_initially_tag > euler_initially_type;
-typedef explicit_euler< test_array_type , double , standard_algebra , standard_operations , adjust_size_always_tag > euler_always_type;
-
-typedef explicit_rk4< test_array_type , double , standard_algebra , standard_operations , adjust_size_manually_tag > rk4_manual_type;
-typedef explicit_rk4< test_array_type , double , standard_algebra , standard_operations , adjust_size_initially_tag > rk4_initially_type;
-typedef explicit_rk4< test_array_type , double , standard_algebra , standard_operations , adjust_size_always_tag > rk4_always_type;
+typedef explicit_euler< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_manually_tag > euler_manual_type;
+typedef explicit_euler< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_initially_tag > euler_initially_type;
+typedef explicit_euler< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_always_tag > euler_always_type;
+
+typedef explicit_rk4< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_manually_tag > rk4_manual_type;
+typedef explicit_rk4< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_initially_tag > rk4_initially_type;
+typedef explicit_rk4< test_array_type , double , test_array_type , double , standard_algebra , standard_operations , adjust_size_always_tag > rk4_always_type;
typedef mpl::vector<
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/check_stepper_concepts.cpp 2011-01-19 12:13:50 EST (Wed, 19 Jan 2011)
@@ -94,10 +94,10 @@
const double eps = 1.0e-14;
template< class Stepper , class System >
-void check_stepper_concept( Stepper &stepper , System system , typename Stepper::state_type &x )
+void check_stepper_concept( Stepper &stepper , System system , typename Stepper::deriv_type &x )
{
typedef Stepper stepper_type;
- typedef typename stepper_type::state_type container_type;
+ typedef typename stepper_type::deriv_type container_type;
typedef typename stepper_type::order_type order_type;
typedef typename stepper_type::time_type time_type;
@@ -108,7 +108,7 @@
void check_error_stepper_concept( Stepper &stepper , System system , typename Stepper::state_type &x , typename Stepper::state_type &xerr )
{
typedef Stepper stepper_type;
- typedef typename stepper_type::state_type container_type;
+ typedef typename stepper_type::deriv_type container_type;
typedef typename stepper_type::order_type order_type;
typedef typename stepper_type::time_type time_type;
@@ -119,7 +119,7 @@
void check_controlled_stepper_concept( Stepper &stepper , System system , typename Stepper::state_type &x )
{
typedef Stepper stepper_type;
- typedef typename stepper_type::state_type container_type;
+ typedef typename stepper_type::deriv_type container_type;
typedef typename stepper_type::order_type order_type;
typedef typename stepper_type::time_type time_type;
@@ -177,10 +177,10 @@
template< class State > class stepper_methods : public mpl::vector<
- explicit_euler< State , double , typename algebra_dispatcher< State >::type > ,
- explicit_rk4< State , double , typename algebra_dispatcher< State >::type > ,
- explicit_error_rk54_ck< State , double , typename algebra_dispatcher< State >::type > ,
- explicit_error_dopri5< State , double , typename algebra_dispatcher< State >::type >
+ explicit_euler< State , double , State , double , typename algebra_dispatcher< State >::type > ,
+ explicit_rk4< State , double , State , double , typename algebra_dispatcher< State >::type > ,
+ explicit_error_rk54_ck< State , double , State , double , typename algebra_dispatcher< State >::type > ,
+ explicit_error_dopri5< State , double , State , double , typename algebra_dispatcher< State >::type >
> { };
@@ -206,7 +206,7 @@
BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_test , Stepper, all_stepper_methods )
{
- perform_stepper_test< Stepper , typename Stepper::state_type > tester;
+ perform_stepper_test< Stepper , typename Stepper::deriv_type > tester;
tester();
}
@@ -275,8 +275,8 @@
template< class State > class error_stepper_methods : public mpl::vector<
- explicit_error_rk54_ck< State , double , typename algebra_dispatcher< State >::type > ,
- explicit_error_dopri5< State , double , typename algebra_dispatcher< State >::type >
+ explicit_error_rk54_ck< State , double , State , double , typename algebra_dispatcher< State >::type > ,
+ explicit_error_dopri5< State , double , State , double , typename algebra_dispatcher< State >::type >
> { };
@@ -374,8 +374,8 @@
};
template< class State > class controlled_stepper_methods : public mpl::vector<
- controlled_error_stepper< explicit_error_rk54_ck< State , double , typename algebra_dispatcher< State >::type > > ,
- controlled_error_stepper< explicit_error_dopri5< State , double , typename algebra_dispatcher< State >::type > >
+ controlled_error_stepper< explicit_error_rk54_ck< State , double , State , double , typename algebra_dispatcher< State >::type > > ,
+ controlled_error_stepper< explicit_error_dopri5< State , double , State , double , typename algebra_dispatcher< State >::type > >
> { };
typedef mpl::copy
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