$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r68400 - in sandbox/odeint/branches/karsten: . boost/numeric boost/numeric/odeint/algebra 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-23 14:17:56
Author: karsten
Date: 2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
New Revision: 68400
URL: http://svn.boost.org/trac/boost/changeset/68400
Log:
* making the steppers copyconstructable
* making the controlled steper default constructable
Added:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_copying.cpp   (contents, props changed)
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp   (contents, props changed)
Text files modified: 
   sandbox/odeint/branches/karsten/TODO                                                                               |     6 +++                                     
   sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp                                                           |     2 +                                       
   sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp                                   |     1                                         
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp                  |    13 ++++++++                                
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp      |    14 ++++++++                                
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp |    15 +++++++++                               
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp                        |    17 ++++++++++-                             
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp                          |    45 +++++++++++++++++++++++++-----          
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/macros.hpp                                     |    14 +++++++++                               
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp                             |    58 +++++++++++++++++++++++++++++++-------- 
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp                            |    43 ++++++++++++++++++++++++----            
   sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp                                      |    45 +++++++++++++++++++++++++-----          
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile                                                   |     2 +                                       
   13 files changed, 232 insertions(+), 43 deletions(-)
Modified: sandbox/odeint/branches/karsten/TODO
==============================================================================
--- sandbox/odeint/branches/karsten/TODO	(original)
+++ sandbox/odeint/branches/karsten/TODO	2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -1,9 +1,13 @@
 * Unit test
-  OK * test operations
+  NEARLY DONE * test operations
   OK * test standard_algebra
   OK * test fusion_algebra
   * test vector_space_algebra
+  * test copying
 * change standard_operations::rel_error in order to word with units and test it
+* include implicit euler
+  * call via std::pair< deriv , jacobi >
+  * resizing
 OK * operations that fit units
 OK * operations that fit result_of
 * include test/thrust in jam system, use system from 
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp	2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -28,4 +28,6 @@
 #include <boost/numeric/odeint/stepper/dense_output_explicit_euler.hpp>
 #include <boost/numeric/odeint/stepper/dense_output_dopri5.hpp>
 
+#include <boost/numeric/odeint/algebra/fusion_algebra.hpp>
+
 #endif // BOOST_NUMERIC_ODEINT_HPP
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp	(original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_resize.hpp	2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -93,7 +93,6 @@
         }
 }
 
-
 template< class Container , class Deriv >
 void copy( const Container &from , Deriv &to )
 {
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -13,7 +13,6 @@
 #ifndef BOOST_NUMERIC_ODEINT_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
 #define BOOST_NUMERIC_ODEINT_EXPLICIT_ERROR_STEPPER_BASE_HPP_INCLUDED
 
-#include <boost/noncopyable.hpp>
 #include <boost/ref.hpp>
 
 #include <boost/numeric/odeint/stepper/adjust_size.hpp>
@@ -82,6 +81,18 @@
                 boost::numeric::odeint::destruct( m_dxdt );
         }
 
+	explicit_error_stepper_base( const explicit_error_stepper_base &b ) : m_size_adjuster() , m_dxdt()
+	{
+		boost::numeric::odeint::construct( m_dxdt );
+		m_size_adjuster.register_state( 0 , m_dxdt );
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+	}
+
+	explicit_error_stepper_base& operator=( const explicit_error_stepper_base &b )
+	{
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+		return *this;
+	}
 
 
 
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -13,7 +13,6 @@
 #ifndef BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_AND_ERROR_STEPPER_BASE_HPP_INCLUDED
 #define BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_AND_ERROR_STEPPER_BASE_HPP_INCLUDED
 
-#include <boost/noncopyable.hpp>
 #include <boost/ref.hpp>
 
 #include <boost/numeric/odeint/stepper/adjust_size.hpp>
@@ -92,6 +91,19 @@
                 boost::numeric::odeint::destruct( m_dxdt );
         }
 
+	explicit_stepper_and_error_stepper_base( const explicit_stepper_and_error_stepper_base &b ) : m_size_adjuster() , m_dxdt()
+	{
+		boost::numeric::odeint::construct( m_dxdt );
+		m_size_adjuster.register_state( 0 , m_dxdt );
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+	}
+
+	explicit_stepper_and_error_stepper_base& operator=( const explicit_stepper_and_error_stepper_base &b )
+	{
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+		return *this;
+	}
+
 
 
 
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -13,7 +13,6 @@
 #ifndef BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_AND_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
 #define BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_AND_ERROR_STEPPER_FSAL_BASE_HPP_INCLUDED
 
