123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- #ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
- #define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
- #include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
- #include <boost/numeric/odeint/util/resizer.hpp>
- #include <boost/numeric/odeint/algebra/range_algebra.hpp>
- #include <boost/numeric/odeint/algebra/default_operations.hpp>
- #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
- #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
- namespace boost {
- namespace numeric {
- namespace odeint {
- template<
- class State ,
- class Value = double ,
- class Deriv = State ,
- class Time = Value ,
- class Algebra = typename algebra_dispatcher< State >::algebra_type ,
- class Operations = typename operations_dispatcher< State >::operations_type ,
- class Resizer = initially_resizer
- >
- #ifndef DOXYGEN_SKIP
- class euler
- : public explicit_stepper_base<
- euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
- 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
- #else
- class euler : public explicit_stepper_base
- #endif
- {
- public :
- #ifndef DOXYGEN_SKIP
- typedef explicit_stepper_base< euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
- #else
- typedef explicit_stepper_base< euler< ... > , ... > stepper_base_type;
- #endif
- typedef typename stepper_base_type::state_type state_type;
- typedef typename stepper_base_type::value_type value_type;
- typedef typename stepper_base_type::deriv_type deriv_type;
- typedef typename stepper_base_type::time_type time_type;
- typedef typename stepper_base_type::algebra_type algebra_type;
- typedef typename stepper_base_type::operations_type operations_type;
- typedef typename stepper_base_type::resizer_type resizer_type;
- #ifndef DOXYGEN_SKIP
- typedef typename stepper_base_type::stepper_type stepper_type;
- typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
- typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
- #endif
- euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
- { }
- template< class System , class StateIn , class DerivIn , class StateOut >
- void do_step_impl( System /* system */ , const StateIn &in , const DerivIn &dxdt , time_type /* t */ , StateOut &out , time_type dt )
- {
- stepper_base_type::m_algebra.for_each3( out , in , dxdt ,
- typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
- }
- template< class StateOut , class StateIn1 , class StateIn2 >
- 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
- {
- const time_type delta = t - t_old;
- stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v ,
- typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
- }
- template< class StateType >
- void adjust_size( const StateType &x )
- {
- stepper_base_type::adjust_size( x );
- }
- };
-
-
-
-
-
- }
- }
- }
- #endif
|