• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  [auto_generated]
3  boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
4 
5  [begin_description]
6  Algebra caller for the Adams Bashforth stepper.
7  [end_description]
8 
9  Copyright 2011-2012 Karsten Ahnert
10  Copyright 2011 Mario Mulansky
11 
12  Distributed under the Boost Software License, Version 1.0.
13  (See accompanying file LICENSE_1_0.txt or
14  copy at http://www.boost.org/LICENSE_1_0.txt)
15  */
16 
17 
18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
20 
21 #include <boost/assert.hpp>
22 
23 
24 namespace boost {
25 namespace numeric {
26 namespace odeint {
27 namespace detail {
28 
29 template< size_t Step , class Algebra , class Operations >
30 struct adams_bashforth_call_algebra;
31 
32 template< class Algebra , class Operations >
33 struct adams_bashforth_call_algebra< 1 , Algebra , Operations >
34 {
35     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra36     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
37     {
38         typedef typename Coefficients::value_type value_type;
39         algebra.for_each3( out , in , steps[0].m_v , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
40     }
41 };
42 
43 
44 template< class Algebra , class Operations >
45 struct adams_bashforth_call_algebra< 2 , Algebra , Operations >
46 {
47     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra48     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
49     {
50         typedef typename Coefficients::value_type value_type;
51         algebra.for_each4( out , in , steps[0].m_v , steps[1].m_v ,
52                 typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
53     }
54 };
55 
56 
57 template< class Algebra , class Operations >
58 struct adams_bashforth_call_algebra< 3 , Algebra , Operations >
59 {
60     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra61     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
62     {
63         typedef typename Coefficients::value_type value_type;
64         algebra.for_each5( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
65                 typename Operations::template scale_sum4< value_type , Time , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
66     }
67 };
68 
69 
70 template< class Algebra , class Operations >
71 struct adams_bashforth_call_algebra< 4 , Algebra , Operations >
72 {
73     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra74     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
75     {
76         typedef typename Coefficients::value_type value_type;
77         algebra.for_each6( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
78                 typename Operations::template scale_sum5< value_type , Time , Time , Time >(
79                         1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
80     }
81 };
82 
83 
84 template< class Algebra , class Operations >
85 struct adams_bashforth_call_algebra< 5 , Algebra , Operations >
86 {
87     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra88     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
89     {
90         typedef typename Coefficients::value_type value_type;
91         algebra.for_each7( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
92                 typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
93                         1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
94     }
95 };
96 
97 
98 template< class Algebra , class Operations >
99 struct adams_bashforth_call_algebra< 6 , Algebra , Operations >
100 {
101     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra102     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
103     {
104         typedef typename Coefficients::value_type value_type;
105         algebra.for_each8( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v ,
106                 typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
107                         1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
108     }
109 };
110 
111 
112 template< class Algebra , class Operations >
113 struct adams_bashforth_call_algebra< 7 , Algebra , Operations >
114 {
115     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra116     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
117     {
118         //BOOST_ASSERT( false ); // not implemented
119         typedef typename Coefficients::value_type value_type;
120         algebra.for_each9( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v ,
121                             typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >(
122                                 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) );
123     }
124 };
125 
126 
127 template< class Algebra , class Operations >
128 struct adams_bashforth_call_algebra< 8 , Algebra , Operations >
129 {
130     template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
operator ()boost::numeric::odeint::detail::adams_bashforth_call_algebra131     void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
132     {
133         //BOOST_ASSERT( false ); // not implemented
134         typedef typename Coefficients::value_type value_type;
135         algebra.for_each10( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v , steps[7].m_v ,
136                              typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >(
137                                  1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) );
138     }
139 };
140 
141 
142 
143 
144 } // detail
145 } // odeint
146 } // numeric
147 } // boost
148 
149 
150 
151 #endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
152