stepper_copying.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. /*
  2. [auto_generated]
  3. libs/numeric/odeint/test/stepper_copying.cpp
  4. [begin_description]
  5. This file tests the copying of the steppers.
  6. [end_description]
  7. Copyright 2011-2012 Karsten Ahnert
  8. Copyright 2011-2012 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. // disable checked iterator warning for msvc
  14. #include <boost/config.hpp>
  15. #ifdef BOOST_MSVC
  16. #pragma warning(disable:4996)
  17. #endif
  18. #define BOOST_TEST_MODULE odeint_stepper_copying
  19. #include <boost/test/unit_test.hpp>
  20. #include <boost/type_traits/integral_constant.hpp>
  21. //#include <boost/numeric/odeint/util/construct.hpp>
  22. //#include <boost/numeric/odeint/util/destruct.hpp>
  23. #include <boost/numeric/odeint/util/copy.hpp>
  24. #include <boost/numeric/odeint/util/state_wrapper.hpp>
  25. #include <boost/numeric/odeint/stepper/euler.hpp>
  26. #include <boost/numeric/odeint/stepper/runge_kutta4_classic.hpp>
  27. #include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
  28. #include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp>
  29. #include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp>
  30. #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
  31. #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
  32. #include <boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp>
  33. template< class T , size_t Dim >
  34. class test_array
  35. {
  36. public:
  37. const static size_t dim = Dim;
  38. typedef T value_type;
  39. typedef value_type* iterator;
  40. typedef const value_type* const_iterator;
  41. value_type& operator[]( size_t i )
  42. {
  43. return m_data[i];
  44. }
  45. const value_type& operator[]( size_t i ) const
  46. {
  47. return m_data[i];
  48. }
  49. iterator begin( void )
  50. {
  51. return m_data;
  52. }
  53. iterator end( void )
  54. {
  55. return m_data + dim;
  56. }
  57. const_iterator begin( void ) const
  58. {
  59. return m_data;
  60. }
  61. const_iterator end( void ) const
  62. {
  63. return m_data + dim;
  64. }
  65. private:
  66. value_type m_data[dim];
  67. };
  68. template< class T , size_t Dim >
  69. class test_array2 : public test_array< T , Dim >
  70. {
  71. };
  72. /*
  73. * Explicit testing if copying was successful is difficult,
  74. * hence we only test if the number of copy operations is right.
  75. *
  76. * Otherwise one has to prepare the states.
  77. */
  78. size_t construct_count = 0;
  79. size_t construct2_count = 0;
  80. size_t destruct_count = 0;
  81. size_t destruct2_count = 0;
  82. size_t copy_count = 0;
  83. size_t copy2_count = 0;
  84. void reset_counter( void )
  85. {
  86. construct_count = 0;
  87. construct2_count = 0;
  88. destruct_count = 0;
  89. destruct2_count = 0;
  90. copy_count = 0;
  91. copy2_count = 0;
  92. }
  93. namespace boost { namespace numeric { namespace odeint {
  94. //provide the state_wrapper
  95. template< class T , size_t Dim >
  96. struct state_wrapper< test_array< T , Dim > >
  97. {
  98. typedef state_wrapper< test_array< T , Dim > > state_wrapper_type;
  99. typedef test_array< T , Dim > state_type;
  100. typedef T value_type;
  101. state_type m_v;
  102. state_wrapper() : m_v()
  103. {
  104. construct_count++;
  105. }
  106. state_wrapper( const state_type &v ) : m_v( v )
  107. {
  108. construct_count++;
  109. copy_count++;
  110. }
  111. state_wrapper( const state_wrapper_type &x ) : m_v( x.m_v )
  112. {
  113. construct_count++;
  114. copy_count++;
  115. }
  116. state_wrapper_type& operator=( const state_wrapper_type &x )
  117. {
  118. copy_count++;
  119. return *this;
  120. }
  121. ~state_wrapper()
  122. {
  123. destruct_count++;
  124. }
  125. };
  126. //provide the state_wrapper
  127. template< class T , size_t Dim >
  128. struct state_wrapper< test_array2< T , Dim > >
  129. {
  130. typedef state_wrapper< test_array2< T , Dim > > state_wrapper_type;
  131. typedef test_array2< T , Dim > state_type;
  132. typedef T value_type;
  133. state_type m_v;
  134. state_wrapper() : m_v()
  135. {
  136. construct2_count++;
  137. }
  138. state_wrapper( const state_type &v ) : m_v( v )
  139. {
  140. construct2_count++;
  141. copy2_count++;
  142. }
  143. state_wrapper( const state_wrapper_type &x ) : m_v( x.m_v )
  144. {
  145. construct2_count++;
  146. copy2_count++;
  147. }
  148. state_wrapper_type& operator=( const state_wrapper_type &x )
  149. {
  150. copy2_count++;
  151. return *this;
  152. }
  153. ~state_wrapper()
  154. {
  155. destruct2_count++;
  156. }
  157. };
  158. } } }
  159. typedef test_array< double , 3 > state_type;
  160. typedef test_array2< double , 3 > deriv_type;
  161. typedef boost::numeric::odeint::euler< state_type , double , deriv_type > euler_type;
  162. typedef boost::numeric::odeint::runge_kutta4_classic< state_type , double , deriv_type > rk4_type;
  163. typedef boost::numeric::odeint::runge_kutta4< state_type , double , deriv_type > rk4_generic_type;
  164. typedef boost::numeric::odeint::runge_kutta_cash_karp54_classic< state_type , double , deriv_type > rk54_type;
  165. typedef boost::numeric::odeint::runge_kutta_cash_karp54< state_type , double , deriv_type > rk54_generic_type;
  166. typedef boost::numeric::odeint::runge_kutta_dopri5< state_type , double , deriv_type > dopri5_type;
  167. typedef boost::numeric::odeint::controlled_runge_kutta< rk54_type > controlled_rk54_type;
  168. typedef boost::numeric::odeint::controlled_runge_kutta< rk54_generic_type > controlled_rk54_generic_type;
  169. typedef boost::numeric::odeint::controlled_runge_kutta< dopri5_type > controlled_dopri5_type;
  170. typedef boost::numeric::odeint::dense_output_runge_kutta< euler_type > dense_output_euler_type;
  171. typedef boost::numeric::odeint::dense_output_runge_kutta< controlled_dopri5_type > dense_output_dopri5_type;
  172. #define CHECK_COUNTERS( c1 , c2 , c3 , c4 , c5 , c6 ) \
  173. BOOST_CHECK_EQUAL( construct_count , size_t( c1 ) ); \
  174. BOOST_CHECK_EQUAL( construct2_count , size_t( c2 ) ); \
  175. BOOST_CHECK_EQUAL( destruct_count , size_t( c3 ) ); \
  176. BOOST_CHECK_EQUAL( destruct2_count , size_t( c4) ); \
  177. BOOST_CHECK_EQUAL( copy_count , size_t( c5 ) ) ; \
  178. BOOST_CHECK_EQUAL( copy2_count, size_t( c6 ) )
  179. BOOST_AUTO_TEST_SUITE( stepper_copying )
  180. /*
  181. * Construct + Destruct
  182. * 1 deriv_type in explicit_stepper_base
  183. */
  184. BOOST_AUTO_TEST_CASE( explicit_euler_construct )
  185. {
  186. reset_counter();
  187. {
  188. euler_type euler;
  189. }
  190. CHECK_COUNTERS( 0 , 1 , 0 , 1 , 0 , 0 );
  191. }
  192. /*
  193. * Construct + Destruct
  194. * 2 * 1 deriv_type in explicit_stepper_base
  195. *
  196. * Copying
  197. * 1 deriv_type in explicit_stepper_base
  198. */
  199. BOOST_AUTO_TEST_CASE( explicit_euler_copy_construct )
  200. {
  201. reset_counter();
  202. {
  203. euler_type euler;
  204. euler_type euler2( euler );
  205. }
  206. CHECK_COUNTERS( 0 , 1 + 1 , 0 , 1 + 1 , 0 , 1 );
  207. }
  208. /*
  209. * Construct + Destruct
  210. * 2 * 1 deriv_type in explicit_stepper_base
  211. *
  212. * Copying
  213. * 1 deriv_type in explicit_stepper_base
  214. */
  215. BOOST_AUTO_TEST_CASE( explicit_euler_assign )
  216. {
  217. reset_counter();
  218. {
  219. euler_type euler;
  220. euler_type euler2;
  221. euler2 = euler;
  222. }
  223. CHECK_COUNTERS( 0 , 2 , 0 , 2 , 0 , 1 );
  224. }
  225. /*
  226. * Construct + Destruct
  227. * 1 deriv_type in explicit_stepper_base
  228. * 3 deriv_type in explicit_rk4
  229. * 1 state_type in explicit_rk4
  230. */
  231. BOOST_AUTO_TEST_CASE( explicit_rk4_construct )
  232. {
  233. reset_counter();
  234. {
  235. rk4_type rk4;
  236. }
  237. CHECK_COUNTERS( 1 , 4 , 1 , 4 , 0 , 0 );
  238. }
  239. /*
  240. * Construct + Destruct
  241. * 2 * 1 deriv_type in explicit_stepper_base
  242. * 2 * 3 deriv_type in explicit_rk4
  243. * 2 * 1 state_type in explicit_rk4
  244. *
  245. * Copying
  246. * 1 deriv_type in explicit_stepper_base
  247. * 3 deriv_type in explicit_stepper_base
  248. * 1 state_type in explicit_stepper_base
  249. */
  250. BOOST_AUTO_TEST_CASE( explicit_rk4_copy_construct )
  251. {
  252. reset_counter();
  253. {
  254. rk4_type rk4;
  255. rk4_type rk4_2( rk4 );
  256. }
  257. CHECK_COUNTERS( 2 , 8 , 2 , 8 , 1 , 4 );
  258. }
  259. /*
  260. * Construct + Destruct
  261. * 2 * 1 deriv_type in explicit_stepper_base
  262. * 2 * 3 deriv_type in explicit_rk4
  263. * 2 * 1 state_type in explicit_rk4
  264. *
  265. * Copying
  266. * 1 deriv_type in explicit_stepper_base
  267. * 3 deriv_type in explicit_stepper_base
  268. * 1 state_type in explicit_stepper_base
  269. */
  270. BOOST_AUTO_TEST_CASE( explicit_rk4_assign )
  271. {
  272. reset_counter();
  273. {
  274. rk4_type rk4;
  275. rk4_type rk4_2;
  276. rk4 = rk4_2;
  277. }
  278. CHECK_COUNTERS( 2 , 8 , 2 , 8 , 1 , 4 );
  279. }
  280. /*
  281. * Construct + Destruct
  282. * 1 deriv_type in explicit_stepper_base
  283. * 3 deriv_type in explicit_rk4
  284. * 1 state_type in explicit_rk4
  285. */
  286. BOOST_AUTO_TEST_CASE( explicit_rk4_generic_construct )
  287. {
  288. reset_counter();
  289. {
  290. rk4_generic_type rk4;
  291. }
  292. CHECK_COUNTERS( 1 , 4 , 1 , 4 , 0 , 0 );
  293. }
  294. /*
  295. * Construct + Destruct
  296. * 2 * 1 deriv_type in explicit_stepper_base
  297. * 2 * 3 deriv_type in explicit_rk4
  298. * 2 * 1 state_type in explicit_rk4
  299. *
  300. * Copying
  301. * 1 deriv_type in explicit_stepper_base
  302. * 3 deriv_type in explicit_stepper_base
  303. * 1 state_type in explicit_stepper_base
  304. */
  305. BOOST_AUTO_TEST_CASE( explicit_rk4_generic_copy_construct )
  306. {
  307. reset_counter();
  308. {
  309. rk4_generic_type rk4;
  310. rk4_generic_type rk4_2( rk4 );
  311. }
  312. CHECK_COUNTERS( 2 , 8 , 2 , 8 , 1 , 4 );
  313. }
  314. /*
  315. * Construct + Destruct
  316. * 2 * 1 deriv_type in explicit_stepper_base
  317. * 2 * 3 deriv_type in explicit_rk4
  318. * 2 * 1 state_type in explicit_rk4
  319. *
  320. * Copying
  321. * 1 deriv_type in explicit_stepper_base
  322. * 3 deriv_type in explicit_stepper_base
  323. * 1 state_type in explicit_stepper_base
  324. */
  325. BOOST_AUTO_TEST_CASE( explicit_rk4_generic_assign )
  326. {
  327. reset_counter();
  328. {
  329. rk4_generic_type rk4;
  330. rk4_generic_type rk4_2;
  331. rk4 = rk4_2;
  332. }
  333. CHECK_COUNTERS( 2 , 8 , 2 , 8 , 1 , 4 );
  334. }
  335. /*
  336. * Construct + Destruct
  337. * 2 explicit_rk54_ck:
  338. * 2 * 1 deriv_type in explicit_error_stepper_base
  339. * 2 * 5 deriv_type in explicit_error_rk54_ck
  340. * 2 * 1 state_type in explicit_error_rk4
  341. * 1 controlled_stepper:
  342. * 1 deriv_type
  343. * 2 state_type
  344. *
  345. * Copying
  346. * 1 copy process of explicit_rk54_ck:
  347. * 1 deriv_type from explicit_error_stepper_base
  348. * 5 deriv_type from explicit_error_rk54_ck
  349. * 1 state_type from explicit_error_rk54_ck
  350. */
  351. BOOST_AUTO_TEST_CASE( controlled_rk54_construct )
  352. {
  353. reset_counter();
  354. {
  355. controlled_rk54_type stepper;
  356. }
  357. CHECK_COUNTERS( 4 , 13 , 4 , 13 , 1 , 6 );
  358. }
  359. /*
  360. * Construct + Destruct
  361. * 3 explicit_rk54_ck:
  362. * 3 * 1 deriv_type in explicit_error_stepper_base
  363. * 3 * 5 deriv_type in explicit_error_rk54_ck
  364. * 3 * 1 state_type in explicit_error_rk4
  365. * 2 controlled_stepper:
  366. * 2 * 1 deriv_type
  367. * 2 * 2 state_type
  368. *
  369. * Copying
  370. * 1 copy process of explicit_rk54_ck:
  371. * 1 deriv_type from explicit_error_stepper_base
  372. * 5 deriv_type from explicit_error_rk54_ck
  373. * 1 state_type from explicit_error_rk54_ck
  374. *
  375. * 1 process of copying controlled_error_stepper
  376. * 1 deriv_type from explicit_error_stepper_base
  377. * 5 deriv_type from explicit_error_rk54_ck
  378. * 1 state_type from explicit_error_rk54_ck
  379. * 1 deriv_type from controlled_error_stepper
  380. * 2 state_type from controlled_error_stepper
  381. */
  382. BOOST_AUTO_TEST_CASE( controlled_rk54_copy_construct )
  383. {
  384. reset_counter();
  385. {
  386. controlled_rk54_type stepper;
  387. controlled_rk54_type stepper2( stepper );
  388. }
  389. CHECK_COUNTERS( 7 , 20 , 7 , 20 , 4 , 13 );
  390. }
  391. /*
  392. * Construct + Destruct
  393. * 4 explicit_rk54_ck:
  394. * 4 * 1 deriv_type in explicit_error_stepper_base
  395. * 4 * 5 deriv_type in explicit_error_rk54_ck
  396. * 4 * 1 state_type in explicit_error_rk4
  397. * 2 controlled_stepper:
  398. * 2 * 1 deriv_type
  399. * 2 * 2 state_type
  400. *
  401. * Copying
  402. * 2 copy process of explicit_rk54_ck:
  403. * 2 * 1 deriv_type from explicit_error_stepper_base
  404. * 2 * 5 deriv_type from explicit_error_rk54_ck
  405. * 2 * 1 state_type from explicit_error_rk54_ck
  406. *
  407. * 1 process of copying controlled_error_stepper
  408. * 1 deriv_type from explicit_error_stepper_base
  409. * 5 deriv_type from explicit_error_rk54_ck
  410. * 1 state_type from explicit_error_rk54_ck
  411. * 1 deriv_type from controlled_error_stepper
  412. * 2 state_type from controlled_error_stepper
  413. */
  414. BOOST_AUTO_TEST_CASE( controlled_rk54_assign )
  415. {
  416. reset_counter();
  417. {
  418. controlled_rk54_type stepper;
  419. controlled_rk54_type stepper2;
  420. stepper2 = stepper;
  421. }
  422. CHECK_COUNTERS( 8 , 26 , 8 , 26 , 5 , 19 );
  423. }
  424. /*
  425. * Construct + Destruct
  426. * 2 explicit_rk54_ck_generic:
  427. * 2 * 1 deriv_type in explicit_error_stepper_base
  428. * 2 * 5 deriv_type in explicit_error_rk54_ck_generic
  429. * 2 * 1 state_type in explicit_error_rk54_ck_generic
  430. * 1 controlled_stepper:
  431. * 1 deriv_type
  432. * 2 state_type
  433. *
  434. * Copying
  435. * 1 copy process of explicit_rk54_ck_generic:
  436. * 1 deriv_type from explicit_error_stepper_base
  437. * 5 deriv_type from explicit_error_rk54_ck_generic
  438. * 1 state_type from explicit_error_rk54_ck_generic
  439. */
  440. BOOST_AUTO_TEST_CASE( controlled_rk54_generic_construct )
  441. {
  442. reset_counter();
  443. {
  444. controlled_rk54_generic_type stepper;
  445. }
  446. CHECK_COUNTERS( 4 , 13 , 4 , 13 , 1 , 6 );
  447. }
  448. /*
  449. * Construct + Destruct
  450. * 3 explicit_rk54_ck_generic:
  451. * 3 * 1 deriv_type in explicit_error_stepper_base
  452. * 3 * 5 deriv_type in explicit_error_rk54_ck_generic
  453. * 3 * 1 state_type in explicit_error_rk4_generic
  454. * 2 controlled_stepper:
  455. * 2 * 1 deriv_type
  456. * 2 * 2 state_type
  457. *
  458. * Copying
  459. * 1 copy process of explicit_rk54_ck_generic:
  460. * 1 deriv_type from explicit_error_stepper_base
  461. * 5 deriv_type from explicit_error_rk54_ck_generic
  462. * 1 state_type from explicit_error_rk54_ck_generic
  463. *
  464. * 1 process of copying controlled_error_stepper
  465. * 1 deriv_type from explicit_error_stepper_base
  466. * 5 deriv_type from explicit_error_rk54_ck_generic
  467. * 1 state_type from explicit_error_rk54_ck_generic
  468. * 1 deriv_type from controlled_error_stepper
  469. * 2 state_type from controlled_error_stepper
  470. */
  471. BOOST_AUTO_TEST_CASE( controlled_rk54_generic_copy_construct )
  472. {
  473. reset_counter();
  474. {
  475. controlled_rk54_generic_type stepper;
  476. controlled_rk54_generic_type stepper2( stepper );
  477. }
  478. CHECK_COUNTERS( 7 , 20 , 7 , 20 , 4 , 13 );
  479. }
  480. /*
  481. * Construct + Destruct
  482. * 4 explicit_rk54_ck_generic:
  483. * 4 * 1 deriv_type in explicit_error_stepper_base
  484. * 4 * 5 deriv_type in explicit_error_rk54_ck_generic
  485. * 4 * 1 state_type in explicit_error_rk4_generic
  486. * 2 controlled_stepper:
  487. * 2 * 1 deriv_type
  488. * 2 * 2 state_type
  489. *
  490. * Copying
  491. * 2 copy process of explicit_rk54_ck_generic:
  492. * 2 * 1 deriv_type from explicit_error_stepper_base
  493. * 2 * 5 deriv_type from explicit_error_rk54_ck_generic
  494. * 2 * 1 state_type from explicit_error_rk54_ck_generic
  495. *
  496. * 1 process of copying controlled_error_stepper
  497. * 1 deriv_type from explicit_error_stepper_base
  498. * 5 deriv_type from explicit_error_rk54_ck_generic
  499. * 1 state_type from explicit_error_rk54_ck_generic
  500. * 1 deriv_type from controlled_error_stepper
  501. * 2 state_type from controlled_error_stepper
  502. */
  503. BOOST_AUTO_TEST_CASE( controlled_rk54_generic_assign )
  504. {
  505. reset_counter();
  506. {
  507. controlled_rk54_generic_type stepper;
  508. controlled_rk54_generic_type stepper2;
  509. stepper2 = stepper;
  510. }
  511. CHECK_COUNTERS( 8 , 26 , 8 , 26 , 5 , 19 );
  512. }
  513. /*
  514. * Construct + Destruct
  515. * 2 explicit_error_dopri5:
  516. * 2 * 1 deriv_type in explicit_error_stepper_base_fsal
  517. * 2 * 6 deriv_type in explicit_error_dopri5
  518. * 2 * 1 state_type in explicit_error_dopri5
  519. * 1 controlled_error_stepper (fsal):
  520. * 2 deriv_type
  521. * 2 state_type
  522. *
  523. * Copying
  524. * 1 copy process of explicit_dopri5:
  525. * 1 deriv_type from explicit_error_stepper_base_fsal
  526. * 6 deriv_type from explicit_error_dopri5
  527. * 1 state_type from explicit_error_dopri5
  528. */
  529. BOOST_AUTO_TEST_CASE( controlled_dopri5_construct )
  530. {
  531. reset_counter();
  532. {
  533. controlled_dopri5_type dopri5;
  534. }
  535. CHECK_COUNTERS( 2 * 1 + 2 , 2 * (6+1) + 2 , 2 * 1 + 2 , 2 * (6+1) + 2 , 1 , 1 + 6 );
  536. }
  537. /*
  538. * Construct + Destruct
  539. * 3 explicit_error_dopri5:
  540. * 3 * 1 deriv_type in explicit_error_stepper_base_fsal
  541. * 3 * 6 deriv_type in explicit_error_dopri5
  542. * 3 * 1 state_type in explicit_error_dopri5
  543. * 2 controlled_error_stepper (fsal):
  544. * 2 * 2 deriv_type
  545. * 2 * 2 state_type
  546. *
  547. * Copying
  548. * 1 copy process of explicit_error_dopri5:
  549. * 1 deriv_type from explicit_error_stepper_base_fsal
  550. * 6 deriv_type from explicit_error_error_dopri5
  551. * 1 state_type from explicit_error_error_dopri5
  552. *
  553. * 1 process of copying controlled_error_stepper
  554. * 1 deriv_type from explicit_error_stepper_base_fsal
  555. * 6 deriv_type from explicit_error_dopri5
  556. * 1 state_type from explicit_error_dopri5
  557. * 2 deriv_type from controlled_error_stepper (fsal)
  558. * 2 state_type from controlled_error_stepper (fsal)
  559. */
  560. BOOST_AUTO_TEST_CASE( controlled_dopri5_copy_construct )
  561. {
  562. reset_counter();
  563. {
  564. controlled_dopri5_type dopri5;
  565. controlled_dopri5_type dopri5_2( dopri5 );
  566. }
  567. CHECK_COUNTERS( 3 * 1 + 2 * 2 , 3 * (6+1) + 2 * 2 , 3 * 1 + 2 * 2 , 3 * (6+1) + 2 * 2 , 1 + 1 + 2 , 1 + 6 + 1 + 6 + 2 );
  568. }
  569. /*
  570. * Construct + Destruct
  571. * 4 explicit_error_dopri5:
  572. * 4 * 1 deriv_type in explicit_error_stepper_base_fsal
  573. * 4 * 6 deriv_type in explicit_error_dopri5
  574. * 4 * 1 state_type in explicit_error_dopri5
  575. * 2 controlled_error_stepper (fsal):
  576. * 2 * 2 deriv_type
  577. * 2 * 2 state_type
  578. *
  579. * Copying
  580. * 2 copy process of explicit_error_dopri5:
  581. * 2 * 1 deriv_type from explicit_error_stepper_base_fsal
  582. * 2 * 6 deriv_type from explicit_error_dopri5
  583. * 2 * 1 state_type from explicit_error_dopri5
  584. *
  585. * 1 process of copying controlled_error_stepper
  586. * 1 deriv_type from explicit_error_stepper_base
  587. * 6 deriv_type from explicit_error_dopri5
  588. * 1 state_type from explicit_error_dopri5
  589. * 2 deriv_type from controlled_error_stepper (fsal)
  590. * 2 state_type from controlled_error_stepper (fsal)
  591. */
  592. BOOST_AUTO_TEST_CASE( controlled_dopri5_assign )
  593. {
  594. reset_counter();
  595. {
  596. controlled_dopri5_type dopri5;
  597. controlled_dopri5_type dopri5_2;
  598. dopri5_2 = dopri5;
  599. }
  600. CHECK_COUNTERS( 4 * 1 + 2 * 2 , 4 * (1+6) + 2 * 2 , 4 * 1 + 2 * 2 , 4 * (1+6) + 2 * 2 , 2 * 1 + 1 + 2 , 2 * (6+1) + 1 + 6 + 2 );
  601. }
  602. /*
  603. * Construct + Destruct
  604. * 2 explicit_euler:
  605. * 2 * 1 deriv_type in explicit_stepper_base
  606. * 1 dense_output_explicit:
  607. * 2 state_type
  608. *
  609. * Copying
  610. * 1 copy process of explicit_euler:
  611. * 1 deriv_type from explicit_stepper_base
  612. */
  613. BOOST_AUTO_TEST_CASE( dense_output_euler_construct )
  614. {
  615. reset_counter();
  616. {
  617. dense_output_euler_type euler;
  618. }
  619. CHECK_COUNTERS( 2 , 2 * 1 , 2 , 2 * 1 , 0 , 1 );
  620. }
  621. /*
  622. * Construct + Destruct
  623. * 3 explicit_euler:
  624. * 3 * 1 deriv_type in explicit_stepper_base
  625. * 2 dense_output_explicit:
  626. * 2 * 2 state_type
  627. *
  628. * Copying
  629. * 1 copy process of explicit_euler:
  630. * 1 deriv_type from explicit_stepper_base
  631. *
  632. * 1 process of copying
  633. * 1 deriv_type from explicit_stepper_base
  634. * 2 state_type from dense_output_explicit
  635. */
  636. BOOST_AUTO_TEST_CASE( dense_output_euler_copy_construct )
  637. {
  638. reset_counter();
  639. {
  640. dense_output_euler_type euler;
  641. dense_output_euler_type euler2( euler );
  642. }
  643. CHECK_COUNTERS( 2 * 2 , 3 * 1 , 2 * 2 , 3 * 1 , 2 , 1 + 1 );
  644. }
  645. /*
  646. * Construct + Destruct
  647. * 4 explicit_euler:
  648. * 4 * 1 deriv_type in explicit_stepper_base
  649. * 2 dense_output_explicit:
  650. * 2 * 2 state_type
  651. *
  652. * Copying
  653. * 2 copy process of explicit_euler:
  654. * 2 * 1 deriv_type from explicit_stepper_base
  655. *
  656. * 1 process of copying dense_ouput_explicit
  657. * 1 deriv_type from explicit_stepper_base
  658. * 2 state_type from dense_output_explicit
  659. */
  660. BOOST_AUTO_TEST_CASE( dense_output_euler_assign )
  661. {
  662. reset_counter();
  663. {
  664. dense_output_euler_type euler;
  665. dense_output_euler_type euler2;
  666. euler2 = euler;
  667. }
  668. CHECK_COUNTERS( 2 * 2 , 4 * 1 , 2 * 2 , 4 * 1 , 2 , 2 * 1 + 1 );
  669. }
  670. /*
  671. * Construct + Destruct
  672. * 3 dense_output_dopri5:
  673. * 3 * 1 deriv_type in explicit_error_stepper_base_fsal
  674. * 3 * 6 deriv_type in explicit_error_dopri5
  675. * 3 * 1 state_type in explicit_error_dopri5
  676. * 2 controlled_error_stepper (fsal):
  677. * 2 * 2 state_type
  678. * 2 * 2 deriv_type
  679. * 1 dense_output_controlled_explicit:
  680. * 2 state_type
  681. * 2 deriv_type
  682. *
  683. * Copying
  684. * 2 copy process of explicit_error_dopri5:
  685. * 2 * 1 deriv_type from explicit_erro_stepper_base_fsal
  686. * 2 * 6 deriv_type in explicit_error_dopri5
  687. * 2 * 1 state_type in explicit_error_dopri5
  688. * 1 copy process of dense_output_controlled (fsal)
  689. * 2 state_type
  690. * 2 deriv_type
  691. */
  692. BOOST_AUTO_TEST_CASE( dense_output_dopri5_construct )
  693. {
  694. reset_counter();
  695. {
  696. dense_output_dopri5_type dopri5;
  697. }
  698. CHECK_COUNTERS( 3*1 + 2*2 + 2 , 3*(1+6) + 2*2 + 2 , 3*1 + 2*2 + 2 , 3*(1+6) + 2*2 + 2 , 2*1 + 2 , 2*(1+6) + 2 );
  699. }
  700. /*
  701. * Construct + Destruct
  702. * 4 dense_output_dopri5:
  703. * 4 * 1 deriv_type in explicit_error_stepper_base_fsal
  704. * 4 * 5 deriv_type in explicit_error_dopri5
  705. * 4 * 1 state_type in explicit_error_dopri5
  706. * 3 controlled_error_stepper (fsal):
  707. * 3 * 2 state_type
  708. * 3 * 2 deriv_type
  709. * 2 dense_output_controlled_explicit:
  710. * 2 * 2 state_type
  711. * 2 * 2 deriv_type
  712. *
  713. * Copying
  714. * 3 copy process of explicit_error_dopri5:
  715. * 3 * 1 deriv_type from explicit_erro_stepper_base_fsal
  716. * 3 * 6 deriv_type in explicit_error_dopri5
  717. * 3 * 1 state_type in explicit_error_dopri5
  718. * 2 copy process of controlled_error_stepper (fsal):
  719. * 2 * 2 state_type
  720. * 2 * 2 deriv_type
  721. * 1 copy process of dense_output_controlled_explicit:
  722. * 2 state_type
  723. * 2 deriv_type
  724. */
  725. BOOST_AUTO_TEST_CASE( dense_output_dopri5_copy_construct )
  726. {
  727. reset_counter();
  728. {
  729. dense_output_dopri5_type dopri5;
  730. dense_output_dopri5_type dopri5_2( dopri5 );
  731. }
  732. CHECK_COUNTERS( 4*1 + 3*2 + 2*2 , 4*(1+6) + 3*2 + 2*2 , 4*1 + 3*2 + 2*2 , 4*(1+6) + 3*2 + 2*2 , 3*1 + 2*2 + 1*2 , 3*(6+1) + 2*2 + 2 );
  733. }
  734. /*
  735. * Construct + Destruct
  736. * 6 dense_output_dopri5:
  737. * 6 * 1 deriv_type in explicit_error_stepper_base_fsal
  738. * 6 * 6 deriv_type in explicit_error_dopri5
  739. * 6 * 1 state_type in explicit_error_dopri5
  740. * 4 controlled_error_stepper (fsal):
  741. * 4 * 2 state_type
  742. * 4 * 2 deriv_type
  743. * 2 dense_output_controlled_explicit:
  744. * 2 * 2 state_type
  745. * 2 * 2 deriv_type
  746. *
  747. * Copying
  748. * 5 copy process of explicit_error_dopri5:
  749. * 5 * 1 deriv_type from explicit_erro_stepper_base_fsal
  750. * 5 * 6 deriv_type in explicit_error_dopri5
  751. * 5 * 1 state_type in explicit_error_dopri5
  752. * 3 copy process of controlled_error_stepper (fsal):
  753. * 3 * 2 state_type
  754. * 3 * 2 deriv_type
  755. * 1 copy process of dense_output_controlled_explicit:
  756. * 2 state_type
  757. * 2 deriv_type
  758. */
  759. BOOST_AUTO_TEST_CASE( dense_output_dopri5_assign )
  760. {
  761. reset_counter();
  762. {
  763. dense_output_dopri5_type dopri5;
  764. dense_output_dopri5_type dopri5_2;
  765. dopri5_2 = dopri5;
  766. }
  767. CHECK_COUNTERS( 6*1 + 4*2 + 2*2 , 6*(6+1) + 4*2 + 2*2 , 6*1 + 4*2 + 2*2 , 6*(6+1) + 4*2 + 2*2 , 5*1 + 3*2 + 2 , 5*(6+1) + 3*2 + 2 );
  768. }
  769. BOOST_AUTO_TEST_SUITE_END()