diff --git a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/using_boost__range.html b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/using_boost__range.html index b66d42d5..d67fa17e 100644 --- a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/using_boost__range.html +++ b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/using_boost__range.html @@ -22,18 +22,206 @@

Most steppers in odeint also accept the state give as a range. A range is - sequence of values modelled by a range concept, see Boost.Range - for an overview over existing concepts and examples of ranges. + sequence of values modelled by a range concept. See Boost.Range + for an overview over existing concepts and examples of ranges. This means + that the state_type of the + stepper must not necessarily used to call the do_step + method.

- state type mus not necessary be used in the steppers + One use case for Boost.Range + in odeint has been shown in Chaotic + system where the state consists of two parts: one for the original + state and one for the perturbations. The ranges are used to initialize (solve) + only the system part where the perturbation part is not touched. After that + the complete state including also the perturbations is solved. Another use + case is a system consisting of coupled units where you want to initialize + each unit separately with the ODE of the uncoupled unit. An example is a + chain of coupled van-der-Pol-oscillators which are initialized uniformily + from the uncoupled van-der-Pol-oscillator. Then you can use Boost.Range + to solve only one individual oscillator in the chain.

- example + An example was given in Chaotic + system tutorial. Using Boost.Range usually means that your system + function needs to adapt to the iterators of Boost.Range. That is, your function + is called with a range and you need to get the iterators from that range. + This can easily be done. You have to implement your system as a class or + a struct and you have to templatize the operator(). Then you can use the range_iterator-meta + function and boost::begin and boost::end to + obtain the iterators of your range:

- table which steppers support boost::range and with which algebra +

+
class sys
+{
+    template< class State , class Deriv >
+    void operator()( const State &x_ , Deriv &dxdt_ , double t ) const
+    {
+         typename boost::range_iterator< const State >::type x = boost::begin( x_ );
+         typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
+
+         // fill dxdt
+    }
+};
+
+

+

+ If your range is a random access-range you can also apply the bracket operator + to the iterator to access the elements in the range: +

+
class sys
+{
+    template< class State , class Deriv >
+    void operator()( const State &x_ , Deriv &dxdt_ , double t ) const
+    {
+         typename boost::range_iterator< const State >::type x = boost::begin( x_ );
+         typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
+
+         dxdt[0] = f1( x[0] , x[1] );
+         dxdt[1] = f2( x[0] , x[1] );
+    }
+};
+
+

+

+

+ The following two tables show which steppers and which algebras are compatible + with Boost.Range. +

+
+

Table 1.10. Steppers supporting Boost.Range

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+

+ Stepper +

+
+

+ adams_bashforth_moulton +

+
+

+ bulirsch_stoer_dense_out +

+
+

+ bulirsch_stoer +

+
+

+ controlled_runge_kutta +

+
+

+ dense_output_runge_kutta +

+
+

+ euler +

+
+

+ explicit_error_generic_rk +

+
+

+ explicit_generic_rk +

+
+

+ rosenbrock4_controller +

+
+

+ rosenbrock4_dense_output +

+
+

+ rosenbrock4 +

+
+

+ runge_kutta4_classic +

+
+

+ runge_kutta4 +

+
+

+ runge_kutta_cash_karp54_classic +

+
+

+ runge_kutta_cash_karp54 +

+
+

+ runge_kutta_dopri5 +

+
+

+ runge_kutta_fehlberg78 +

+
+

+ symplectic_euler +

+
+

+ symplectic_rkn_sb3a_mclachlan +

+
+
+
+

Table 1.11. Algebra supporting Boost.Range

+
+ + + + + + +
+

+ algebra +

+
+

+ range_algebra +

+
+

+ thrust_algebra +

+
+
+
diff --git a/doc/boost_sandbox_numeric_odeint/old_reference/stepper_classes.html b/doc/boost_sandbox_numeric_odeint/old_reference/stepper_classes.html index 5f52e624..f2bd922f 100644 --- a/doc/boost_sandbox_numeric_odeint/old_reference/stepper_classes.html +++ b/doc/boost_sandbox_numeric_odeint/old_reference/stepper_classes.html @@ -21,7 +21,7 @@ classes
-

Table 1.10. Stepper Algorithms

+

Table 1.12. Stepper Algorithms

diff --git a/doc/index.html b/doc/index.html index 802efb15..caef9ab9 100644 --- a/doc/index.html +++ b/doc/index.html @@ -125,7 +125,7 @@
- +

Last revised: April 02, 2012 at 16:04:40 GMT

Last revised: April 03, 2012 at 11:27:53 GMT


