diff --git a/boost/numeric/odeint.hpp b/boost/numeric/odeint.hpp
index abef443b..f3be32bc 100644
--- a/boost/numeric/odeint.hpp
+++ b/boost/numeric/odeint.hpp
@@ -59,6 +59,7 @@
* Including this algebra slows down the compilation time
*/
// #include
+#include
#include
#include
diff --git a/boost/numeric/odeint/util/state_wrapper.hpp b/boost/numeric/odeint/util/state_wrapper.hpp
index 384ef321..19f67b8f 100644
--- a/boost/numeric/odeint/util/state_wrapper.hpp
+++ b/boost/numeric/odeint/util/state_wrapper.hpp
@@ -20,35 +20,25 @@
#define BOOST_NUMERIC_ODEINT_UTIL_STATE_WRAPPER_HPP_INCLUDED
-#include
#include
#include
+#include
+#include
+
namespace boost {
namespace numeric {
namespace odeint {
-// same_size function
-// standard implementation relies on boost.range
-template< class State1 , class State2 >
-bool same_size( const State1 &x1 , const State2 &x2 )
-{
- return ( boost::size( x1 ) == boost::size( x2 ) );
-}
-// resize function
-// standard implementation relies on boost.range and resize member function
-template< class StateIn , class StateOut >
-void resize( StateOut &x1 , const StateIn &x2 )
-{
- x1.resize( boost::size( x2 ) );
-}
template< class V , bool resizeable = is_resizeable< V >::value >
struct state_wrapper;
+
+
//two standard implementations, with and without resizing depending on is_resizeable< StateType >
template< class V >
@@ -69,13 +59,15 @@ struct state_wrapper< V , true > // with resizing
template< class StateIn >
bool resize( const StateIn &x )
{
- //standard resizing done like for std::vector
- if( !same_size( x ) )
+ if( !this->same_size( x ) )
{
boost::numeric::odeint::resize( m_v , x );
return true;
- } else
+ }
+ else
+ {
return false;
+ }
}
};
diff --git a/boost/numeric/odeint/util/ublas_wrapper.hpp b/boost/numeric/odeint/util/ublas_wrapper.hpp
index 097278c2..7c7e044d 100644
--- a/boost/numeric/odeint/util/ublas_wrapper.hpp
+++ b/boost/numeric/odeint/util/ublas_wrapper.hpp
@@ -25,6 +25,7 @@
#include
#include
+#include
namespace boost {
namespace numeric {
@@ -66,63 +67,78 @@ struct is_resizeable< boost::numeric::ublas::permutation_matrix< T , A > >
// specialization for ublas::matrix
// same size and resize specialization for matrix-matrix resizing
template< class T , class L , class A , class T2 , class L2 , class A2 >
-bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m1 ,
- const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > >
{
- return ( ( m1.size1() == m2.size1() ) && ( m1.size2() == m2.size2() ) );
-}
+ static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m1 ,
+ const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+ {
+ return ( ( m1.size1() == m2.size1() ) && ( m1.size2() == m2.size2() ) );
+ }
+};
template< class T , class L , class A , class T2 , class L2 , class A2 >
-void resize( boost::numeric::ublas::matrix< T , L , A > &m1 ,
- const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::matrix< T2 , L2 , A2 > >
{
- m1.resize( m2.size1() , m2.size2() );
-}
+ static void resize( boost::numeric::ublas::matrix< T , L , A > &m1 ,
+ const boost::numeric::ublas::matrix< T2 , L2 , A2 > &m2 )
+ {
+ m1.resize( m2.size1() , m2.size2() );
+ }
+};
+
+
// same size and resize specialization for matrix-vector resizing
template< class T , class L , class A , class T_V , class A_V >
-bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m ,
- const boost::numeric::ublas::vector< T_V , A_V > &v )
+struct same_size_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > >
{
- return ( ( m.size1() == v.size() ) && ( m.size2() == v.size() ) );
-}
+ static bool same_size( const boost::numeric::ublas::matrix< T , L , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ return ( ( m.size1() == v.size() ) && ( m.size2() == v.size() ) );
+ }
+};
template< class T , class L , class A , class T_V , class A_V >
-void resize( boost::numeric::ublas::matrix< T , L , A > &m ,
- const boost::numeric::ublas::vector< T_V , A_V > &v )
+struct resize_impl< boost::numeric::ublas::matrix< T , L , A > , boost::numeric::ublas::vector< T_V , A_V > >
{
- m.resize( v.size() , v.size() );
-}
+ static void resize( boost::numeric::ublas::matrix< T , L , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ m.resize( v.size() , v.size() );
+ }
+};
// specialization for ublas::permutation_matrix
// same size and resize specialization for matrix-vector resizing
template< class T , class A , class T_V , class A_V >
-bool same_size( const boost::numeric::ublas::permutation_matrix< T , A > &m ,
- const boost::numeric::ublas::vector< T_V , A_V > &v )
+struct same_size_impl< boost::numeric::ublas::permutation_matrix< T , A > , boost::numeric::ublas::vector< T_V , A_V > >
{
- return ( m.size() == v.size() ); // && ( m.size2() == v.size() ) );
-}
+ static bool same_size( const boost::numeric::ublas::permutation_matrix< T , A > &m ,
+ const boost::numeric::ublas::vector< T_V , A_V > &v )
+ {
+ return ( m.size() == v.size() ); // && ( m.size2() == v.size() ) );
+ }
+};
template< class T , class A , class T_V , class A_V >
-void resize( const boost::numeric::ublas::vector< T_V , A_V > &v,
- boost::numeric::ublas::permutation_matrix< T , A > &m )
+struct resize_impl< boost::numeric::ublas::vector< T_V , A_V > , boost::numeric::ublas::permutation_matrix< T , A > >
{
- m.resize( v.size() , v.size() );
-}
+ static void resize( const boost::numeric::ublas::vector< T_V , A_V > &v,
+ boost::numeric::ublas::permutation_matrix< T , A > &m )
+ {
+ m.resize( v.size() , v.size() );
+ }
+};
+
+
-} } }
-// all specializations done, ready to include state_wrapper
-#include
-namespace boost {
-namespace numeric {
-namespace odeint {
-/* specialization for permutation matrizes wrapper because we need to change the construction */
template< class T , class A >
struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > , true > // with resizing
{
@@ -139,7 +155,7 @@ struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > , true
template< class T_V , class A_V >
bool same_size( const boost::numeric::ublas::vector< T_V , A_V > &x )
{
- return boost::numeric::odeint::same_size( m_v , x );
+ return boost::numeric::odeint::same_size_impl< state_type , boost::numeric::ublas::vector< T_V , A_V > >::same_size( m_v , x );
}
template< class T_V , class A_V >
@@ -148,16 +164,62 @@ struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > , true
//standard resizing done like for std::vector
if( !same_size( x ) )
{
- boost::numeric::odeint::resize( m_v , x );
+ boost::numeric::odeint::resize_impl< state_type , boost::numeric::ublas::vector< T_V , A_V > >::resize( m_v , x );
return true;
} else
return false;
}
};
-}
-}
-}
+
+
+
+} } }
+
+//// all specializations done, ready to include state_wrapper
+//
+//#include
+//
+//namespace boost {
+//namespace numeric {
+//namespace odeint {
+//
+///* specialization for permutation matrizes wrapper because we need to change the construction */
+//template< class T , class A >
+//struct state_wrapper< boost::numeric::ublas::permutation_matrix< T , A > , true > // with resizing
+//{
+// typedef boost::numeric::ublas::permutation_matrix< T , A > state_type;
+// typedef state_wrapper< state_type > state_wrapper_type;
+// //typedef typename V::value_type value_type;
+// typedef boost::true_type is_resizeable;
+//
+// state_type m_v;
+//
+// state_wrapper() : m_v( 1 ) // permutation matrix constructor requires a size, choose 1 as default
+// { }
+//
+// template< class T_V , class A_V >
+// bool same_size( const boost::numeric::ublas::vector< T_V , A_V > &x )
+// {
+// return boost::numeric::odeint::same_size( m_v , x );
+// }
+//
+// template< class T_V , class A_V >
+// bool resize( const boost::numeric::ublas::vector< T_V , A_V > &x )
+// {
+// //standard resizing done like for std::vector
+// if( !same_size( x ) )
+// {
+// boost::numeric::odeint::resize( m_v , x );
+// return true;
+// } else
+// return false;
+// }
+//};
+//
+//}
+//}
+//}
/*
diff --git a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/integrate_functions.html b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/integrate_functions.html
index 9e90475b..70fe3b29 100644
--- a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/integrate_functions.html
+++ b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/integrate_functions.html
@@ -101,12 +101,11 @@
is considerably larger than typical step sizes used by the stepper.
- If stepper is a Dense
- Output Stepper then dt
- is the initial step size. The actual step size will be adjusted during
- integration due to error control. If an observer is provided dense output
- is used to calculate x(t) at t = t0 + n
- dt.
+ If stepper is a __dense_out_stepper
+ then dt is the initial
+ step size. The actual step size will be adjusted during integration due
+ to error control. If an observer is provided dense output is used to
+ calculate x(t) at t = t0 + n dt.
@@ -117,9 +116,8 @@
If the observer should be called at each time step then the integrate_adaptive function should be used.
Note that in the case of Controlled
- Stepper or Dense
- Output Stepper this leads to non-equidistant observer calls as the
- step size changes.
+ Stepper or __dense_out_stepper this leads to non-equidistant observer
+ calls as the step size changes.
integrate_adaptive(
@@ -172,8 +170,7 @@
the first step at t0).
- If stepper is a Dense
- Output Stepper then dt
+ If stepper is a __dense_out_stepper then dt
is the initial step size and integrate_adaptive
behaves just like for Controlled
Stepper above. No dense output is used.
@@ -247,11 +244,11 @@
exactly at the time point.
- If stepper is a Dense
- Output Stepper then dt
- is the initial step size. The actual step size is adjusted during integration
- according to error control. Dense output is used to obtain the states
- x(t) at the time points from the sequence.
+ If stepper is a __dense_out_stepper
+ then dt is the initial
+ step size. The actual step size is adjusted during integration according
+ to error control. Dense output is used to obtain the states x(t)
+ at the time points from the sequence.
@@ -274,8 +271,7 @@
This function works only with steppers fullfilling the Stepper
or Error
Stepper concept! Providing a Controlled
- Stepper or Dense
- Output Stepper results in a compilationerror.
+ Stepper or __dense_out_stepper results in a compilationerror.
- Two hierarchies: steppers by concept, steppers by type (explicit, symplectic
- and separable, implicit, multistep methods)
+ The steppers can be sorted into two hierarchies, one desribes the mathematical
+ properties of the stepper while the other one describes the steppers in terms
+ of C++ concepts.
@@ -37,7 +38,19 @@
by concept
- bla, see cp2 article
+ odeint introduces four concepts for the steppers. These concepts are describes
+ in detail in Concepts.
+ The most general concept is the Stepper
+ concept which defines the basic requirements one expects on a solver of
+ an ODE. Any stepper fulfilling this concept has to have a method do_step(sys,x,t,dt)
+ which performs a single step. The Error
+ Stepper concept is a simple enhancement where the do_step also computes an error estimate
+ which is made during one step. Furthermore there exist a concept Controlled
+ Stepper which tries to perform a step and which might
+ accept or reject this step due to some accurrancy requirements. The fourth
+ concept is the Dense
+ Output Stepper which provides methods for the calculation
+ of intermediate values during two steps.
+ Solving ordinary differential equation numerically is ususally done iteratively,
+ that is a given state of an ordinary differential equation x(t)
+ -> x(t+dt) -> x(t+2dt)
+
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)
@@ -134,7 +134,7 @@
-
Last revised: October 27, 2011 at 10:36:19 GMT
+
Last revised: October 29, 2011 at 22:44:13 GMT
diff --git a/libs/numeric/odeint/doc/details.qbk b/libs/numeric/odeint/doc/details.qbk
index eca9613d..80fb7c40 100644
--- a/libs/numeric/odeint/doc/details.qbk
+++ b/libs/numeric/odeint/doc/details.qbk
@@ -15,7 +15,7 @@
Integrate functions perform the time evolution of a given ODE from some starting time ['t[sub 0]] to ['t[sub 1]] and a given start state ['x[sub 0]] by subsequent calls of a given stepper's `do_step` function.
Additionally, the user can provide an __observer to analyze the state during time evolution.
There are five different integrate functions which have different strategies on when to call the observer function during integration.
-All of the integrate functions except `integrate_n_steps` can be called with any stepper following one of the stepper concepts: __stepper , __error_stepper , __controlled_stepper , __dense_out_stepper.
+All of the integrate functions except `integrate_n_steps` can be called with any stepper following one of the stepper concepts: __stepper , __error_stepper , __controlled_stepper , __dense_output_stepper.
Depending on the abilities of the stepper, the integrate functions make use of step-size control or dense output.
[heading Equidistant observer calls]
diff --git a/libs/numeric/odeint/doc/details_steppers.qbk b/libs/numeric/odeint/doc/details_steppers.qbk
index 65ce0160..28d710d1 100644
--- a/libs/numeric/odeint/doc/details_steppers.qbk
+++ b/libs/numeric/odeint/doc/details_steppers.qbk
@@ -1,15 +1,21 @@
[section Steppers]
-Two hierarchies: steppers by concept, steppers by type (explicit, symplectic and separable, implicit, multistep methods)
+The steppers can be sorted into two hierarchies, one desribes the mathematical properties of the stepper while the other one describes the steppers in terms of C++ concepts.
[section Steppers by concept]
-bla, see cp2 article
+odeint introduces four concepts for the steppers. These concepts are describes in detail in __concepts. The most general concept is the *__stepper* concept which defines the basic requirements one expects on a solver of an ODE. Any stepper fulfilling this concept has to have a method `do_step(sys,x,t,dt)` which performs a single step. The *__error_stepper* concept is a simple enhancement where the `do_step` also computes an error estimate which is made during one step. Furthermore there exist a concept *__controlled_stepper* which tries to perform a step and which might accept or reject this step due to some accurrancy requirements. The fourth concept is the *__dense_output_stepper* which provides methods for the calculation of intermediate values during two steps.
[endsect]
[section Steppers by type]
+Solving ordinary differential equation numerically is ususally done iteratively, that is a given state of an ordinary differential equation [' x(t) -> x(t+dt) -> x(t+2dt)]
+
+`do_step( sys , inout , t , dt )`
+
+`do_step( sys , in , t , out , dt )`
+
[* Explicit steppers]
`do_step( sys , in , dxdtin , out , t , dt )`
@@ -22,6 +28,8 @@ examples and models
[* Symplectic steppers]
+
+
[* Implicit steppers]
Need Jacobian
@@ -36,6 +44,10 @@ Good performance
[endsect]
+[* Controlled steppers]
+
+[* Dense output steppers]
+
[section Using steppers]
steppers are always copied, in integrate_functions or in nested steppers
diff --git a/libs/numeric/odeint/doc/examples_table.qbk b/libs/numeric/odeint/doc/examples_table.qbk
index e57db6f3..3b8bed17 100644
--- a/libs/numeric/odeint/doc/examples_table.qbk
+++ b/libs/numeric/odeint/doc/examples_table.qbk
@@ -13,4 +13,5 @@
[[[@../../examples/thrust/phase_oscillator_ensemble.cu phase_oscillator_ensemble.cu]] [The Thrust phase oscillator ensemble example shows how globally coupled oscillators can be analyzed with Thrust and CUDA, employing the power of modern graphic devices.]]
[[[@../../examples/thrust/phase_oscillator_chain.cu phase_oscillator_chain.cu]] [The Thrust phase oscillator chain example shows how chains of nearest neighbor coupled oscillators can be integrated with Thrust and odeint.]]
[[[@../../examples/thrust/lorenz_parameters.cu lorenz_parameters.cu]] [The Lorenz paramaters examples show how ensembles of ordinary differential equations can be solved by means of Thrust to study the dependence of an ODE on some parameters.]]
+ [[[@../../examples/mtl/gauss_packet.cpp gauss_packet.cpp]] [The MTL-Gauss-packet example shows how the mtl can be easily used with odeint.]]
]
diff --git a/libs/numeric/odeint/doc/html/index.html b/libs/numeric/odeint/doc/html/index.html
deleted file mode 100644
index 09a0f3dd..00000000
--- a/libs/numeric/odeint/doc/html/index.html
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-Chapter 1. boost.sandbox.numeric.odeint
-
-
-
-
-
-
-
- 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)
-