-#include <boost/noncopyable.hpp>
 #include <boost/ref.hpp>
 
 #include <boost/numeric/odeint/stepper/adjust_size.hpp>
@@ -91,6 +90,20 @@
                 boost::numeric::odeint::destruct( m_dxdt );
         }
 
+    explicit_stepper_and_error_stepper_fsal_base( const explicit_stepper_and_error_stepper_fsal_base &b )
+    : m_size_adjuster() , m_dxdt() , m_first_call( true )
+	{
+		boost::numeric::odeint::construct( m_dxdt );
+		m_size_adjuster.register_state( 0 , m_dxdt );
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+	}
+
+    explicit_stepper_and_error_stepper_fsal_base& operator=( const explicit_stepper_and_error_stepper_fsal_base &b )
+    {
+    	boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+    	m_first_call( true );
+		return *this;
+    }
 
 
 
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -13,7 +13,6 @@
 #ifndef BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
 #define BOOST_NUMERIC_ODEINT_EXPLICIT_STEPPER_BASE_HPP_INCLUDED
 
-#include <boost/noncopyable.hpp>
 #include <boost/ref.hpp>
 
 #include <boost/numeric/odeint/stepper/adjust_size.hpp>
@@ -39,7 +38,7 @@
         class Operations ,
         class AdjustSizePolicy
 >
-class explicit_stepper_base : boost::noncopyable
+class explicit_stepper_base
 {
 public:
 
@@ -76,6 +75,20 @@
                 boost::numeric::odeint::destruct( m_dxdt );
         }
 
+	explicit_stepper_base( const explicit_stepper_base &b ) : m_size_adjuster() , m_dxdt()
+	{
+		boost::numeric::odeint::construct( m_dxdt );
+		m_size_adjuster.register_state( 0 , m_dxdt );
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+	}
+
+	explicit_stepper_base& operator=( const explicit_stepper_base &b )
+	{
+		boost::numeric::odeint::copy( b.m_dxdt , m_dxdt );
+		return *this;
+	}
+
+
 
 
 
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -61,6 +61,23 @@
 	>
 class controlled_error_stepper< ErrorStepper , ErrorChecker , AdjustSizePolicy , explicit_error_stepper_tag > : boost::noncopyable
 {
+	void initialize( void )
+	{
+		boost::numeric::odeint::construct( m_dxdt );
+		boost::numeric::odeint::construct( m_xerr );
+		boost::numeric::odeint::construct( m_xnew );
+		m_dxdt_size_adjuster.register_state( 0 , m_dxdt );
+		m_xerr_size_adjuster.register_state( 0 , m_xerr );
+		m_xnew_size_adjuster.register_state( 0 , m_xnew );
+	}
+
+	void copy( controlled_error_stepper &stepper )
+	{
+		boost::numeric::odeint::copy( stepper.m_dxdt , m_dxdt );
+		boost::numeric::odeint::copy( stepper.m_xerr , m_xerr );
+		boost::numeric::odeint::copy( stepper.m_dnew , m_xnew );
+	}
+
 public:
 
         typedef ErrorStepper stepper_type;
@@ -75,19 +92,14 @@
 
 
         controlled_error_stepper(
-			stepper_type &stepper ,
+			const stepper_type &stepper = stepper_type() ,
                         const error_checker_type &error_checker = error_checker_type()
                         )
         : m_stepper( stepper ) , m_error_checker( error_checker ) ,
           m_dxdt_size_adjuster() , m_xerr_size_adjuster() , m_xnew_size_adjuster() ,
           m_dxdt() , m_xerr() , m_xnew() , m_max_rel_error()
         {
-		boost::numeric::odeint::construct( m_dxdt );
-		boost::numeric::odeint::construct( m_xerr );
-		boost::numeric::odeint::construct( m_xnew );
-		m_dxdt_size_adjuster.register_state( 0 , m_dxdt );
-		m_xerr_size_adjuster.register_state( 0 , m_xerr );
-		m_xnew_size_adjuster.register_state( 0 , m_xnew );
+		initialize();
         }
 
         ~controlled_error_stepper( void )
@@ -97,6 +109,23 @@
                 boost::numeric::odeint::destruct( m_xnew );
         }
 
