$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r72152 - sandbox/odeint/branches/karsten/libs/numeric/odeint/test
From: mario.mulansky_at_[hidden]
Date: 2011-05-25 01:00:10
Author: mariomulansky
Date: 2011-05-25 01:00:09 EDT (Wed, 25 May 2011)
New Revision: 72152
URL: http://svn.boost.org/trac/boost/changeset/72152
Log:
tests for generic stepper (accuracy to be checked)
Added:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/generic_stepper.cpp   (contents, props changed)
Text files modified: 
   sandbox/odeint/branches/karsten/libs/numeric/odeint/test/Jamfile |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
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-25 01:00:09 EDT (Wed, 25 May 2011)
@@ -30,5 +30,6 @@
          [ run is_pair.cpp ]
          [ run adams_bashforth.cpp ]
          [ run adams_bashforth_moulton.cpp ]
+	 [ run generic_stepper.cpp ]
         : <testing.launcher>valgrind
         ;    
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/generic_stepper.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/generic_stepper.cpp	2011-05-25 01:00:09 EDT (Wed, 25 May 2011)
@@ -0,0 +1,69 @@
+/* Boost generic_stepper.cpp test file
+
+ Copyright 2011 Karsten Ahnert
+ Copyright 2011 Mario Mulansky
+
+ This file tests the use of the generic 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_generic_stepper
+
+#include <utility>
+
+#include <boost/test/unit_test.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_generic_rk.hpp>
+
+#include <boost/array.hpp>
+
+using namespace boost::unit_test;
+using namespace boost::numeric::odeint;
+
+typedef double value_type;
+typedef boost::array< value_type , 2 > state_type;
+
+void sys( const state_type &x , state_type &dxdt , const value_type &t )
+{
+    dxdt[ 0 ] = x[ 0 ] + 2 * x[ 1 ];
+    dxdt[ 1 ] = x[ 1 ];
+}
+
+typedef explicit_generic_rk< 4 , 4 , state_type> stepper_type;
+
+const boost::array< double , 1 > a1 = {{ 0.5 }};
+const boost::array< double , 2 > a2 = {{ 0.0 , 0.5 }};
+const boost::array< double , 3 > a3 = {{ 0.0 , 0.0 , 1.0 }};
+
+const stepper_type::coef_a_type a = fusion::make_vector( a1 , a2 , a3 );
+const stepper_type::coef_b_type b = {{ 1.0/6 , 1.0/3 , 1.0/3 , 1.0/6 }};
+const stepper_type::coef_c_type c = {{ 0.0 , 0.5 , 0.5 , 1.0 }};
+
+BOOST_AUTO_TEST_SUITE( generic_stepper_test )
+
+BOOST_AUTO_TEST_CASE( test_generic_stepper )
+{
+	stepper_type stepper( a , b , c );
+
+	typedef stepper_type::state_type state_type;
+	typedef stepper_type::value_type stepper_value_type;
+	typedef stepper_type::deriv_type deriv_type;
+	typedef stepper_type::time_type time_type;
+
+	state_type x = {{ 0.0 , 1.0 }};
+	
+	stepper.do_step( sys , x , 0.0 , 0.1 );
+
+	/*using std::abs;
+	value_type eps = 1E-12;
+
+	// compare with analytic solution of above system
+	BOOST_CHECK_SMALL( abs( x[0] - 20.0/81.0 ) , eps );
+	BOOST_CHECK_SMALL( abs( x[1] - 10.0/9.0 ) , eps );
+	*/
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file