diff --git a/libs/numeric/odeint/doc/details_boost_range.qbk b/libs/numeric/odeint/doc/details_boost_range.qbk index e70f1207..0d910063 100644 --- a/libs/numeric/odeint/doc/details_boost_range.qbk +++ b/libs/numeric/odeint/doc/details_boost_range.qbk @@ -1,11 +1,44 @@ [section Using boost::range] -Most steppers in odeint also accept the state give as a range. A range is sequence of values modelled by a range concept, see __boost_range for an overview over existing concepts and examples of ranges. +Most steppers in odeint also accept the state give as a range. A range is sequence of values modelled by a range concept. See __boost_range for an overview over existing concepts and examples of ranges. This means that the `state_type` of the stepper must not necessarily used to call the `do_step` method. -state type mus not necessary be used in the steppers +One use case for __boost_range in odeint has been shown in __tut_chaotic_system where the state consists of two parts: one for the original state and one for the perturbations. The ranges are used to initialize (solve) only the system part where the perturbation part is not touched, that is a range consisting only of the system part is used. After that the complete state including also the perturbations is solved. -example +Another use case is a system consisting of coupled units where you want to initialize each unit separately with the ODE of the uncoupled unit. An example is a chain of coupled van-der-Pol-oscillators which are initialized uniformily from the uncoupled van-der-Pol-oscillator. Then you can use __boost_range to solve only one individual oscillator in the chain. -table which steppers support boost::range and with which algebra +An example was given in __tut_chaotic_system tutorial. Using Boost.Range usually means that your system function needs to adapt to the iterators of Boost.Range. That is, your function is called with a range and you need to get the iterators from that range. This can easily be done. You have to implement your system as a class or a struct and you have to templatize the `operator()`. Then you can use the `range_iterator`-meta function and `boost::begin` and `boost::end` to obtain the iterators of your range: + +`` +class sys +{ + template< class State , class Deriv > + void operator()( const State &x_ , Deriv &dxdt_ , double t ) const + { + typename boost::range_iterator< const State >::type x = boost::begin( x_ ); + typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ ); + + // fill dxdt + } +}; +`` + +If your range is a random access-range you can also apply the bracket operator to the iterator to access the elements in the range: +`` +class sys +{ + template< class State , class Deriv > + void operator()( const State &x_ , Deriv &dxdt_ , double t ) const + { + typename boost::range_iterator< const State >::type x = boost::begin( x_ ); + typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ ); + + dxdt[0] = f1( x[0] , x[1] ); + dxdt[1] = f2( x[0] , x[1] ); + } +}; +`` + +The following two tables show which steppers and which algebras are compatible with __boost_range. +[include range_table.qbk] [endsect] diff --git a/libs/numeric/odeint/doc/odeint.qbk b/libs/numeric/odeint/doc/odeint.qbk index 642e3aff..e3122716 100644 --- a/libs/numeric/odeint/doc/odeint.qbk +++ b/libs/numeric/odeint/doc/odeint.qbk @@ -66,6 +66,8 @@ [link boost_sandbox_numeric_odeint.odeint_in_detail.integrate_functions integrate functions]] [def __tut_solar_system [link boost_sandbox_numeric_odeint.tutorial.solar_system Solar System]] +[def __tut_chaotic_system + [link boost_sandbox_numeric_odeint.tutorial.chaotic_systems_and_lyapunov_exponents Chaotic system]] [def __using_steppers [link boost_sandbox_numeric_odeint.odeint_in_detail.steppers.using_steppers Using steppers]] [def __generation_functions diff --git a/libs/numeric/odeint/doc/range_table.qbk b/libs/numeric/odeint/doc/range_table.qbk new file mode 100644 index 00000000..22d06f6d --- /dev/null +++ b/libs/numeric/odeint/doc/range_table.qbk @@ -0,0 +1,57 @@ +[/ +Steppers supporting __boost_range: + +* adams_bashforth_moulton +* bulirsch_stoer_dense_out +* bulirsch_stoer +* controlled_runge_kutta +* dense_output_runge_kutta +* euler +* explicit_error_generic_rk +* explicit_generic_rk +* rosenbrock4_controller +* rosenbrock4_dense_output +* rosenbrock4 +* runge_kutta4_classic +* runge_kutta4 +* runge_kutta_cash_karp54_classic +* runge_kutta_cash_karp54 +* runge_kutta_dopri5 +* runge_kutta_fehlberg78 +* symplectic_euler +* symplectic_rkn_sb3a_mclachlan + +Algebras supporting __boost_range + +* range_algebra +* thrust_algebra +/] + +[table Steppers supporting Boost.Range + [[Stepper]] + [[adams_bashforth_moulton]] + [[bulirsch_stoer_dense_out]] + [[bulirsch_stoer]] + [[controlled_runge_kutta]] + [[dense_output_runge_kutta]] + [[euler]] + [[explicit_error_generic_rk]] + [[explicit_generic_rk]] + [[rosenbrock4_controller]] + [[rosenbrock4_dense_output]] + [[rosenbrock4]] + [[runge_kutta4_classic]] + [[runge_kutta4]] + [[runge_kutta_cash_karp54_classic]] + [[runge_kutta_cash_karp54]] + [[runge_kutta_dopri5]] + [[runge_kutta_fehlberg78]] + [[symplectic_euler]] + [[symplectic_rkn_sb3a_mclachlan]] +] + +[table Algebra supporting Boost.Range + [[algebra]] + [[range_algebra]] + [[thrust_algebra]] +] \ No newline at end of file