|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72021 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/stepper boost/numeric/odeint/stepper/detail libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-05-17 14:22:50
Author: karsten
Date: 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
New Revision: 72021
URL: http://svn.boost.org/trac/boost/changeset/72021
Log:
adams bashforth continued
Added:
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp (contents, props changed)
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp (contents, props changed)
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp (contents, props changed)
Text files modified:
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth.hpp | 162 +++++++++++++++++++++++++++++++++++----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp | 7 +
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp | 6
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/stepper_categories.hpp | 4
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile | 1
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth_moulton.cpp | 14 --
6 files changed, 157 insertions(+), 37 deletions(-)
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -9,17 +9,25 @@
#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_HPP_
#include <boost/ref.hpp>
+#include <boost/array.hpp>
+#include <boost/circular_buffer.hpp>
-#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
-#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
+
#include <boost/numeric/odeint/util/size_adjuster.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/stepper/explicit_rk4.hpp>
+
+#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp>
+#include <boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp>
+
+
+
+
-/*
- * # Introduce the number of states
- */
namespace boost {
namespace numeric {
@@ -47,7 +55,13 @@
void initialize( void )
{
+ for( size_t i=0 ; i<steps ; ++i )
+ m_size_adjuster.register_state( i , m_step_storage[i] );
+ }
+ void copy( const adams_bashforth &stepper )
+ {
+ m_step_storage = stepper.m_step_storage;
}
public :
@@ -59,70 +73,180 @@
typedef Algebra algebra_type;
typedef Operations operations_type;
typedef AdjustSizePolicy adjust_size_policy;
- typedef explicit_stepper_tag stepper_category;
+ typedef stepper_tag stepper_category;
static const size_t steps = Steps;
typedef unsigned short order_type;
- static const order_type order_value = steps + 1;
+ static const order_type order_value = steps;
+
+ typedef detail::rotating_buffer< deriv_type , steps > step_storage_type;
+
order_type order( void ) const { return order_value; }
adams_bashforth( void )
+ : m_step_storage() , m_size_adjuster() , m_coefficients()
{
initialize();
}
- ~adams_bashforth( void )
- {
- }
-
adams_bashforth( const adams_bashforth &stepper )
+ : m_step_storage() , m_size_adjuster() , m_coefficients()
{
initialize();
+ copy( stepper );
}
adams_bashforth& operator=( const adams_bashforth &stepper )
{
+ copy( stepper );
return *this;
}
+
+ /*
+ * Version 1 : do_step( system , x , t , dt );
+ *
+ * solves the forwarding problem
+ */
template< class System , class StateInOut >
void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt )
{
- // ToDo : implement
+ do_step( system , x , t , x , dt );
}
template< class System , class StateInOut >
void do_step( System system , const StateInOut &x , const time_type &t , const time_type &dt )
{
- // ToDo : implement
+ do_step( system , x , t , x , dt );
}
+
+
+ /*
+ * Version 2 : do_step( system , in , t , out , dt );
+ *
+ * solves the forwarding problem
+ */
template< class System , class StateIn , class StateOut >
- void do_step( System system , const StateIn &in , const time_type &t , const StateOut &out , const time_type &dt )
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
{
- // ToDo : implement
+ typename boost::unwrap_reference< System >::type &sys = system;
+ m_step_storage.rotate();
+ sys( in , m_step_storage[0] , t );
+ detail::call_algebra< steps , algebra_type , operations_type >()( in , out , m_step_storage , m_coefficients , 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 )
+ void do_step( System system , const StateIn &in , const time_type &t , const StateOut &out , const time_type &dt )
{
- // ToDo : implement
+ typename boost::unwrap_reference< System >::type &sys = system;
+ m_step_storage.rotate();
+ sys( in , m_step_storage[0] , t );
+ detail::call_algebra< steps , algebra_type , operations_type >()( in , out , m_step_storage , m_coefficients , dt );
}
+
+
+
+// /*
+// * Version 3 : do_step( system , x , dxdt , t , dt );
+// *
+// * solves the forwarding proble
+// *
+// * ToDo: Do we need this methods?
+// */
+// template< class System , class StateInOut , class DerivIn >
+// void do_step( System sys , StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
+// {
+// do_step( sys , x , dxdt , t , x , dt );
+// }
+//
+// template< class System , class StateInOut , class DerivIn >
+// void do_step( System sys , const StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
+// {
+// do_step( sys , x , dxdt , t , x , dt );
+// }
+//
+//
+//
+// /*
+// * Version 4 : do_step( system , in , dxdt , t , out , dt )
+// *
+// * solves the forwarding problem
+// *
+// * ToDo: Do we need this methods?
+// */
+// 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 )
+// {
+// m_step_storage.rotate();
+// boost::numeric::odeint::copy( dxdt , m_step_storage[0] );
+// do_step_impl( in , t , out , 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 , const StateOut &out , const time_type &dt )
+// {
+// m_step_storage.rotate();
+// boost::numeric::odeint::copy( dxdt , m_step_storage[0] );
+// do_step_impl( in , t , out , dt );
+// }
+
+
+
+
+
+
+
+
+
+
+
+
+
template< class StateType >
void adjust_size( const StateType &x )
{
+ m_size_adjuster.adjust_size();
+ }
+
+ const step_storage_type& step_storage( void ) const
+ {
+ return m_step_storage;
+ }
+
+ step_storage_type& step_storage( void )
+ {
+ return m_step_storage;
+ }
+
+ template< class ExplicitStepper , class System , class StateIn >
+ void initialize( ExplicitStepper explicit_stepper , System system , const StateIn &x , const time_type &t , const time_type &dt )
+ {
+ typename boost::unwrap_reference< ExplicitStepper >::type &stepper = explicit_stepper;
+ typename boost::unwrap_reference< System >::type &sys = system;
+
+ // ToDo : implement
+
+ }
+
+ template< class System , class StateIn >
+ void initialize( System system , const StateIn &x , const time_type &t , const time_type &dt )
+ {
+ explicit_rk4< state_type , value_type , deriv_type , time_type , algebra_type , operations_type , adjust_size_initially_tag > rk4;
+ initialize( boost::ref( rk4 ) , system , x , t , dt );
}
private:
- boost::array< deriv_type , steps > m_steps_storage;
-// boost::circular_buffer< deriv_type* > m_previous_steps;
+ step_storage_type m_step_storage;
+ size_adjuster< deriv_type , steps > m_size_adjuster;
+ const detail::adams_bashforth_coefficients< value_type , steps > m_coefficients;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -10,6 +10,11 @@
#include <boost/ref.hpp>
+#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
+#include <boost/numeric/odeint/algebra/range_algebra.hpp>
+#include <boost/numeric/odeint/algebra/default_operations.hpp>
+#include <boost/numeric/odeint/util/size_adjuster.hpp>
+
/*
* # Introduce the number of states
*/
@@ -49,7 +54,7 @@
typedef Algebra algebra_type;
typedef Operations operations_type;
typedef AdjustSizePolicy adjust_size_policy;
- typedef explicit_stepper_tag stepper_category;
+ typedef stepper_tag stepper_category;
static const size_t steps = Steps;
Added: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -0,0 +1,119 @@
+/*
+ * adams_bashforth_coefficients.hpp
+ *
+ * Created on: May 15, 2011
+ * Author: karsten
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_
+
+#include <boost/array.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t Step , class Algebra , class Operations >
+struct call_algebra;
+
+template< class Algebra , class Operations >
+struct call_algebra< 1 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 2 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 3 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 4 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 5 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 6 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 7 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct call_algebra< 8 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Value >
+ void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Value &dt ) const
+ {
+
+ }
+};
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif /* BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_ */
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -5,8 +5,8 @@
* Author: karsten
*/
-#ifndef BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_COEFFICIENTS_HPP_
-#define BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_COEFFICIENTS_HPP_
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_
#include <boost/array.hpp>
@@ -155,4 +155,4 @@
-#endif /* BOOST_NUMERIC_ODEINT_STEPPER_ADAMS_BASHFORTH_COEFFICIENTS_HPP_ */
+#endif /* BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_ */
Added: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -0,0 +1,118 @@
+/*
+ * rotating_buffer.hpp
+ *
+ * Created on: May 16, 2011
+ * Author: karsten
+ */
+
+#ifndef ROTATING_BUFFER_HPP_
+#define ROTATING_BUFFER_HPP_
+
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/util/construct.hpp>
+#include <boost/numeric/odeint/util/destruct.hpp>
+#include <boost/numeric/odeint/util/copy.hpp>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< class T , size_t N >
+class rotating_buffer
+{
+public:
+
+ typedef T value_type;
+ const static size_t dim = N;
+
+ rotating_buffer( void )
+ {
+ initialize();
+ }
+
+ rotating_buffer( const rotating_buffer &rb )
+ {
+ initialize();
+ copy( rb );
+ }
+
+ ~rotating_buffer( void )
+ {
+ destroy();
+ }
+
+ rotating_buffer& operator=( const rotating_buffer &rb )
+ {
+ copy( rb );
+ return *this;
+ }
+
+ size_t size( void ) const
+ {
+ return dim;
+ }
+
+ value_type& operator[]( size_t i )
+ {
+ return m_data[ get_index( i ) ];
+ }
+
+ const value_type& operator[]( size_t i ) const
+ {
+ return m_data[ get_index( i ) ];
+ }
+
+ void rotate( void )
+ {
+ ++m_first;
+ if( m_first == dim ) m_first = 0;
+ }
+
+protected:
+
+ value_type m_data[N];
+
+private:
+
+ void initialize( void )
+ {
+ for( size_t i=0 ; i<N ; ++i )
+ boost::numeric::odeint::construct( m_data[i] );
+ m_first = 0;
+ }
+
+ void copy( const rotating_buffer &rb )
+ {
+ for( size_t i=0 ; i<N ; ++i )
+ boost::numeric::odeint::copy( rb[i] , m_data[i] );
+ }
+
+ void destroy( void )
+ {
+ for( size_t i=0 ; i<N ; ++i )
+ boost::numeric::odeint::destruct( m_data[i] );
+ }
+
+ size_t get_index( size_t i ) const
+ {
+ return ( ( i + m_first ) % dim );
+ }
+
+ size_t m_first;
+
+};
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+#endif /* BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_ */
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/stepper_categories.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/stepper_categories.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/stepper_categories.hpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -24,8 +24,8 @@
*/
struct stepper_tag {};
-struct explicit_stepper_tag : stepper_tag {};
-//struct implicit_stepper_tag : stepper_tag {};
+// struct explicit_stepper_tag : stepper_tag {};
+// struct implicit_stepper_tag : stepper_tag {};
struct error_stepper_tag {};
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-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -28,6 +28,7 @@
[ run stepper_with_ranges.cpp ]
[ run rosenbrock4.cpp ]
[ run is_pair.cpp ]
+ [ run adams_bashforth.cpp ]
[ run adams_bashforth_moulton.cpp ]
: <testing.launcher>valgrind
;
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -0,0 +1,127 @@
+/* Boost check_implicit_euler.cpp test file
+
+ Copyright 2009 Karsten Ahnert
+ Copyright 2009 Mario Mulansky
+
+ This file tests the use of the euler stepper
+
+ 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_adams_bashforth
+
+#include <utility>
+
+#include <boost/array.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp>
+#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp>
+#include <boost/numeric/odeint/stepper/adams_bashforth.hpp>
+
+using namespace boost::unit_test;
+using namespace boost::numeric::odeint;
+
+typedef double value_type;
+
+struct lorenz
+{
+ template< class State , class Deriv , class Value >
+ void operator()( const State &_x , Deriv &_dxdt , const Value &dt ) const
+ {
+ const value_type sigma = 10.0;
+ const value_type R = 28.0;
+ const value_type b = 8.0 / 3.0;
+
+ typename boost::range_iterator< const State >::type x = boost::begin( _x );
+ typename boost::range_iterator< Deriv >::type dxdt = boost::begin( _dxdt );
+
+ dxdt[0] = sigma * ( x[1] - x[0] );
+ dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
+ dxdt[2] = x[0]*x[1] - b * x[2];
+ }
+};
+
+BOOST_AUTO_TEST_SUITE( adams_bashforth_test )
+
+BOOST_AUTO_TEST_CASE( test_adams_bashforth_coefficients )
+{
+ detail::adams_bashforth_coefficients< value_type , 1 > c1;
+ detail::adams_bashforth_coefficients< value_type , 2 > c2;
+ detail::adams_bashforth_coefficients< value_type , 3 > c3;
+ detail::adams_bashforth_coefficients< value_type , 4 > c4;
+ detail::adams_bashforth_coefficients< value_type , 5 > c5;
+ detail::adams_bashforth_coefficients< value_type , 6 > c6;
+ detail::adams_bashforth_coefficients< value_type , 7 > c7;
+ detail::adams_bashforth_coefficients< value_type , 8 > c8;
+}
+
+BOOST_AUTO_TEST_CASE( test_rotating_buffer )
+{
+ const size_t N = 5;
+ detail::rotating_buffer< size_t , N > buffer;
+ for( size_t i=0 ; i<N ; ++i ) buffer[i] = i;
+
+ for( size_t i=0 ; i<N ; ++i )
+ BOOST_CHECK_EQUAL( buffer[i] , i );
+
+ buffer.rotate();
+
+ for( size_t i=0 ; i<N-1 ; ++i )
+ BOOST_CHECK_EQUAL( buffer[i] , i + 1 );
+ BOOST_CHECK_EQUAL( buffer[N-1] , size_t( 0 ) );
+}
+
+BOOST_AUTO_TEST_CASE( test_copying )
+{
+ typedef boost::array< double , 1 > state_type;
+ typedef adams_bashforth< 2 , state_type > stepper_type;
+
+ stepper_type s1;
+ s1.step_storage()[0][0] = 1.5;
+ s1.step_storage()[1][0] = 2.25;
+
+ stepper_type s2( s1 );
+ BOOST_CHECK_CLOSE( s1.step_storage()[0][0] , s2.step_storage()[0][0] , 1.0e-14 );
+ BOOST_CHECK_CLOSE( s1.step_storage()[1][0] , s2.step_storage()[1][0] , 1.0e-14 );
+ BOOST_CHECK( ( &(s1.step_storage()[0]) ) != ( &(s2.step_storage()[0]) ) );
+
+ stepper_type s3;
+ state_type *p1 = &( s3.step_storage()[0] ) , *p2 = &( s3.step_storage()[1] );
+ s3 = s1;
+ BOOST_CHECK( p1 == ( &( s3.step_storage()[0] ) ) );
+ BOOST_CHECK( p2 == ( &( s3.step_storage()[1] ) ) );
+
+ BOOST_CHECK_CLOSE( s1.step_storage()[0][0] , s3.step_storage()[0][0] , 1.0e-14 );
+ BOOST_CHECK_CLOSE( s1.step_storage()[1][0] , s3.step_storage()[1][0] , 1.0e-14 );
+}
+
+BOOST_AUTO_TEST_CASE( test_instantiation )
+{
+ typedef boost::array< double , 3 > state_type;
+ adams_bashforth< 1 , state_type > s1;
+ adams_bashforth< 2 , state_type > s2;
+ adams_bashforth< 3 , state_type > s3;
+ adams_bashforth< 4 , state_type > s4;
+ adams_bashforth< 5 , state_type > s5;
+ adams_bashforth< 6 , state_type > s6;
+ adams_bashforth< 7 , state_type > s7;
+ adams_bashforth< 8 , state_type > s8;
+
+ state_type x = {{ 10.0 , 10.0 , 10.0 }};
+ value_type t = 0.0 , dt = 0.01;
+ s1.do_step( lorenz() , x , t , dt );
+ s2.do_step( lorenz() , x , t , dt );
+ s3.do_step( lorenz() , x , t , dt );
+ s4.do_step( lorenz() , x , t , dt );
+ s5.do_step( lorenz() , x , t , dt );
+ s6.do_step( lorenz() , x , t , dt );
+ s7.do_step( lorenz() , x , t , dt );
+ s8.do_step( lorenz() , x , t , dt );
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth_moulton.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth_moulton.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth_moulton.cpp 2011-05-17 14:22:49 EDT (Tue, 17 May 2011)
@@ -16,8 +16,6 @@
#include <boost/test/unit_test.hpp>
-#include <boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp>
-#include <boost/numeric/odeint/stepper/adams_bashforth.hpp>
#include <boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp>
using namespace boost::unit_test;
@@ -27,17 +25,9 @@
BOOST_AUTO_TEST_SUITE( adams_bashforth_moulton_test )
-BOOST_AUTO_TEST_CASE( test_adams_bashforth_coefficients )
+BOOST_AUTO_TEST_CASE( test_dummy )
{
- detail::adams_bashforth_coefficients< value_type , 1 > c1;
- detail::adams_bashforth_coefficients< value_type , 2 > c2;
- detail::adams_bashforth_coefficients< value_type , 3 > c3;
- detail::adams_bashforth_coefficients< value_type , 4 > c4;
- detail::adams_bashforth_coefficients< value_type , 5 > c5;
- detail::adams_bashforth_coefficients< value_type , 6 > c6;
- detail::adams_bashforth_coefficients< value_type , 7 > c7;
- detail::adams_bashforth_coefficients< value_type , 8 > c8;
-}
+}
BOOST_AUTO_TEST_SUITE_END()
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