blob: c64496a83a0a730e6870f1435349df046fd39c37 [file] [log] [blame]
Brian Silverman7c33ab22018-08-04 17:14:51 -07001/*
2 [auto_generated]
3 integrate.cpp
4
5 [begin_description]
6 tba.
7 [end_description]
8
9 Copyright 2009-2012 Karsten Ahnert
10 Copyright 2009-2012 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#include <boost/config.hpp>
18#ifdef BOOST_MSVC
19 #pragma warning(disable:4996)
20#endif
21
22#define BOOST_TEST_MODULE odeint_eigen_integrate
23
24#include <boost/numeric/odeint/integrate/integrate.hpp>
25#include <boost/numeric/odeint/external/eigen/eigen.hpp>
26
27#include <boost/test/unit_test.hpp>
28
29#include "dummy_odes.hpp"
30
31
32using namespace boost::unit_test;
33using namespace boost::numeric::odeint;
34
35
36BOOST_AUTO_TEST_SUITE( eigen_integrate )
37
38BOOST_AUTO_TEST_CASE( test_const_sys )
39{
40 typedef Eigen::Matrix< double , 1 , 1 > state_type;
41 state_type x;
42 x[0] = 10.0;
43 double t_start = 0.0 , t_end = 1.0 , dt = 0.1;
44 integrate< double >( constant_system_functor_standard() , x , t_start , t_end , dt );
45 BOOST_CHECK_CLOSE( x[0] , 11.0 , 1.0e-13 );
46}
47
48BOOST_AUTO_TEST_CASE( test_lorenz )
49{
50 typedef Eigen::Matrix< double , 3 , 1 > state_type;
51 state_type x;
52 x[0] = 10.0;
53 x[1] = 10.0;
54 x[2] = 10.0;
55 double t_start = 0.0 , t_end = 1000.0 , dt = 0.1;
56 integrate< double >( lorenz() , x , t_start , t_end , dt );
57
58 std::vector< double > x2( 3 );
59 x2[0] = 10.0;
60 x2[1] = 10.0;
61 x2[2] = 10.0;
62 integrate( lorenz() , x2 , t_start , t_end , dt );
63
64 BOOST_CHECK_CLOSE( x[0] , x2[0] , 1.0e-13 );
65 BOOST_CHECK_CLOSE( x[1] , x2[1] , 1.0e-13 );
66 BOOST_CHECK_CLOSE( x[2] , x2[2] , 1.0e-13 );
67}
68
69BOOST_AUTO_TEST_SUITE_END()