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