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