|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72207 - in sandbox/odeint/branches/karsten: . boost/numeric/odeint/stepper boost/numeric/odeint/stepper/detail libs/numeric/odeint/regression_test libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-05-27 04:46:02
Author: karsten
Date: 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
New Revision: 72207
URL: http://svn.boost.org/trac/boost/changeset/72207
Log:
adams bashforth moulton
Added:
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp (contents, props changed)
sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/adams_bashforth_moulton.cpp (contents, props changed)
Text files modified:
sandbox/odeint/branches/karsten/TODO | 6 +++
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth.hpp | 4 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp | 37 +++++++++++++++++--
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_moulton.hpp | 41 ++++++++++++++++++---
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp | 18 ++++----
sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/Jamfile | 7 +++
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp | 2 -
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_moulton.cpp | 73 ++++++++++-----------------------------
8 files changed, 108 insertions(+), 80 deletions(-)
Modified: sandbox/odeint/branches/karsten/TODO
==============================================================================
--- sandbox/odeint/branches/karsten/TODO (original)
+++ sandbox/odeint/branches/karsten/TODO 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -11,6 +11,8 @@
* include test/thrust in jam system, use system from
* ranges and the integrate functions
* symplectic intergrators and ranges
+ * adams_moulton complete
+ * adams_bashforth_moulton complete
* DOCUMENTATION
* include links to the source of the examples
* use classical citations, via []
@@ -31,6 +33,10 @@
* Documentation
* Tutorials
+* Strategy for values which initializing, resizing etc. if some values change, for example:
+ * dxdt in explicit fsal stepper, if size changes or if time is not appropriate.
+ * the buffer in adams bashforth if dt changes oder the size of x.
+
* UNIT TEST Requirements (NEW):
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-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -135,7 +135,7 @@
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 );
+ detail::adams_bashforth_call_algebra< steps , algebra_type , operations_type >()( in , out , m_step_storage , m_coefficients , dt );
}
template< class System , class StateIn , class StateOut >
@@ -144,7 +144,7 @@
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 );
+ detail::adams_bashforth_call_algebra< steps , algebra_type , operations_type >()( in , out , m_step_storage , m_coefficients , dt );
}
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-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -15,6 +15,9 @@
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/util/size_adjuster.hpp>
+#include <boost/numeric/odeint/stepper/adams_bashforth.hpp>
+#include <boost/numeric/odeint/stepper/adams_moulton.hpp>
+
/*
* # Introduce the number of states
*/
@@ -58,6 +61,9 @@
static const size_t steps = Steps;
+ typedef adams_bashforth< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , adjust_size_policy > adams_bashforth_type;
+ typedef adams_moulton< steps , state_type , value_type , deriv_type , time_type , algebra_type , operations_type , adjust_size_policy > adams_moulton_type;
+
typedef unsigned short order_type;
static const order_type order_value = steps + 1;
@@ -85,36 +91,57 @@
template< class System , class StateInOut >
void do_step( System system , StateInOut &x , const time_type &t , const time_type &dt )
{
- // ToDo : implement
+ m_adams_bashforth.do_step( system , x , t , dt );
+ m_adams_moulton.do_step( system , x , t , dt , m_adams_bashforth.step_storage() );
}
template< class System , class StateInOut >
void do_step( System system , const StateInOut &x , const time_type &t , const time_type &dt )
{
- // ToDo : implement
+ m_adams_bashforth.do_step( system , x , t , dt );
+ m_adams_moulton.do_step( system , x , t , dt , m_adams_bashforth.step_storage() );
}
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 )
{
- // ToDo : implement
+ m_adams_bashforth.do_step( system , in , t , out , dt );
+ m_adams_moulton.do_step( system , out , t , dt , m_adams_bashforth.step_storage() );
}
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 )
{
- // ToDo : implement
+ m_adams_bashforth.do_step( system , in , t , out , dt );
+ m_adams_moulton.do_step( system , out , t , dt , m_adams_bashforth.step_storage() );
}
template< class StateType >
void adjust_size( const StateType &x )
{
+ m_adams_bashforth.adjust_size( x );
+ m_adams_moulton.adjust_size( x );
}
-private:
+ template< class ExplicitStepper , class System , class StateIn >
+ void initialize( ExplicitStepper explicit_stepper , System system , StateIn &x , time_type &t , const time_type &dt )
+ {
+ m_adams_bashforth.initialize( explicit_stepper , system , x , t , dt );
+ }
+
+ template< class System , class StateIn >
+ void initialize( System system , StateIn &x , time_type &t , const time_type &dt )
+ {
+ m_adams_bashforth.initialize( system , x , t , dt );
+ }
+
+private:
+
+ adams_bashforth_type m_adams_bashforth;
+ adams_moulton_type m_adams_moulton;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_moulton.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_moulton.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/adams_moulton.hpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -18,7 +18,7 @@
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/stepper/explicit_rk4.hpp>
-#include <boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp>
+#include <boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp>
#include <boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp>
#include <boost/numeric/odeint/stepper/detail/rotating_buffer.hpp>
@@ -106,23 +106,50 @@
/*
- * Version 1 : do_step( system , x , t , dt );
+ * Version 1 : do_step( system , x , t , dt , buf );
*
* solves the forwarding problem
*/
+ template< class System , class StateInOut , class ABBuf >
+ void do_step( System system , StateInOut &in , const time_type &t , const time_type &dt , const ABBuf &buf )
+ {
+ do_step( system , in , t , in , dt , buf );
+ }
+
+ template< class System , class StateInOut , class ABBuf >
+ void do_step( System system , const StateInOut &in , const time_type &t , const time_type &dt , const ABBuf &buf )
+ {
+ do_step( system , in , t , in , dt , buf );
+ }
+
+
+
+ /*
+ * Version 2 : do_step( system , in , t , out , dt , buf );
+ *
+ * solves the forwarding problem
+ */
+ template< class System , class StateIn , class StateOut , class ABBuf >
+ void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt , const ABBuf &buf )
+ {
+ typename boost::unwrap_reference< System >::type &sys = system;
+ m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ sys( in , m_dxdt , t );
+ detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( in , out , m_dxdt , buf , m_coefficients , dt );
+ }
+
template< class System , class StateIn , class StateOut , class ABBuf >
- void do_step( System system , const StateIn &in , const StateOut &out , const time_type &t , const ABBuf &buf )
+ void do_step( System system , const StateIn &in , const time_type &t , const StateOut &out , const time_type &dt , const ABBuf &buf )
{
typename boost::unwrap_reference< System >::type &sys = system;
-
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
-
sys( in , m_dxdt , t );
-
- // detail::call_algebra< steps , algebra_type , operations_type >()( in , out , buf , m_coefficients , dt );
+ detail::adams_moulton_call_algebra< steps , algebra_type , operations_type >()( in , out , m_dxdt , buf , m_coefficients , dt );
}
+
+
template< class StateType >
void adjust_size( const StateType &x )
{
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -17,10 +17,10 @@
namespace detail {
template< size_t Step , class Algebra , class Operations >
-struct call_algebra;
+struct adams_bashforth_call_algebra;
template< class Algebra , class Operations >
-struct call_algebra< 1 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 1 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -32,7 +32,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 2 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 2 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -45,7 +45,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 3 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 3 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -58,7 +58,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 4 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 4 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -72,7 +72,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 5 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 5 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -86,7 +86,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 6 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 6 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -100,7 +100,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 7 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 7 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
@@ -115,7 +115,7 @@
template< class Algebra , class Operations >
-struct call_algebra< 8 , Algebra , Operations >
+struct adams_bashforth_call_algebra< 8 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
Added: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -0,0 +1,133 @@
+/*
+ * adams_moulton_coefficients.hpp
+ *
+ * Created on: May 15, 2011
+ * Author: karsten
+ */
+
+#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_
+#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_
+
+#include <cassert>
+
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+namespace detail {
+
+template< size_t Step , class Algebra , class Operations >
+struct adams_moulton_call_algebra;
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 1 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each3( out , in , dxdt , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 2 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each4( out , in , dxdt , steps[0] ,
+ typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 3 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each5( out , in , dxdt , steps[0] , steps[1] ,
+ typename Operations::template scale_sum4< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 4 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each6( out , in , dxdt , steps[0] , steps[1] , steps[2] ,
+ typename Operations::template scale_sum5< value_type , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 5 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each7( out , in , dxdt , steps[0] , steps[1] , steps[2] , steps[3] ,
+ typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 6 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ typedef typename Coefficients::value_type value_type;
+ Algebra::for_each8( out , in , dxdt , steps[0] , steps[1] , steps[2] , steps[3] , steps[4] ,
+ typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
+ 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 7 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ assert( false ); // not implemented
+ }
+};
+
+
+template< class Algebra , class Operations >
+struct adams_moulton_call_algebra< 8 , Algebra , Operations >
+{
+ template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
+ void operator()( const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , const Time &dt ) const
+ {
+ assert( false ); // not implemented
+ }
+};
+
+
+
+
+} // detail
+} // odeint
+} // numeric
+} // boost
+
+
+
+#endif /* BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_ */
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/Jamfile 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -40,4 +40,9 @@
exe adams_bashforth
: adams_bashforth.cpp
- ;
\ No newline at end of file
+ ;
+
+exe adams_bashforth_moulton
+ : adams_bashforth_moulton.cpp
+ ;
+
\ No newline at end of file
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/adams_bashforth_moulton.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/regression_test/adams_bashforth_moulton.cpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -0,0 +1,63 @@
+/*
+ * adams_bashforth.cpp
+ *
+ * Created on: May 18, 2011
+ * Author: karsten
+ */
+
+#include <ostream>
+#include <iostream>
+
+#include <boost/array.hpp>
+#include <boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp>
+#include <boost/numeric/odeint/integrate/integrate_n_steps.hpp>
+
+using namespace std;
+using namespace boost::numeric::odeint;
+
+typedef double value_type;
+typedef boost::array< value_type , 3 > state_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];
+ }
+};
+
+struct writing_observer
+{
+ std::ostream &m_out;
+ writing_observer( std::ostream &out ) : m_out( out ) { }
+
+ template< class State , class Value >
+ void operator()( const State &x , const Value &t )
+ {
+ m_out << t << "\t" << x[0] << "\t" << x[1] << "\t" << x[2] << "\n";
+ }
+};
+
+
+int main( int argc , char **argv )
+{
+ state_type x = {{ 10.0 , 10.0 , 10.0 }};
+
+ const double dt = 0.01;
+ double t = 0.0;
+
+ adams_bashforth_moulton< 3 , state_type > stepper;
+ stepper.initialize( lorenz() , x , t , dt );
+
+ integrate_n_steps( stepper , lorenz() , x , t , dt , 1000 , writing_observer( cout ) );
+}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_bashforth.cpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -23,8 +23,6 @@
#include <boost/mpl/range_c.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;
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_moulton.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_moulton.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/adams_moulton.cpp 2011-05-27 04:45:57 EDT (Fri, 27 May 2011)
@@ -49,38 +49,14 @@
BOOST_AUTO_TEST_CASE( test_adams_moulton_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_copying )
-{
- typedef boost::array< double , 1 > state_type;
- typedef adams_moulton< 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 );
+ detail::adams_moulton_coefficients< value_type , 1 > c1;
+ detail::adams_moulton_coefficients< value_type , 2 > c2;
+ detail::adams_moulton_coefficients< value_type , 3 > c3;
+ detail::adams_moulton_coefficients< value_type , 4 > c4;
+ detail::adams_moulton_coefficients< value_type , 5 > c5;
+ detail::adams_moulton_coefficients< value_type , 6 > c6;
+ detail::adams_moulton_coefficients< value_type , 7 > c7;
+ detail::adams_moulton_coefficients< value_type , 8 > c8;
}
typedef boost::mpl::range_c< size_t , 1 , 6 > vector_of_steps;
@@ -94,35 +70,24 @@
// state_type x = {{ 10.0 , 10.0 , 10.0 }};
// const value_type dt = 0.01;
// value_type t = 0.0;
-//
-// stepper.initialize( lorenz() , x , t , dt );
-// BOOST_CHECK_CLOSE( t , value_type( steps - 1 ) * dt , 1.0e-14 );
-//
+
// stepper.do_step( lorenz() , x , t , dt );
}
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;
-//
+ typedef boost::array< double , 3 > state_type;
+ adams_moulton< 1 , state_type > s1;
+ adams_moulton< 2 , state_type > s2;
+ adams_moulton< 3 , state_type > s3;
+ adams_moulton< 4 , state_type > s4;
+ adams_moulton< 5 , state_type > s5;
+ adams_moulton< 6 , state_type > s6;
+ adams_moulton< 7 , state_type > s7;
+ adams_moulton< 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-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