/* * nr_rk4_lorenz.cpp * * Copyright 2011 Mario Mulansky * Copyright 2012 Karsten Ahnert * * 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) */ #include #include "rk_performance_test_case.hpp" #include "lorenz.hpp" const size_t dim = 3; typedef boost::array< double , dim > state_type; template< class System , typename T , size_t dim > void rk4_step( const System sys , boost::array< T , dim > &x , const double t , const double dt ) { // fast rk4 implementation adapted from the book 'Numerical Recipes' size_t i; const double hh = dt*0.5; const double h6 = dt/6.0; const double th = t+hh; boost::array< T , dim > dydx , dym , dyt , yt; sys( x , dydx , t ); for( i=0 ; i