blob: 7a92363f6bc7582caef85df3a4377f926ff9b7e7 [file] [log] [blame]
Brian Silverman7c33ab22018-08-04 17:14:51 -07001/*
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 */
31struct constant_system_functor_standard
32{
33 template< class State , class Deriv , class Time >
34 void operator()( const State &x , Deriv &dxdt , const Time t ) const
35 {
36 dxdt[0] = 1.0;
37 }
38};
39
40struct constant_system_functor_vector_space
41{
42 template< class State , class Deriv , class Time >
43 void operator()( const State &x , Deriv &dxdt , const Time t ) const
44 {
45 dxdt = 1.0;
46 }
47};
48
49struct constant_system_functor_fusion
50{
51 template< class State , class Deriv , class Time >
52 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
58struct lorenz
59{
60 template< typename State , typename Deriv , typename Time >
61 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
72template< class State , class Deriv , class Time >
73void constant_system_standard( const State &x , Deriv &dxdt , const Time t )
74{
75 dxdt[0] = 1.0;
76}
77
78template< class State , class Deriv , class Time >
79void constant_system_vector_space( const State &x , Deriv &dxdt , const Time t )
80{
81 dxdt = 1.0;
82}
83
84template< class State , class Deriv , class Time >
85void 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 */
96struct constant_mom_func
97{
98 template< class StateIn , class StateOut >
99 void operator()( const StateIn &q , StateOut &dp ) const
100 {
101 dp[0] = 1.0;
102 }
103};
104
105struct default_coor_func
106{
107 template< class StateIn , class StateOut >
108 void operator()( const StateIn &p , StateOut &dq ) const
109 {
110 dq[0] = p[0];
111 }
112};
113
114
115
116struct constant_mom_func_vector_space_1d
117{
118 template< class T >
119 void operator()( const T &q , T &dp ) const
120 {
121 dp = 1.0;
122 }
123};
124
125struct default_coor_func_vector_space_1d
126{
127 template< class T >
128 void operator()( const T &p , T &dq ) const
129 {
130 dq = p;
131 }
132};
133
134
135
136
137
138
139
140struct empty_system
141{
142 template <class State >
143 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