Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / common / boost / 1.64.0 / include / boost-1_64 / boost / numeric / odeint / stepper / euler.hpp
1 /*
2  [auto_generated]
3  boost/numeric/odeint/stepper/euler.hpp
4
5  [begin_description]
6  Implementation of the classical explicit Euler stepper. This method is really simple and should only
7  be used for demonstration purposes.
8  [end_description]
9
10  Copyright 2010-2013 Karsten Ahnert
11  Copyright 2010-2013 Mario Mulansky
12
13  Distributed under the Boost Software License, Version 1.0.
14  (See accompanying file LICENSE_1_0.txt or
15  copy at http://www.boost.org/LICENSE_1_0.txt)
16  */
17
18
19 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
20 #define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED
21
22
23 #include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
24 #include <boost/numeric/odeint/util/resizer.hpp>
25 #include <boost/numeric/odeint/algebra/range_algebra.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>
29
30 namespace boost {
31 namespace numeric {
32 namespace odeint {
33
34
35 template<
36 class State ,
37 class Value = double ,
38 class Deriv = State ,
39 class Time = Value ,
40 class Algebra = typename algebra_dispatcher< State >::algebra_type ,
41 class Operations = typename operations_dispatcher< State >::operations_type ,
42 class Resizer = initially_resizer
43 >
44 #ifndef DOXYGEN_SKIP
45 class euler
46 : public explicit_stepper_base<
47   euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
48   1 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
49 #else
50 class euler : public explicit_stepper_base
51 #endif
52 {
53 public :
54
55     #ifndef DOXYGEN_SKIP
56     typedef explicit_stepper_base< euler< State , Value , Deriv , Time , Algebra , Operations , Resizer > , 1 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
57     #else
58     typedef explicit_stepper_base< euler< ... > , ... > stepper_base_type;
59     #endif
60     typedef typename stepper_base_type::state_type state_type;
61     typedef typename stepper_base_type::value_type value_type;
62     typedef typename stepper_base_type::deriv_type deriv_type;
63     typedef typename stepper_base_type::time_type time_type;
64     typedef typename stepper_base_type::algebra_type algebra_type;
65     typedef typename stepper_base_type::operations_type operations_type;
66     typedef typename stepper_base_type::resizer_type resizer_type;
67
68     #ifndef DOXYGEN_SKIP
69     typedef typename stepper_base_type::stepper_type stepper_type;
70     typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
71     typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
72     #endif 
73
74
75     euler( const algebra_type &algebra = algebra_type() ) : stepper_base_type( algebra )
76     { }
77
78     template< class System , class StateIn , class DerivIn , class StateOut >
79     void do_step_impl( System /* system */ , const StateIn &in , const DerivIn &dxdt , time_type /* t */ , StateOut &out , time_type dt )
80     {
81         stepper_base_type::m_algebra.for_each3( out , in , dxdt ,
82                 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
83
84     }
85
86     template< class StateOut , class StateIn1 , class StateIn2 >
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
88     {
89         const time_type delta = t - t_old;
90         stepper_base_type::m_algebra.for_each3( x , old_state , stepper_base_type::m_dxdt.m_v ,
91                 typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
92     }
93
94     template< class StateType >
95     void adjust_size( const StateType &x )
96     {
97         stepper_base_type::adjust_size( x );
98     }
99 };
100
101
102
103 /********** DOXYGEN ***********/
104
105 /**
106  * \class euler
107  * \brief An implementation of the Euler method.
108  *
109  * The Euler method is a very simply solver for ordinary differential equations. This method should not be used
110  * for real applications. It is only useful for demonstration purposes. Step size control is not provided but
111  * trivial continuous output is available.
112  * 
113  * This class derives from explicit_stepper_base and inherits its interface via CRTP (current recurring template pattern),
114  * see explicit_stepper_base
115  *
116  * \tparam State The state type.
117  * \tparam Value The value type.
118  * \tparam Deriv The type representing the time derivative of the state.
119  * \tparam Time The time representing the independent variable - the time.
120  * \tparam Algebra The algebra type.
121  * \tparam Operations The operations type.
122  * \tparam Resizer The resizer policy type.
123  */
124
125     /**
126      * \fn euler::euler( const algebra_type &algebra )
127      * \brief Constructs the euler class. This constructor can be used as a default
128      * constructor of the algebra has a default constructor.
129      * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
130      */
131     
132     /**
133      * \fn euler::do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
134      * \brief This method performs one step. The derivative `dxdt` of `in` at the time `t` is passed to the method.
135      * The result is updated out of place, hence the input is in `in` and the output in `out`.
136      * Access to this step functionality is provided by explicit_stepper_base and 
137      * `do_step_impl` should not be called directly.
138      *
139      * \param system The system function to solve, hence the r.h.s. of the ODE. It must fulfill the
140      *               Simple System concept.
141      * \param in The state of the ODE which should be solved. in is not modified in this method
142      * \param dxdt The derivative of x at t.
143      * \param t The value of the time, at which the step should be performed.
144      * \param out The result of the step is written in out.
145      * \param dt The step size.
146      */
147
148
149     /**
150      * \fn euler::calc_state( StateOut &x , time_type t ,  const StateIn1 &old_state , time_type t_old , const StateIn2 &current_state , time_type t_new ) const
151      * \brief This method is used for continuous output and it calculates the state `x` at a time `t` from the 
152      * knowledge of two states `old_state` and `current_state` at time points `t_old` and `t_new`.
153      */
154
155     /**
156      * \fn euler::adjust_size( const StateType &x )
157      * \brief Adjust the size of all temporaries in the stepper manually.
158      * \param x A state from which the size of the temporaries to be resized is deduced.
159      */
160
161 } // odeint
162 } // numeric
163 } // boost
164
165
166 #endif // BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP_INCLUDED