comparison DEPENDENCIES/generic/include/boost/numeric/odeint/stepper/euler.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
5 [begin_description] 5 [begin_description]
6 Implementation of the classical explicit Euler stepper. This method is really simple and should only 6 Implementation of the classical explicit Euler stepper. This method is really simple and should only
7 be used for demonstration purposes. 7 be used for demonstration purposes.
8 [end_description] 8 [end_description]
9 9
10 Copyright 2009-2011 Karsten Ahnert 10 Copyright 2010-2013 Karsten Ahnert
11 Copyright 2009-2011 Mario Mulansky 11 Copyright 2010-2013 Mario Mulansky
12 12
13 Distributed under the Boost Software License, Version 1.0. 13 Distributed under the Boost Software License, Version 1.0.
14 (See accompanying file LICENSE_1_0.txt or 14 (See accompanying file LICENSE_1_0.txt or
15 copy at http://www.boost.org/LICENSE_1_0.txt) 15 copy at http://www.boost.org/LICENSE_1_0.txt)
16 */ 16 */
22 22
23 #include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp> 23 #include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
24 #include <boost/numeric/odeint/util/resizer.hpp> 24 #include <boost/numeric/odeint/util/resizer.hpp>
25 #include <boost/numeric/odeint/algebra/range_algebra.hpp> 25 #include <boost/numeric/odeint/algebra/range_algebra.hpp>
26 #include <boost/numeric/odeint/algebra/default_operations.hpp> 26 #include <boost/numeric/odeint/algebra/default_operations.hpp>
27 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
28 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
27 29
28 namespace boost { 30 namespace boost {
29 namespace numeric { 31 namespace numeric {
30 namespace odeint { 32 namespace odeint {
31 33
33 template< 35 template<
34 class State , 36 class State ,
35 class Value = double , 37 class Value = double ,
36 class Deriv = State , 38 class Deriv = State ,
37 class Time = Value , 39 class Time = Value ,
38 class Algebra = range_algebra , 40 class Algebra = typename algebra_dispatcher< State >::algebra_type ,
39 class Operations = default_operations , 41 class Operations = typename operations_dispatcher< State >::operations_type ,
40 class Resizer = initially_resizer 42 class Resizer = initially_resizer
41 > 43 >
42 #ifndef DOXYGEN_SKIP 44 #ifndef DOXYGEN_SKIP
43 class euler 45 class euler
44 : public explicit_stepper_base< 46 : public explicit_stepper_base<
72 74
73 euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra ) 75 euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
74 { } 76 { }
75 77
76 template< class System , class StateIn , class DerivIn , class StateOut > 78 template< class System , class StateIn , class DerivIn , class StateOut >
77 void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ) 79 void do_step_impl( System /* system */ , const StateIn &in , const DerivIn &dxdt , time_type /* t */ , StateOut &out , time_type dt )
78 { 80 {
79 stepper_base_type::m_algebra.for_each3( out , in , dxdt , 81 stepper_base_type::m_algebra.for_each3( out , in , dxdt ,
80 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) ); 82 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
81 83
82 } 84 }
83 85
84 template< class StateOut , class StateIn1 , class StateIn2 > 86 template< class StateOut , class StateIn1 , class StateIn2 >
85 void calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 &current_state , time_type t_new ) const 87 void calc_state( StateOut &x , time_type t , const StateIn1 &old_state , time_type t_old , const StateIn2 & /*current_state*/ , time_type /* t_new */ ) const
86 { 88 {
87 const time_type delta = t - t_old; 89 const time_type delta = t - t_old;
88 stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v , 90 stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v ,
89 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) ); 91 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
90 } 92 }