+	controlled_error_stepper( const controlled_error_stepper &stepper )
+	: m_stepper( stepper.m_stepper ) , m_error_checker( stepper.m_error_checker ) ,
+	  m_dxdt_size_adjuster() , m_xerr_size_adjuster() , m_xnew_size_adjuster() ,
+	  m_dxdt() , m_xerr() , m_xnew() , m_max_rel_error()
+	{
+		initialize();
+		copy( stepper );
+	}
+
+	controlled_error_stepper& operator=( const controlled_error_stepper &stepper )
+	{
+		m_stepper( stepper.m_stepper );
+		m_error_checker( stepper.m_error_checker );
+		copy( stepper );
+		return *this;
+	}
+
 
 
 
@@ -204,7 +233,7 @@
 
 private:
 
-	stepper_type &m_stepper;
+	stepper_type m_stepper;
         error_checker_type m_error_checker;
 
         size_adjuster< deriv_type , 1 > m_dxdt_size_adjuster;
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -55,4 +55,18 @@
 typedef typename stepper_base_type::adjust_size_policy adjust_size_policy; \
 typedef typename stepper_base_type::stepper_type stepper_type
 
+#define BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_FSAL_TYPEDEFS( STEPPER , ORDER , STEPPER_ORDER , ERROR_ORDER ) \
+typedef explicit_stepper_and_error_stepper_fsal_base< \
+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; \
+typedef typename stepper_base_type::adjust_size_policy adjust_size_policy; \
+typedef typename stepper_base_type::stepper_type stepper_type
+
+
 #endif //BOOST_BOOST_NUMERIC_ODEINT_DETAIL_MACROS_HPP_INCLUDED
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -44,17 +44,7 @@
           5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
 {
 
-public :
-
-	template< class ControlledStepper >
-	friend class dense_output_dopri5;
-
-	BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_TYPEDEFS( explicit_error_dopri5 , 5 , 5 , 4 );
-
-	typedef explicit_error_stepper_fsal_tag stepper_category;
-
-	explicit_error_dopri5( void )
-	: m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	void initialize( void )
         {
                 boost::numeric::odeint::construct( m_x_tmp );
                 boost::numeric::odeint::construct( m_k2 );
@@ -70,6 +60,33 @@
                 m_deriv_adjuster.register_state( 4 , m_k6 );
         }
 
+	void copy( explicit_error_dopri5 &d )
+	{
+		boost::numeric::odeint::copy( d.m_x_tmp , m_x_tmp );
+		boost::numeric::odeint::copy( d.m_k2 , m_k2 );
+		boost::numeric::odeint::copy( d.m_k3 , m_k3 );
+		boost::numeric::odeint::copy( d.m_k4 , m_k4 );
+		boost::numeric::odeint::copy( d.m_k5 , m_k5 );
+		boost::numeric::odeint::copy( d.m_k6 , m_k6 );
+	}
+
+
+
+public :
+
+	template< class ControlledStepper >
+	friend class dense_output_dopri5;
+
+	BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_FSAL_TYPEDEFS( explicit_error_dopri5 , 5 , 5 , 4 );
+
+	typedef explicit_error_stepper_fsal_tag stepper_category;
+
+	explicit_error_dopri5( void )
+	: stepper_base_type() , m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	{
+		initialize();
+	}
+
         ~explicit_error_dopri5( void )
         {
                 boost::numeric::odeint::destruct( m_x_tmp );
@@ -80,6 +97,21 @@
                 boost::numeric::odeint::destruct( m_k6 );
         }
 
+	explicit_error_dopri5( const explicit_error_dopri5 &d )
+	: stepper_base_type( d ) , m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	{
+		initialize();
+		copy( d );
+	}
+
+	explicit_error_dopri5& operator=( const explicit_error_dopri5 &d )
+	{
+		stepper_base_type::operator=( d );
+		copy( d );
+		return *this;
+	}
+
+
 
 
 
@@ -88,8 +120,8 @@
         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 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.8 );
         const value_type a5 = static_cast<value_type> ( 8.0 )/static_cast<value_type> ( 9.0 );
 
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -49,13 +49,7 @@
           5 , 5 , 4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
 {
 
-public :
-
-	BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_TYPEDEFS( explicit_error_rk54_ck , 5 , 5 , 4);
-
-	typedef explicit_error_stepper_tag stepper_category;
-
-	explicit_error_rk54_ck( void ) : m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	void initialize( void )
         {
                 boost::numeric::odeint::construct( m_x_tmp );
                 boost::numeric::odeint::construct( m_k2 );
@@ -71,6 +65,28 @@
                 m_deriv_adjuster.register_state( 4 , m_k6 );
         }
 
+	void copy( const explicit_error_rk54_ck &rk )
+	{
+		boost::numeric::odeint::copy( rk.m_x_tmp , m_x_tmp );
+		boost::numeric::odeint::copy( rk.m_k2 , m_k2 );
+		boost::numeric::odeint::copy( rk.m_k3 , m_k3 );
+		boost::numeric::odeint::copy( rk.m_k4 , m_k4 );
+		boost::numeric::odeint::copy( rk.m_k5 , m_k5 );
+		boost::numeric::odeint::copy( rk.m_k6 , m_k6 );
+	}
+
+public :
+
+	BOOST_ODEINT_EXPLICIT_STEPPERS_AND_ERROR_STEPPERS_TYPEDEFS( explicit_error_rk54_ck , 5 , 5 , 4);
+
+	typedef explicit_error_stepper_tag stepper_category;
+
+	explicit_error_rk54_ck( void )
+	: stepper_base_type() , m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	{
+		initialize();
+	}
+
         ~explicit_error_rk54_ck( void )
         {
                 boost::numeric::odeint::destruct( m_x_tmp );
@@ -81,6 +97,19 @@
                 boost::numeric::odeint::destruct( m_k6 );
         }
 
+	explicit_error_rk54_ck( const explicit_error_rk54_ck &rk )
+	: stepper_base_type( rk ) , m_state_adjuster() , m_deriv_adjuster() , m_x_tmp() , m_k2() , m_k3() , m_k4() , m_k5() , m_k6()
+	{
+		initialize();
+		copy( rk );
+	}
+
+	explicit_error_rk54_ck& operator=( const explicit_error_rk54_ck &rk )
+	{
+		stepper_base_type::operator=( rk );
+		copy( rk );
+		return *this;
+	}
 
         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 )
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -41,13 +41,7 @@
           explicit_rk4< State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy > ,
           4 , State , Value , Deriv , Time , Algebra , Operations , AdjustSizePolicy >
 {
-public :
-
-
-	BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_rk4 , 1 );
-
-
-	explicit_rk4( void ) : m_deriv_adjuster() , m_state_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_x_tmp()
+	void initialize( void )
         {
                 boost::numeric::odeint::construct( m_dxt );
                 boost::numeric::odeint::construct( m_dxm );
@@ -59,6 +53,26 @@
                 m_state_adjuster.register_state( 0 , m_x_tmp );
         }
 
