Tatooine
controller_runge_kutta_with_domain_check.h
Go to the documentation of this file.
1#ifndef TATOOINE_ODE_BOOST_CONTROLLED_RUNGE_KUTTA_WITH_DOMAIN_CHECK_H
2#define TATOOINE_ODE_BOOST_CONTROLLED_RUNGE_KUTTA_WITH_DOMAIN_CHECK_H
3//==============================================================================
4#include <boost/config.hpp>
5#include <boost/numeric/odeint/algebra/default_operations.hpp>
6#include <boost/numeric/odeint/algebra/range_algebra.hpp>
7#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
8#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
9#include <boost/numeric/odeint/util/bind.hpp>
10#include <boost/numeric/odeint/util/copy.hpp>
11#include <boost/numeric/odeint/util/is_resizeable.hpp>
12#include <boost/numeric/odeint/util/resizer.hpp>
13#include <boost/numeric/odeint/util/state_wrapper.hpp>
14#include <boost/numeric/odeint/util/unwrap_reference.hpp>
15#include <boost/type_traits/is_same.hpp>
16#include <boost/utility/enable_if.hpp>
17#include <cmath>
18//==============================================================================
20//==============================================================================
21template <typename Value, typename Algebra = ::boost::numeric::odeint::range_algebra,
22 typename Operations = ::boost::numeric::odeint::default_operations>
24 public:
25 using value_type = Value;
26 using algebra_type = Algebra;
27 using operations_type = Operations;
28
29 default_error_checker(value_type eps_abs = static_cast<value_type>(1.0e-6),
30 value_type eps_rel = static_cast<value_type>(1.0e-6),
31 value_type a_x = static_cast<value_type>(1),
32 value_type a_dxdt = static_cast<value_type>(1))
33 : m_eps_abs(eps_abs), m_eps_rel(eps_rel), m_a_x(a_x), m_a_dxdt(a_dxdt) {}
34
35 template <typename State, typename Deriv, typename Err, typename Time>
36 value_type error(const State &x_old, const Deriv &dxdt_old, Err &x_err,
37 Time dt) const {
38 return error(algebra_type(), x_old, dxdt_old, x_err, dt);
39 }
40
41 template <typename State, typename Deriv, typename Err, typename Time>
42 value_type error(algebra_type &algebra, const State &x_old,
43 const Deriv &dxdt_old, Err &x_err, Time dt) const {
44 // this overwrites x_err !
45 algebra.for_each3(
46 x_err, x_old, dxdt_old,
47 typename operations_type::template rel_error<value_type>(
48 m_eps_abs, m_eps_rel, m_a_x, m_a_dxdt * get_unit_value(dt)));
49
50 value_type res = algebra.reduce(
51 x_err, typename operations_type::template maximum<value_type>(),
52 static_cast<value_type>(0));
53 return res;
54 }
55
56 private:
61};
62
64template <typename ErrorStepper,
65 typename ErrorChecker =
66 default_error_checker<typename ErrorStepper::value_type,
67 typename ErrorStepper::algebra_type,
68 typename ErrorStepper::operations_type>,
69 typename Resizer = typename ErrorStepper::resizer_type,
70 typename ErrorStepperCategory = typename ErrorStepper::stepper_category>
72
73/*
74 * explicit stepper version
75 *
76 * this class introduces the following try_step overloads
77 * try_step( sys , x , t , dt )
78 * try_step( sys , x , dxdt , t , dt )
79 * try_step( sys , in , t , out , dt )
80 * try_step( sys , in , dxdt , t , out , dt )
81 */
93template <typename ErrorStepper, typename ErrorChecker, typename Resizer>
95 ErrorStepper, ErrorChecker, Resizer,
96 ::boost::numeric::odeint::explicit_error_stepper_tag> {
97 public:
98 using stepper_type = ErrorStepper;
105 using resizer_type = Resizer;
106 using error_checker_type = ErrorChecker;
107 using stepper_category = explicit_controlled_stepper_tag;
108
109#ifndef DOXYGEN_SKIP
112
114 controlled_runge_kutta_with_domain_check<ErrorStepper, ErrorChecker, Resizer,
115 explicit_error_stepper_tag>;
116#endif // DOXYGEN_SKIP
117
124 const error_checker_type &error_checker = error_checker_type(),
125 const stepper_type & stepper = stepper_type())
126 : m_stepper(stepper), m_error_checker(error_checker) {}
127
128 /*
129 * Version 1 : try_step( sys , x , t , dt )
130 *
131 * The overloads are needed to solve the forwarding problem
132 */
149 template <typename System, typename StateInOut>
150 controlled_step_result try_step(System system, StateInOut &x, time_type &t,
151 time_type &dt) {
152 return try_step_v1(system, x, t, dt);
153 }
154
173 template <typename System, typename StateInOut>
174 controlled_step_result try_step(System system, const StateInOut &x,
175 time_type &t, time_type &dt) {
176 return try_step_v1(system, x, t, dt);
177 }
178
179 /*
180 * Version 2 : try_step( sys , x , dxdt , t , dt )
181 *
182 * this version does not solve the forwarding problem, boost.range can not be
183 * used
184 */
202 template <typename System, typename StateInOut, typename DerivIn>
203 controlled_step_result try_step(System system, StateInOut &x,
204 const DerivIn &dxdt, time_type &t,
205 time_type &dt) {
206 m_xnew_resizer.adjust_size(
207 x, detail::bind(
208 &controlled_runge_kutta_with_domain_check::template resize_m_xnew_impl<StateInOut>,
209 detail::ref(*this), detail::_1));
210 controlled_step_result res = try_step(system, x, dxdt, t, m_xnew.m_v, dt);
211 if (res == success) {
212 boost::numeric::odeint::copy(m_xnew.m_v, x);
213 }
214 return res;
215 }
216
217 /*
218 * Version 3 : try_step( sys , in , t , out , dt )
219 *
220 * this version does not solve the forwarding problem, boost.range can not be
221 * used
222 *
223 * the disable is needed to avoid ambiguous overloads if state_type =
224 * time_type
225 */
245 template <typename System, typename StateIn, typename StateOut>
246 typename boost::disable_if<boost::is_same<StateIn, time_type>,
247 controlled_step_result>::type
248 try_step(System system, const StateIn &in, time_type &t, StateOut &out,
249 time_type &dt) {
250 typename odeint::unwrap_reference<System>::type &sys = system;
251 m_dxdt_resizer.adjust_size(
252 in, detail::bind(
253 &controlled_runge_kutta_with_domain_check::template resize_m_dxdt_impl<StateIn>,
254 detail::ref(*this), detail::_1));
255 sys(in, m_dxdt.m_v, t);
256 return try_step(system, in, m_dxdt.m_v, t, out, dt);
257 }
258
259 /*
260 * Version 4 : try_step( sys , in , dxdt , t , out , dt )
261 *
262 * this version does not solve the forwarding problem, boost.range can not be
263 * used
264 */
282 template <typename System, typename StateIn, typename DerivIn, typename StateOut>
283 controlled_step_result try_step(System system, const StateIn &in,
284 const DerivIn &dxdt, time_type &t,
285 StateOut &out, time_type &dt) {
286 BOOST_USING_STD_MIN();
287 BOOST_USING_STD_MAX();
288 using std::pow;
289
290 m_xerr_resizer.adjust_size(
291 in, detail::bind(
292 &controlled_runge_kutta_with_domain_check::template resize_m_xerr_impl<StateIn>,
293 detail::ref(*this), detail::_1));
294
295 // do one step with error calculation
296 m_stepper.do_step(system, in, dxdt, t, out, dt, m_xerr.m_v);
297
298 m_max_rel_error =
299 m_error_checker.error(m_stepper.algebra(), in, dxdt, m_xerr.m_v, dt);
300
301 if (m_max_rel_error > 1.0) {
302 // error too large - decrease dt ,limit scaling factor to 0.2 and reset
303 // state
304 dt *= max BOOST_PREVENT_MACRO_SUBSTITUTION(
305 static_cast<value_type>(9) / static_cast<value_type>(10) *
306 pow(m_max_rel_error,
307 static_cast<value_type>(-1) / (m_stepper.error_order() - 1)),
308 static_cast<value_type>(1) / static_cast<value_type>(5));
309 return fail;
310 } else {
311 if (m_max_rel_error < 0.5) {
312 // error should be > 0
313 m_max_rel_error = max BOOST_PREVENT_MACRO_SUBSTITUTION(
314 pow(5.0, -m_stepper.stepper_order()), m_max_rel_error);
315 // error too small - increase dt and keep the evolution and limit
316 // scaling factor to 5.0
317 t += dt;
318 dt *= static_cast<value_type>(9) / static_cast<value_type>(10) *
319 pow(m_max_rel_error,
320 static_cast<value_type>(-1) / m_stepper.stepper_order());
321 return success;
322 } else {
323 t += dt;
324 return success;
325 }
326 }
327 }
328
334 value_type last_error(void) const { return m_max_rel_error; }
335
341 template <typename StateType>
342 void adjust_size(const StateType &x) {
343 resize_m_xerr_impl(x);
344 resize_m_dxdt_impl(x);
345 resize_m_xnew_impl(x);
346 m_stepper.adjust_size(x);
347 }
348
353 stepper_type &stepper(void) { return m_stepper; }
354
359 const stepper_type &stepper(void) const { return m_stepper; }
360
361 private:
362 template <typename System, typename StateInOut>
363 controlled_step_result try_step_v1(System system, StateInOut &x, time_type &t,
364 time_type &dt) {
365 typename odeint::unwrap_reference<System>::type &sys = system;
366 m_dxdt_resizer.adjust_size(
367 x, detail::bind(
368 &controlled_runge_kutta_with_domain_check::template resize_m_dxdt_impl<StateInOut>,
369 detail::ref(*this), detail::_1));
370 sys(x, m_dxdt.m_v, t);
371 return try_step(system, x, m_dxdt.m_v, t, dt);
372 }
373
374 template <typename StateIn>
375 bool resize_m_xerr_impl(const StateIn &x) {
376 return adjust_size_by_resizeability(
377 m_xerr, x, typename is_resizeable<state_type>::type());
378 }
379
380 template <typename StateIn>
381 bool resize_m_dxdt_impl(const StateIn &x) {
382 return adjust_size_by_resizeability(
383 m_dxdt, x, typename is_resizeable<deriv_type>::type());
384 }
385
386 template <typename StateIn>
387 bool resize_m_xnew_impl(const StateIn &x) {
388 return adjust_size_by_resizeability(
389 m_xnew, x, typename is_resizeable<state_type>::type());
390 }
391
394
398
403};
404
405/*
406 * explicit stepper fsal version
407 *
408 * the class introduces the following try_step overloads
409 * try_step( sys , x , t , dt )
410 * try_step( sys , in , t , out , dt )
411 * try_step( sys , x , dxdt , t , dt )
412 * try_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
413 */
425template <typename ErrorStepper, typename ErrorChecker, typename Resizer>
426class controlled_runge_kutta_with_domain_check<ErrorStepper, ErrorChecker, Resizer,
427 explicit_error_stepper_fsal_tag> {
428 public:
429 using stepper_type = ErrorStepper;
436 using resizer_type = Resizer;
437 using error_checker_type = ErrorChecker;
438 using stepper_category = explicit_controlled_stepper_fsal_tag;
439
440#ifndef DOXYGEN_SKIP
443
445 controlled_runge_kutta_with_domain_check<ErrorStepper, ErrorChecker, Resizer,
446 explicit_error_stepper_tag>;
447#endif // DOXYGEN_SKIP
448
455 const error_checker_type &error_checker = error_checker_type(),
456 const stepper_type & stepper = stepper_type())
457 : m_stepper(stepper),
458 m_error_checker(error_checker),
459 m_first_call(true) {}
460
461 /*
462 * Version 1 : try_step( sys , x , t , dt )
463 *
464 * The two overloads are needed in order to solve the forwarding problem
465 */
482 template <typename System, typename StateInOut>
483 controlled_step_result try_step(System system, StateInOut &x, time_type &t,
484 time_type &dt) {
485 return try_step_v1(system, x, t, dt);
486 }
487
506 template <typename System, typename StateInOut>
507 controlled_step_result try_step(System system, const StateInOut &x,
508 time_type &t, time_type &dt) {
509 return try_step_v1(system, x, t, dt);
510 }
511
512 /*
513 * Version 2 : try_step( sys , in , t , out , dt );
514 *
515 * This version does not solve the forwarding problem, boost::range can not be
516 * used.
517 *
518 * The disabler is needed to solve ambiguous overloads
519 */
539 template <typename System, typename StateIn, typename StateOut>
540 typename boost::disable_if<boost::is_same<StateIn, time_type>,
541 controlled_step_result>::type
542 try_step(System system, const StateIn &in, time_type &t, StateOut &out,
543 time_type &dt) {
544 if (m_dxdt_resizer.adjust_size(
545 in,
546 detail::bind(
547 &controlled_runge_kutta_with_domain_check::template resize_m_dxdt_impl<StateIn>,
548 detail::ref(*this), detail::_1)) ||
549 m_first_call) {
550 initialize(system, in, t);
551 }
552 return try_step(system, in, m_dxdt.m_v, t, out, dt);
553 }
554
555 /*
556 * Version 3 : try_step( sys , x , dxdt , t , dt )
557 *
558 * This version does not solve the forwarding problem, boost::range can not be
559 * used.
560 */
578 template <typename System, typename StateInOut, typename DerivInOut>
579 controlled_step_result try_step(System system, StateInOut &x,
580 DerivInOut &dxdt, time_type &t,
581 time_type &dt) {
582 m_xnew_resizer.adjust_size(
583 x, detail::bind(
584 &controlled_runge_kutta_with_domain_check::template resize_m_xnew_impl<StateInOut>,
585 detail::ref(*this), detail::_1));
586 m_dxdt_new_resizer.adjust_size(
587 x,
588 detail::bind(&controlled_runge_kutta_with_domain_check::template resize_m_dxdt_new_impl<
589 StateInOut>,
590 detail::ref(*this), detail::_1));
591 controlled_step_result res =
592 try_step(system, x, dxdt, t, m_xnew.m_v, m_dxdtnew.m_v, dt);
593 if (res == success) {
594 boost::numeric::odeint::copy(m_xnew.m_v, x);
595 boost::numeric::odeint::copy(m_dxdtnew.m_v, dxdt);
596 }
597 return res;
598 }
599
600 /*
601 * Version 4 : try_step( sys , in , dxdt_in , t , out , dxdt_out , dt )
602 *
603 * This version does not solve the forwarding problem, boost::range can not be
604 * used.
605 */
623 template <typename System, typename StateIn, typename DerivIn, typename StateOut,
624 typename DerivOut>
625 controlled_step_result try_step(System system, const StateIn &in,
626 const DerivIn &dxdt_in, time_type &t,
627 StateOut &out, DerivOut &dxdt_out,
628 time_type &dt) {
629 BOOST_USING_STD_MIN();
630 BOOST_USING_STD_MAX();
631
632 using std::pow;
633
634 m_xerr_resizer.adjust_size(
635 in, detail::bind(
636 &controlled_runge_kutta_with_domain_check::template resize_m_xerr_impl<StateIn>,
637 detail::ref(*this), detail::_1));
638
639 // fsal: m_stepper.get_dxdt( dxdt );
640 // fsal: m_stepper.do_step( sys , x , dxdt , t , dt , m_x_err );
641 m_stepper.do_step(system, in, dxdt_in, t, out, dxdt_out, dt, m_xerr.m_v);
642
643 // this potentially overwrites m_x_err! (standard_error_checker does, at
644 // least)
645 value_type max_rel_err =
646 m_error_checker.error(m_stepper.algebra(), in, dxdt_in, m_xerr.m_v, dt);
647
648 if (max_rel_err > 1.0) {
649 // error too large - decrease dt ,limit scaling factor to 0.2 and reset
650 // state
651 dt *= max BOOST_PREVENT_MACRO_SUBSTITUTION(
652 static_cast<value_type>(
653 static_cast<value_type>(9) / static_cast<value_type>(10) *
654 pow(max_rel_err,
655 static_cast<value_type>(-1) / (m_stepper.error_order() - 1))),
656 static_cast<value_type>(static_cast<value_type>(1) /
657 static_cast<value_type>(5)));
658 return fail;
659 } else {
660 if (max_rel_err < 0.5) { // error too small - increase dt and keep the
661 // evolution and limit scaling factor to 5.0
662 // error should be > 0
663 max_rel_err = max BOOST_PREVENT_MACRO_SUBSTITUTION(
664 pow(5.0, -m_stepper.stepper_order()), max_rel_err);
665 t += dt;
666 dt *= static_cast<value_type>(
667 static_cast<value_type>(9) / static_cast<value_type>(10) *
668 pow(max_rel_err,
669 static_cast<value_type>(-1) / m_stepper.stepper_order()));
670 return success;
671 } else {
672 t += dt;
673 return success;
674 }
675 }
676 }
677
681 void reset(void) { m_first_call = true; }
682
689 template <typename DerivIn>
690 void initialize(const DerivIn &deriv) {
691 boost::numeric::odeint::copy(deriv, m_dxdt.m_v);
692 m_first_call = false;
693 }
694
703 template <typename System, typename StateIn>
704 void initialize(System system, const StateIn &x, time_type t) {
705 typename odeint::unwrap_reference<System>::type &sys = system;
706 sys(x, m_dxdt.m_v, t);
707 m_first_call = false;
708 }
709
715 bool is_initialized(void) const { return !m_first_call; }
716
722 template <typename StateType>
723 void adjust_size(const StateType &x) {
724 resize_m_xerr_impl(x);
725 resize_m_dxdt_impl(x);
726 resize_m_dxdt_new_impl(x);
727 resize_m_xnew_impl(x);
728 }
729
734 stepper_type &stepper(void) { return m_stepper; }
735
740 const stepper_type &stepper(void) const { return m_stepper; }
741
742 private:
743 template <typename StateIn>
744 bool resize_m_xerr_impl(const StateIn &x) {
745 return adjust_size_by_resizeability(
746 m_xerr, x, typename is_resizeable<state_type>::type());
747 }
748
749 template <typename StateIn>
750 bool resize_m_dxdt_impl(const StateIn &x) {
751 return adjust_size_by_resizeability(
752 m_dxdt, x, typename is_resizeable<deriv_type>::type());
753 }
754
755 template <typename StateIn>
756 bool resize_m_dxdt_new_impl(const StateIn &x) {
757 return adjust_size_by_resizeability(
758 m_dxdtnew, x, typename is_resizeable<deriv_type>::type());
759 }
760
761 template <typename StateIn>
762 bool resize_m_xnew_impl(const StateIn &x) {
763 return adjust_size_by_resizeability(
764 m_xnew, x, typename is_resizeable<state_type>::type());
765 }
766
767 template <typename System, typename StateInOut>
768 controlled_step_result try_step_v1(System system, StateInOut &x, time_type &t,
769 time_type &dt) {
770 if (m_dxdt_resizer.adjust_size(
771 x,
772 detail::bind(&controlled_runge_kutta_with_domain_check::template resize_m_dxdt_impl<
773 StateInOut>,
774 detail::ref(*this), detail::_1)) ||
775 m_first_call) {
776 initialize(system, x, t);
777 }
778 return try_step(system, x, m_dxdt.m_v, t, dt);
779 }
780
783
788
794};
795
796/********** DOXYGEN **********/
797
798/**** DEFAULT ERROR CHECKER ****/
799
857//==============================================================================
858} // namespace tatooine::ode::boost
859//==============================================================================
860
861#endif // BOOST_NUMERIC_ODEINT_STEPPER_CONTROLLED_RUNGE_KUTTA_HPP_INCLUDED
controlled_step_result try_step(System system, StateInOut &x, time_type &t, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:150
controlled_step_result try_step(System system, const StateInOut &x, time_type &t, time_type &dt)
Tries to perform one step. Solves the forwarding problem and allows for using boost range as state_ty...
Definition: controller_runge_kutta_with_domain_check.h:174
typename stepper_type::wrapped_state_type wrapped_state_type
Definition: controller_runge_kutta_with_domain_check.h:110
controlled_runge_kutta_with_domain_check(const error_checker_type &error_checker=error_checker_type(), const stepper_type &stepper=stepper_type())
Constructs the controlled Runge-Kutta stepper.
Definition: controller_runge_kutta_with_domain_check.h:123
value_type last_error(void) const
Returns the error of the last step.
Definition: controller_runge_kutta_with_domain_check.h:334
controlled_step_result try_step(System system, const StateIn &in, const DerivIn &dxdt, time_type &t, StateOut &out, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:283
stepper_type & stepper(void)
Returns the instance of the underlying stepper.
Definition: controller_runge_kutta_with_domain_check.h:353
controlled_step_result try_step(System system, StateInOut &x, const DerivIn &dxdt, time_type &t, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:203
typename stepper_type::wrapped_deriv_type wrapped_deriv_type
Definition: controller_runge_kutta_with_domain_check.h:111
const stepper_type & stepper(void) const
Returns the instance of the underlying stepper.
Definition: controller_runge_kutta_with_domain_check.h:359
void adjust_size(const StateType &x)
Adjust the size of all temporaries in the stepper manually.
Definition: controller_runge_kutta_with_domain_check.h:342
boost::disable_if< boost::is_same< StateIn, time_type >, controlled_step_result >::type try_step(System system, const StateIn &in, time_type &t, StateOut &out, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:248
controlled_step_result try_step_v1(System system, StateInOut &x, time_type &t, time_type &dt)
Definition: controller_runge_kutta_with_domain_check.h:363
typename stepper_type::operations_type operations_type
Definition: controller_runge_kutta_with_domain_check.h:435
void adjust_size(const StateType &x)
Adjust the size of all temporaries in the stepper manually.
Definition: controller_runge_kutta_with_domain_check.h:723
typename stepper_type::wrapped_state_type wrapped_state_type
Definition: controller_runge_kutta_with_domain_check.h:441
explicit_controlled_stepper_fsal_tag stepper_category
Definition: controller_runge_kutta_with_domain_check.h:438
stepper_type & stepper(void)
Returns the instance of the underlying stepper.
Definition: controller_runge_kutta_with_domain_check.h:734
controlled_step_result try_step(System system, const StateInOut &x, time_type &t, time_type &dt)
Tries to perform one step. Solves the forwarding problem and allows for using boost range as state_ty...
Definition: controller_runge_kutta_with_domain_check.h:507
bool is_initialized(void) const
Returns true if the stepper has been initialized, false otherwise.
Definition: controller_runge_kutta_with_domain_check.h:715
controlled_step_result try_step(System system, const StateIn &in, const DerivIn &dxdt_in, time_type &t, StateOut &out, DerivOut &dxdt_out, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:625
typename stepper_type::state_type state_type
Definition: controller_runge_kutta_with_domain_check.h:430
typename stepper_type::deriv_type deriv_type
Definition: controller_runge_kutta_with_domain_check.h:432
void initialize(const DerivIn &deriv)
Initializes the internal state storing an internal copy of the derivative.
Definition: controller_runge_kutta_with_domain_check.h:690
void initialize(System system, const StateIn &x, time_type t)
Initializes the internal state storing an internal copy of the derivative.
Definition: controller_runge_kutta_with_domain_check.h:704
controlled_step_result try_step_v1(System system, StateInOut &x, time_type &t, time_type &dt)
Definition: controller_runge_kutta_with_domain_check.h:768
controlled_step_result try_step(System system, StateInOut &x, DerivInOut &dxdt, time_type &t, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:579
controlled_step_result try_step(System system, StateInOut &x, time_type &t, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:483
typename stepper_type::time_type time_type
Definition: controller_runge_kutta_with_domain_check.h:433
const stepper_type & stepper(void) const
Returns the instance of the underlying stepper.
Definition: controller_runge_kutta_with_domain_check.h:740
boost::disable_if< boost::is_same< StateIn, time_type >, controlled_step_result >::type try_step(System system, const StateIn &in, time_type &t, StateOut &out, time_type &dt)
Tries to perform one step.
Definition: controller_runge_kutta_with_domain_check.h:542
typename stepper_type::algebra_type algebra_type
Definition: controller_runge_kutta_with_domain_check.h:434
typename stepper_type::wrapped_deriv_type wrapped_deriv_type
Definition: controller_runge_kutta_with_domain_check.h:442
void reset(void)
Resets the internal state of the underlying FSAL stepper.
Definition: controller_runge_kutta_with_domain_check.h:681
typename stepper_type::value_type value_type
Definition: controller_runge_kutta_with_domain_check.h:431
controlled_runge_kutta_with_domain_check(const error_checker_type &error_checker=error_checker_type(), const stepper_type &stepper=stepper_type())
Constructs the controlled Runge-Kutta stepper.
Definition: controller_runge_kutta_with_domain_check.h:454
error stepper category dispatcher
Definition: controller_runge_kutta_with_domain_check.h:71
The default error checker to be used with Runge-Kutta error steppers.
Definition: controller_runge_kutta_with_domain_check.h:23
value_type m_a_x
Definition: controller_runge_kutta_with_domain_check.h:59
Value value_type
Definition: controller_runge_kutta_with_domain_check.h:25
value_type error(algebra_type &algebra, const State &x_old, const Deriv &dxdt_old, Err &x_err, Time dt) const
Definition: controller_runge_kutta_with_domain_check.h:42
value_type m_eps_abs
Definition: controller_runge_kutta_with_domain_check.h:57
value_type error(const State &x_old, const Deriv &dxdt_old, Err &x_err, Time dt) const
Definition: controller_runge_kutta_with_domain_check.h:36
default_error_checker(value_type eps_abs=static_cast< value_type >(1.0e-6), value_type eps_rel=static_cast< value_type >(1.0e-6), value_type a_x=static_cast< value_type >(1), value_type a_dxdt=static_cast< value_type >(1))
Definition: controller_runge_kutta_with_domain_check.h:29
value_type m_a_dxdt
Definition: controller_runge_kutta_with_domain_check.h:60
Operations operations_type
Definition: controller_runge_kutta_with_domain_check.h:27
Algebra algebra_type
Definition: controller_runge_kutta_with_domain_check.h:26
value_type m_eps_rel
Definition: controller_runge_kutta_with_domain_check.h:58
Definition: controller_runge_kutta_with_domain_check.h:19
constexpr auto pow(arithmetic auto const x)
Definition: math.h:30
constexpr auto max(A &&a, B &&b)
Definition: math.h:20
Definition: utility.h:13