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