1 /*
2 [auto_generated]
3 libs/numeric/odeint/test/dummy_odes.hpp
4
5 [begin_description]
6 tba.
7 [end_description]
8
9 Copyright 2012-2013 Karsten Ahnert
10 Copyright 2013 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 LIBS_NUMERIC_ODEINT_TEST_DUMMY_ODES_HPP_DEFINED
19 #define LIBS_NUMERIC_ODEINT_TEST_DUMMY_ODES_HPP_DEFINED
20
21 #include <boost/fusion/include/at_c.hpp>
22
23
24
25
26
27
28 /*
29 * rhs functors/functions for different state types
30 */
31 struct constant_system_functor_standard
32 {
33 template< class State , class Deriv , class Time >
operator ()constant_system_functor_standard34 void operator()( const State &x , Deriv &dxdt , const Time t ) const
35 {
36 dxdt[0] = 1.0;
37 }
38 };
39
40 struct constant_system_functor_vector_space
41 {
42 template< class State , class Deriv , class Time >
operator ()constant_system_functor_vector_space43 void operator()( const State &x , Deriv &dxdt , const Time t ) const
44 {
45 dxdt = 1.0;
46 }
47 };
48
49 struct constant_system_functor_fusion
50 {
51 template< class State , class Deriv , class Time >
operator ()constant_system_functor_fusion52 void operator()( const State &x , Deriv &dxdt , const Time t ) const
53 {
54 boost::fusion::at_c< 0 >( dxdt ) = boost::fusion::at_c< 0 >( x ) / Time( 1.0 );
55 }
56 };
57
58 struct lorenz
59 {
60 template< typename State , typename Deriv , typename Time >
operator ()lorenz61 void operator()( const State& x , Deriv& dxdt , const Time& t ) const
62 {
63 const Time sigma = 10.0;
64 const Time R = 28.0;
65 const Time b = 8.0 / 3.0;
66 dxdt[0] = sigma * ( x[1] - x[0] );
67 dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
68 dxdt[2] = -b * x[2] + x[0] * x[1];
69 }
70 };
71
72 template< class State , class Deriv , class Time >
constant_system_standard(const State & x,Deriv & dxdt,const Time t)73 void constant_system_standard( const State &x , Deriv &dxdt , const Time t )
74 {
75 dxdt[0] = 1.0;
76 }
77
78 template< class State , class Deriv , class Time >
constant_system_vector_space(const State & x,Deriv & dxdt,const Time t)79 void constant_system_vector_space( const State &x , Deriv &dxdt , const Time t )
80 {
81 dxdt = 1.0;
82 }
83
84 template< class State , class Deriv , class Time >
constant_system_fusion(const State & x,Deriv & dxdt,const Time t)85 void constant_system_fusion( const State &x , Deriv &dxdt , const Time t )
86 {
87 boost::fusion::at_c< 0 >( dxdt ) = boost::fusion::at_c< 0 >( x ) / Time( 1.0 );
88 }
89
90
91
92
93 /*
94 * rhs functors for symplectic steppers
95 */
96 struct constant_mom_func
97 {
98 template< class StateIn , class StateOut >
operator ()constant_mom_func99 void operator()( const StateIn &q , StateOut &dp ) const
100 {
101 dp[0] = 1.0;
102 }
103 };
104
105 struct default_coor_func
106 {
107 template< class StateIn , class StateOut >
operator ()default_coor_func108 void operator()( const StateIn &p , StateOut &dq ) const
109 {
110 dq[0] = p[0];
111 }
112 };
113
114
115
116 struct constant_mom_func_vector_space_1d
117 {
118 template< class T >
operator ()constant_mom_func_vector_space_1d119 void operator()( const T &q , T &dp ) const
120 {
121 dp = 1.0;
122 }
123 };
124
125 struct default_coor_func_vector_space_1d
126 {
127 template< class T >
operator ()default_coor_func_vector_space_1d128 void operator()( const T &p , T &dq ) const
129 {
130 dq = p;
131 }
132 };
133
134
135
136
137
138
139
140 struct empty_system
141 {
142 template <class State >
operator ()empty_system143 void operator()( const State &x , State &dxdt , double t ) const
144 {
145 }
146 };
147
148
149
150
151 #endif // LIBS_NUMERIC_ODEINT_TEST_DUMMY_ODES_HPP_DEFINED
152