fixed problems in testcases

This commit is contained in:
Valentin Hartmann 2017-06-21 21:32:18 +02:00
parent 073e1e0143
commit 079f3ffa4d
2 changed files with 13 additions and 35 deletions

View File

@ -7,6 +7,7 @@
#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;
@ -26,41 +27,17 @@ typedef double value_type;
BOOST_AUTO_TEST_SUITE( controlled_adams_bashforth_moulton_test )
BOOST_AUTO_TEST_CASE( test_copy )
{
controlled_adams_bashforth_moulton<3, state_type> s1;
state_type deriv = {{1.0}};
s1.coeff().step(deriv, 0.0);
s1.coeff().confirm();
s1.coeff().step(deriv, 1.0);
s1.coeff().confirm();
s1.coeff().step(deriv, 2.0);
s1.coeff().confirm();
controlled_adams_bashforth_moulton<3, state_type> s2(s1);
BOOST_CHECK_CLOSE(s2.coeff().m_ss[0][0].m_v[0], s1.coeff().m_ss[0][0].m_v[0], 1e-14);
BOOST_CHECK_CLOSE(s2.coeff().m_ss[1][0].m_v[0], s1.coeff().m_ss[1][0].m_v[0], 1e-14);
BOOST_CHECK((&(s2.coeff().m_ss[0]) != &(s1.coeff().m_ss[0])));
controlled_adams_bashforth_moulton<3, state_type> s3;
s3 = s1;
BOOST_CHECK_CLOSE(s3.coeff().m_ss[0][0].m_v[0], s1.coeff().m_ss[0][0].m_v[0], 1e-14);
BOOST_CHECK_CLOSE(s3.coeff().m_ss[1][0].m_v[0], s1.coeff().m_ss[1][0].m_v[0], 1e-14);
}
BOOST_AUTO_TEST_CASE( test_instantiation )
{
controlled_adams_bashforth_moulton<1, state_type> s1;
controlled_adams_bashforth_moulton<2, state_type> s2;
controlled_adams_bashforth_moulton<3, state_type> s3;
controlled_adams_bashforth_moulton<4, state_type> s4;
controlled_adams_bashforth_moulton<5, state_type> s5;
controlled_adams_bashforth_moulton<6, state_type> s6;
controlled_adams_bashforth_moulton<7, state_type> s7;
controlled_adams_bashforth_moulton<8, state_type> s8;
controlled_adams_bashforth_moulton<9, state_type> s9;
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;

View File

@ -55,6 +55,7 @@
#include <boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp>
#include <boost/numeric/odeint/stepper/adaptive_adams_bashforth.hpp>
#include <boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp>
#include <boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp>
#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
@ -242,8 +243,8 @@ class stepper_methods : public mpl::vector<
bulirsch_stoer< state_type > ,
dense_output_runge_kutta< controlled_runge_kutta< runge_kutta_dopri5< state_type > > >,
adaptive_adams_bashforth<3, state_type>,
controlled_adams_bashforth_moulton<3, state_type, value_type>,
controlled_adams_bashforth_moulton<5, state_type, value_type>
controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<3, state_type, value_type> >,
controlled_adams_bashforth_moulton<adaptive_adams_bashforth_moulton<5, state_type, value_type> >
//bulirsch_stoer_dense_out< state_type >
> { };