+	void copy( const explicit_rk4 &rk )
+	{
+		boost::numeric::odeint::copy( rk.m_dxt , m_dxt );
+		boost::numeric::odeint::copy( rk.m_dxm , m_dxm );
+		boost::numeric::odeint::copy( rk.m_dxh , m_dxh );
+		boost::numeric::odeint::copy( rk.m_x_tmp , m_x_tmp );
+	}
+
+public :
+
+
+	BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_rk4 , 4 );
+
+
+	explicit_rk4( void )
+	: stepper_base_type() , m_deriv_adjuster() , m_state_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_x_tmp()
+	{
+		initialize();
+	}
+
         ~explicit_rk4( void )
         {
                 boost::numeric::odeint::destruct( m_dxt );
@@ -67,12 +81,27 @@
                 boost::numeric::odeint::destruct( m_x_tmp );
         }
 
+	explicit_rk4( const explicit_rk4 &rk )
+	: stepper_base_type( rk ) , m_deriv_adjuster() , m_state_adjuster() , m_dxt() , m_dxm() , m_dxh() , m_x_tmp()
+	{
+		initialize();
+		copy( rk );
+	}
+
+	explicit_rk4& operator=( const explicit_rk4 &rk )
+	{
+		stepper_base_type::operator=( rk );
+		copy( rk );
+		return *this;
+	}
+
+
         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< value_type >( 1.0 );
