2 * rk_performance_test_case.hpp
4 * Copyright 2011-2012 Mario Mulansky
5 * Copyright 2012 Karsten Ahnert
7 * Distributed under the Boost Software License, Version 1.0.
8 * (See accompanying file LICENSE_1_0.txt or
9 * copy at http://www.boost.org/LICENSE_1_0.txt)
14 #include <boost/accumulators/accumulators.hpp>
15 #include <boost/accumulators/statistics.hpp>
16 #include <boost/timer.hpp>
21 using namespace boost::accumulators;
23 typedef accumulator_set<
24 double , stats< tag::mean , tag::variance >
27 ostream& operator<<( ostream& out , accumulator_type &acc )
29 out << boost::accumulators::mean( acc ) << tab;
30 // out << boost::accumulators::variance( acc ) << tab;
34 typedef boost::timer timer_type;
37 template< class Stepper >
38 void run( Stepper &stepper , const size_t num_of_steps = 20000000 , const double dt = 1E-10 )
40 const size_t loops = 20;
48 //stepper.reset_init_cond( );
49 //for( size_t i = 0 ; i < num_of_steps ; ++i )
50 // stepper.do_step( dt );
52 for( size_t n=0 ; n<loops+1 ; ++n )
54 stepper.reset_init_cond( );
57 for( size_t i = 0 ; i < num_of_steps ; ++i )
58 stepper.do_step( dt );
60 { // take first run as transient
64 clog << acc << " " << stepper.state(0) << endl;