generation_controlled_adams_bashforth_moulton.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. boost/numeric/odeint/stepper/detail/generation_controlled_adams_bashforth_moulton.hpp
  3. [begin_description]
  4. Spezialization of the generation functions for creation of the controlled adams bashforth moulton stepper.
  5. [end_description]
  6. Copyright 2017 Valentin Noah Hartmann
  7. Distributed under the Boost Software License, Version 1.0.
  8. (See accompanying file LICENSE_1_0.txt or
  9. copy at http://www.boost.org/LICENSE_1_0.txt)
  10. */
  11. #ifndef GENERATION_CONTROLLED_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED
  12. #define GENERATION_CONTROLLED_ADAMS_BASHFORTH_MOULTON_HPP_INCLUDED
  13. #include <boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp>
  14. #include <boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp>
  15. #include <boost/numeric/odeint/stepper/generation/make_controlled.hpp>
  16. namespace boost {
  17. namespace numeric {
  18. namespace odeint {
  19. template< size_t Steps, class State , class Value , class Deriv , class Time , class Algebra , class Operations , class Resizer >
  20. struct get_controller< adaptive_adams_bashforth_moulton< Steps, State , Value , Deriv , Time , Algebra , Operations , Resizer > >
  21. {
  22. typedef adaptive_adams_bashforth_moulton<Steps, State, Value, Deriv, Time, Algebra, Operations, Resizer> stepper_type;
  23. typedef controlled_adams_bashforth_moulton< stepper_type > type;
  24. };
  25. // controller factory for controlled_adams_bashforth_moulton
  26. template< class Stepper >
  27. struct controller_factory< Stepper , controlled_adams_bashforth_moulton< Stepper > >
  28. {
  29. typedef Stepper stepper_type;
  30. typedef controlled_adams_bashforth_moulton< stepper_type > controller_type;
  31. typedef typename controller_type::step_adjuster_type step_adjuster_type;
  32. typedef typename stepper_type::value_type value_type;
  33. typedef typename stepper_type::value_type time_type;
  34. controller_type operator()( value_type abs_error , value_type rel_error , const stepper_type &stepper )
  35. {
  36. return controller_type(step_adjuster_type(abs_error, rel_error));
  37. }
  38. controller_type operator()( value_type abs_error , value_type rel_error ,
  39. time_type max_dt, const stepper_type &stepper )
  40. {
  41. return controller_type( step_adjuster_type(abs_error, rel_error, max_dt));
  42. }
  43. };
  44. }
  45. }
  46. }
  47. #endif