File: controlled_adams_bashforth_moulton.cpp

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (56 lines) | stat: -rw-r--r-- 2,094 bytes parent folder | download | duplicates (2)
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
#include <boost/config.hpp>
#ifdef BOOST_MSVC
    #pragma warning(disable:4996)
#endif

#define BOOST_TEST_MODULE odeint_controlled_adams_bashforth_moulton

#include <boost/test/unit_test.hpp>

#include <boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp>
#include <boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp>

using namespace boost::unit_test;
using namespace boost::numeric::odeint;

struct const_sys
{
    template< class State , class Deriv , class Value >
    void operator()( const State &x , Deriv &dxdt , const Value &dt ) const
    {
        dxdt[0] = 1;
    }
};

typedef std::array< double , 1 > state_type;
typedef double value_type;

BOOST_AUTO_TEST_SUITE( controlled_adams_bashforth_moulton_test )

BOOST_AUTO_TEST_CASE( test_instantiation )
{
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<1, state_type> > s1;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<2, state_type> > s2;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<3, state_type> > s3;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<4, state_type> > s4;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<5, state_type> > s5;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<6, state_type> > s6;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<7, state_type> > s7;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<8, state_type> > s8;
    controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<9, state_type> > s9;

    state_type x = {{ 10.0 }};
    value_type t = 0.0 , dt = 0.01;

    s1.try_step(const_sys(), x, t, dt);
    s2.try_step(const_sys(), x, t, dt);
    s3.try_step(const_sys(), x, t, dt);
    s4.try_step(const_sys(), x, t, dt);
    s5.try_step(const_sys(), x, t, dt);
    s6.try_step(const_sys(), x, t, dt);
    s7.try_step(const_sys(), x, t, dt);
    s8.try_step(const_sys(), x, t, dt);
    s9.try_step(const_sys(), x, t, dt);
}

BOOST_AUTO_TEST_SUITE_END()