+        const value_type val1 = static_cast< value_type >( 1.0 );
 
                 m_deriv_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
                 m_state_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
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-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -24,4 +24,6 @@
          [ run standard_algebra.cpp ]
          [ run implicit_euler.cpp ]
          [ run fusion_algebra.cpp ]
+	 [ run stepper_with_units.cpp ]
+	 [ run stepper_copying.cpp ]
          ;    
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_copying.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_copying.cpp	2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -0,0 +1,21 @@
+/*
+ * stepper_copying.cpp
+ *
+ *  Created on: Jan 23, 2011
+ *      Author: karsten
+ */
+
+#define BOOST_TEST_MODULE odeint_stepper_copying
+
+#include <boost/test/unit_test.hpp>
+
+#include <boost/numeric/odeint.hpp>
+
+BOOST_AUTO_TEST_SUITE( stepper_copying )
+
+BOOST_AUTO_TEST_CASE( explicit_euler_copying )
+{
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp	2011-01-23 14:17:53 EST (Sun, 23 Jan 2011)
@@ -0,0 +1,268 @@
+/* Boost stepper_euler.cpp test file
+
+ Copyright 2009 Karsten Ahnert
+ Copyright 2009 Mario Mulansky
+
+ This file tests the use of the all different steppers with several state types:
+ std::vector< double >
+ vector_space_1d< double >  (see vector_space_1d.hpp)
+ std::tr1::array< double , 1 >
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or
+ copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#define BOOST_TEST_MODULE odeint_stepper_with_units
+
+
+#include <boost/test/unit_test.hpp>
+
+#include <boost/units/systems/si/length.hpp>
+#include <boost/units/systems/si/time.hpp>
+#include <boost/units/systems/si/velocity.hpp>
+#include <boost/units/systems/si/acceleration.hpp>
+#include <boost/units/systems/si/io.hpp>
+
+#include <boost/fusion/container.hpp>
+#include <boost/mpl/vector.hpp>
+
+#include <boost/numeric/odeint.hpp>
+
+
+using namespace boost::numeric::odeint;
+using namespace boost::unit_test;
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+namespace units = boost::units;
+namespace si = boost::units::si;
+
+typedef double value_type;
+typedef units::quantity< si::time , value_type > time_type;
+typedef units::quantity< si::length , value_type > length_type;
+typedef units::quantity< si::velocity , value_type > velocity_type;
+typedef units::quantity< si::acceleration , value_type > acceleration_type;
+typedef fusion::vector< length_type , velocity_type > state_type;
+typedef fusion::vector< velocity_type , acceleration_type > deriv_type;
+
+
+void oscillator( const state_type &x , deriv_type &dxdt , time_type t )
+{
+
+}
+
+template< class Stepper >
+void check_stepper( Stepper &stepper )
+{
+	typedef Stepper 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 typename stepper_type::algebra_type algebra_type;
+	typedef typename stepper_type::operations_type operations_type;
+
+	const time_type t( 0.0 * si::second );
+	time_type dt( 0.1 * si::second );
+	state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second );
+
+	// test call method one
+	stepper.do_step( oscillator , x , t , dt );
+
+	// test call method two
+	stepper.do_step( oscillator , x , t , x , dt );
+
+	// test call method three
+	deriv_type dxdt;
+	oscillator( x , dxdt , t );
+	stepper.do_step( oscillator , x , dxdt , t , dt );
+
+	// test call method four
+	oscillator( x , dxdt , t );
+	stepper.do_step( oscillator , x , dxdt , t , x , dt );
+}
+
+template< class Stepper >
+void check_fsal_stepper( Stepper &stepper )
+{
+	typedef Stepper 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 typename stepper_type::algebra_type algebra_type;
+	typedef typename stepper_type::operations_type operations_type;
+
+	const time_type t( 0.0 * si::second );
+	time_type dt( 0.1 * si::second );
+	state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second );
+
+	// test call method one
+	stepper.do_step( oscillator , x , t , dt );
+
+	// test call method two
+	stepper.do_step( oscillator , x , t , x , dt );
+
+	// test call method three
+	deriv_type dxdt;
+	oscillator( x , dxdt , t );
+	stepper.do_step( oscillator , x , dxdt , t , dt );
+
+	// test call method four
+	stepper.do_step( oscillator , x , dxdt , t , x , dxdt , dt );
+}
+
+template< class Stepper >
+void check_error_stepper( Stepper &stepper )
+{
+	typedef Stepper 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 typename stepper_type::algebra_type algebra_type;
+	typedef typename stepper_type::operations_type operations_type;
+
+	const time_type t( 0.0 * si::second );
+	time_type dt( 0.1 * si::second );
+	state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second ) , xerr;
+
+	// test call method one
+	stepper.do_step( oscillator , x , t , dt , xerr );
+
+	// test call method two
+	stepper.do_step( oscillator , x , t , x , dt , xerr );
+
+	// test call method three
+	deriv_type dxdt;
+	oscillator( x , dxdt , t );
+	stepper.do_step( oscillator , x , dxdt , t , dt , xerr );
+
+	// test call method four
+	stepper.do_step( oscillator , x , dxdt , t , x , dt , xerr );
+}
+
+template< class Stepper >
+void check_fsal_error_stepper( Stepper &stepper )
+{
+	typedef Stepper 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 typename stepper_type::algebra_type algebra_type;
+	typedef typename stepper_type::operations_type operations_type;
+
+	const time_type t( 0.0 * si::second );
+	time_type dt( 0.1 * si::second );
+	state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second ) , xerr;
+
+	// test call method one
+	stepper.do_step( oscillator , x , t , dt , xerr );
+
+	// test call method two
+	stepper.do_step( oscillator , x , t , x , dt , xerr );
+
+	// test call method three
+	deriv_type dxdt;
+	oscillator( x , dxdt , t );
+	stepper.do_step( oscillator , x , dxdt , t , dt , xerr );
+
+	// test call method four
+	stepper.do_step( oscillator , x , dxdt , t , x , dxdt , dt , xerr );
+}
+
+template< class Stepper >
+void check_controlled_stepper( Stepper &stepper )
+{
+	typedef Stepper 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 typename stepper_type::algebra_type algebra_type;
+	typedef typename stepper_type::operations_type operations_type;
+
+	const time_type t( 0.0 * si::second );
+	time_type dt( 0.1 * si::second );
+	state_type x( 1.0 * si::meter , 0.0 * si::meter_per_second ) , xerr;
+
+	// test call method one
+	stepper.try_step( oscillator , x , t , dt );
+}
+
+
+
+
+
+
+class stepper_types : public mpl::vector
+<
+	explicit_euler< state_type , value_type , deriv_type , time_type , fusion_algebra > ,
+	explicit_rk4< state_type , value_type , deriv_type , time_type , fusion_algebra > ,
+	explicit_error_rk54_ck< state_type , value_type , deriv_type , time_type , fusion_algebra >
+> { };
+
+class fsal_stepper_types : public mpl::vector
+<
+	explicit_error_dopri5< state_type , value_type , deriv_type , time_type , fusion_algebra >
+> { };
+
+class error_stepper_types : public mpl::vector
+<
+	explicit_error_rk54_ck< state_type , value_type , deriv_type , time_type , fusion_algebra >
+> { };
+
+class fsal_error_stepper_types : public mpl::vector
+<
+	explicit_error_dopri5< state_type , value_type , deriv_type , time_type , fusion_algebra >
+> { };
+
+class controlled_stepper_types : public mpl::vector
+<
+	controlled_error_stepper< explicit_error_rk54_ck< state_type , value_type , deriv_type , time_type , fusion_algebra > >
+> { };
+
+
+
+
+
+BOOST_AUTO_TEST_SUITE( stepper_with_units )
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_test , Stepper , stepper_types )
+{
+	Stepper stepper;
+	check_stepper( stepper );
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( fsl_stepper_test , Stepper , fsal_stepper_types )
+{
+	Stepper stepper;
+	check_fsal_stepper( stepper );
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( error_stepper_test , Stepper , error_stepper_types )
+{
+	Stepper stepper;
+	check_error_stepper( stepper );
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( fsal_error_stepper_test , Stepper , fsal_error_stepper_types )
+{
+	Stepper stepper;
+	check_fsal_error_stepper( stepper );
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( controlled_stepper_test , Stepper , controlled_stepper_types )
+{
+//	Stepper stepper;
+//	check_controlled_stepper( stepper );
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()