From 7d1791f85f5bc36af5c84eef4df57746363f855a Mon Sep 17 00:00:00 2001 From: Karsten Ahnert Date: Sun, 30 Oct 2011 00:49:31 +0200 Subject: [PATCH] same_size and resize to static structs, and documentation --- boost/numeric/odeint.hpp | 1 + boost/numeric/odeint/util/state_wrapper.hpp | 28 ++-- boost/numeric/odeint/util/ublas_wrapper.hpp | 134 +++++++++++----- .../odeint_in_detail/integrate_functions.html | 32 ++-- .../odeint_in_detail/steppers.html | 45 +++++- .../tutorial/all_examples.html | 13 ++ doc/index.html | 4 +- libs/numeric/odeint/doc/details.qbk | 2 +- libs/numeric/odeint/doc/details_steppers.qbk | 16 +- libs/numeric/odeint/doc/examples_table.qbk | 1 + libs/numeric/odeint/doc/html/index.html | 143 ------------------ libs/numeric/odeint/doc/odeint.qbk | 4 +- libs/numeric/odeint/doc/stepper_table.qbk | 10 +- libs/numeric/odeint/examples/Jamfile | 4 +- .../odeint/examples/mtl/gauss_packet.cpp | 5 +- .../odeint/examples/mtl/mtl_bindings.hpp | 43 ++++-- libs/numeric/odeint/test/integrate.cpp | 18 +++ .../odeint/test/integrate_implicit.cpp | 11 +- 18 files changed, 269 insertions(+), 245 deletions(-) delete mode 100644 libs/numeric/odeint/doc/html/index.html 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.

    diff --git a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/steppers.html b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/steppers.html index 9955ccf5..5c13ca8d 100644 --- a/doc/boost_sandbox_numeric_odeint/odeint_in_detail/steppers.html +++ b/doc/boost_sandbox_numeric_odeint/odeint_in_detail/steppers.html @@ -28,8 +28,9 @@ 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.

    @@ -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.

    @@ -45,6 +58,26 @@ 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

    @@ -95,6 +128,12 @@ Good performance

    +

    + Controlled steppers +

    +

    + Dense output steppers +

    diff --git a/doc/index.html b/doc/index.html index 09a0f3dd..1b2d14ec 100644 --- a/doc/index.html +++ b/doc/index.html @@ -24,7 +24,7 @@
    -

    +

    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 - - - - - - -
    -
    -
    Next
    - - - - -

    Last revised: October 27, 2011 at 10:36:19 GMT

    -
    -
    Next
    - - diff --git a/libs/numeric/odeint/doc/odeint.qbk b/libs/numeric/odeint/doc/odeint.qbk index d9689a41..de05d444 100644 --- a/libs/numeric/odeint/doc/odeint.qbk +++ b/libs/numeric/odeint/doc/odeint.qbk @@ -39,6 +39,8 @@ [def __intel_mkl [@http://software.intel.com/en-us/articles/intel-mkl/ Intel Math Kernel Library]] +[def __concepts + [link boost_sandbox_numeric_odeint.concepts Concepts]] [def __system [link boost_sandbox_numeric_odeint.concepts.system System]] [def __symplectic_system @@ -53,7 +55,7 @@ [link boost_sandbox_numeric_odeint.concepts.error_stepper Error Stepper]] [def __controlled_stepper [link boost_sandbox_numeric_odeint.concepts.controlled_stepper Controlled Stepper]] -[def __dense_out_stepper +[def __dense_output_stepper [link boost_sandbox_numeric_odeint.concepts.dense_output_stepper Dense Output Stepper]] [def __observer [link boost_sandbox_numeric_odeint.concepts.observer observer]] diff --git a/libs/numeric/odeint/doc/stepper_table.qbk b/libs/numeric/odeint/doc/stepper_table.qbk index f7bc97e7..085c82cc 100644 --- a/libs/numeric/odeint/doc/stepper_table.qbk +++ b/libs/numeric/odeint/doc/stepper_table.qbk @@ -1,6 +1,6 @@ [table Stepper Algorithms [[Algorithm] [Class] [Concept] [System Concept] [Order] [Error Estimation] [Dense Output] [Remarks]] - [[Explicit Euler] [`euler`] [__dense_out_stepper] [__system] [1] [No] [Yes] [Very simple, only for demonstrating purpose]] + [[Explicit Euler] [`euler`] [__dense_output_stepper] [__system] [1] [No] [Yes] [Very simple, only for demonstrating purpose]] [[Modified Midpoint] [`modified_midpoint`] [__stepper] [__system] [configurable (2)] [No] [No] [Used in Bulirsch-Stoer implementation]] [[Runge-Kutta 4] [`runge_kutta4`] [__stepper] [__system] [4] [No] [No] [The classical Runge Kutta scheme, good general scheme without error control]] [[Cash-Karp] [`runge_kutta_cash_karp54`] [__error_stepper] [__system] [5] [Yes (4)] [No] [Good general scheme with error estimation, to be used in controlled_error_stepper]] @@ -12,16 +12,16 @@ [[Adams Bashforth Moulton] [`adams_bashforth_moulton`] [__stepper] [__system] [configurable] [No] [No] [Combined multistep method]] [[Controlled Error Stepper] [`controlled_error_stepper`] [__controlled_stepper] [__system] [depends] [Yes] [No] [Error control for __error_stepper. Requires an __error_stepper from above. Order depends on the given ErrorStepper]] - [[Dense Output Stepper] [`dense_output_explicit`] [__dense_out_stepper] [__system] [depends] [No] [Yes] [Dense ouput for __stepper and __error_stepper from above if they provide dense ouput functionality (like `euler` and `runge_kutta_dopri5`). Order depends on the given stepper.]] - [[Dense Output Controlled Stepper] [`dense_output_controlled_explicit`] [__dense_out_stepper] [__system] [depends] [No] [Yes] [Dense ouput for __controlled_stepper from above if they provide dense ouput functionality (like `controlled_error_stepper< runge_kutta_dopri5 >`). Order depends on the given stepper.]] + [[Dense Output Stepper] [`dense_output_explicit`] [__dense_output_stepper] [__system] [depends] [No] [Yes] [Dense ouput for __stepper and __error_stepper from above if they provide dense ouput functionality (like `euler` and `runge_kutta_dopri5`). Order depends on the given stepper.]] + [[Dense Output Controlled Stepper] [`dense_output_controlled_explicit`] [__dense_output_stepper] [__system] [depends] [No] [Yes] [Dense ouput for __controlled_stepper from above if they provide dense ouput functionality (like `controlled_error_stepper< runge_kutta_dopri5 >`). Order depends on the given stepper.]] [[Bulirsch-Stoer] [`bulirsch_stoer`] [__controlled_stepper] [__system] [variable] [Yes] [No] [Stepper with step size and order control. Very good if high precision is required.]] - [[Bulirsch-Stoer Dense Output] [`bulirsch_stoer_dense_out`] [__dense_out_stepper] [__system] [variable] [Yes] [Yes] [Stepper with step size and order control as well as dense ouput. Very good if high precision and dense ouput is required.]] + [[Bulirsch-Stoer Dense Output] [`bulirsch_stoer_dense_out`] [__dense_output_stepper] [__system] [variable] [Yes] [Yes] [Stepper with step size and order control as well as dense ouput. Very good if high precision and dense ouput is required.]] [[Implicit Euler] [`implicit_euler`] [__stepper] [__implicit_system] [1] [No] [No] [Basic implicit routine. Requires the Jacobian. Works only with __ublas vectors as state types.]] [[Rosenbrock 4] [`rosenbrock4`] [__error_stepper] [__implicit_system] [4] [Yes] [Yes] [Good for stiff systems. Works only with __ublas vectors as state types.]] [[Controlled Rosenbrock 4] [`rosenbrock4_controller`] [__controlled_stepper] [__implicit_system] [4] [Yes] [Yes] [Rosenbrock 4 with error control. Works only with __ublas vectors as state types.]] - [[Dense Ouput Rosenbrock 4] [`rosenbrock4_dense_ouput`] [__dense_out_stepper] [__implicit_system] [4] [Yes] [Yes] [Controlled Rosenbrock 4 with dense output. Works only with __ublas vectors as state types.]] + [[Dense Ouput Rosenbrock 4] [`rosenbrock4_dense_ouput`] [__dense_output_stepper] [__implicit_system] [4] [Yes] [Yes] [Controlled Rosenbrock 4 with dense output. Works only with __ublas vectors as state types.]] [[Symplectic Euler] [`symplectic_euler`] [__stepper] [__symplectic_system __simple_symplectic_system] [1] [No] [No] [Basic symplectic solver for separable Hamiltonian system]] [[Symplectic RKN McLachlan] [`symplectic_rkn_sb3a_mclachlan`] [__stepper] [__symplectic_system __simple_symplectic_system] [6] [No] [No] [Symplectic solver for separable Hamiltonian system with order 6]] diff --git a/libs/numeric/odeint/examples/Jamfile b/libs/numeric/odeint/examples/Jamfile index d71438b2..06300c83 100644 --- a/libs/numeric/odeint/examples/Jamfile +++ b/libs/numeric/odeint/examples/Jamfile @@ -28,4 +28,6 @@ exe two_dimensional_phase_lattice : two_dimensional_phase_lattice.cpp ; exe lorenz_gmpxx : lorenz_gmpxx.cpp libgmp libgmpxx ; exe bulirsch_stoer : bulirsch_stoer.cpp ; exe elliptic_functions : elliptic_functions.cpp ; -exe resizing_lattice : resizing_lattice.cpp ; \ No newline at end of file +exe resizing_lattice : resizing_lattice.cpp ; + +build-project mtl ; \ No newline at end of file diff --git a/libs/numeric/odeint/examples/mtl/gauss_packet.cpp b/libs/numeric/odeint/examples/mtl/gauss_packet.cpp index 6b15d3c0..7daf2189 100644 --- a/libs/numeric/odeint/examples/mtl/gauss_packet.cpp +++ b/libs/numeric/odeint/examples/mtl/gauss_packet.cpp @@ -15,12 +15,11 @@ #include #include +#include #include "mtl_bindings.hpp" -#include -#include -#include + using namespace std; using namespace boost::numeric::odeint; diff --git a/libs/numeric/odeint/examples/mtl/mtl_bindings.hpp b/libs/numeric/odeint/examples/mtl/mtl_bindings.hpp index 8989d773..39b7dd7e 100644 --- a/libs/numeric/odeint/examples/mtl/mtl_bindings.hpp +++ b/libs/numeric/odeint/examples/mtl/mtl_bindings.hpp @@ -9,23 +9,46 @@ #define MTL_BINDINGS_HPP_ #include +#include + +namespace boost { +namespace numeric { +namespace odeint { + + +template< class Value , class Parameters > +struct is_resizeable< mtl::dense_vector< Value , Parameters > > +{ + typedef boost::true_type type; + const static bool value = type::value; +}; -namespace boost { namespace numeric { namespace odeint { template< class Value1 , class Parameters1 , class Value2 , class Parameters2 > -bool same_size( mtl::dense_vector< Value1 , Parameters1 > &v1 , - const mtl::dense_vector< Value2 , Parameters2 > &v2 ) +struct same_size_impl< mtl::dense_vector< Value1 , Parameters1 > , mtl::dense_vector< Value2 , Parameters2 > > { - return mtl::size( v1 ) == mtl::size( v2 ); -} + static bool same_size( const mtl::dense_vector< Value1 , Parameters1 > &v1 , + const mtl::dense_vector< Value2 , Parameters2 > &v2 ) + { + return mtl::size( v1 ) == mtl::size( v2 ); + } +}; + template< class Value1 , class Parameters1 , class Value2 , class Parameters2 > -void resize( mtl::dense_vector< Value1 , Parameters1 > &v1 , - const mtl::dense_vector< Value2 , Parameters2 > &v2 ) +struct resize_impl< mtl::dense_vector< Value1 , Parameters1 > , mtl::dense_vector< Value2 , Parameters2 > > { - v1.change_dim( mtl::size( v2 ) ); -} + static void resize( mtl::dense_vector< Value1 , Parameters1 > &v1 , + const mtl::dense_vector< Value2 , Parameters2 > &v2 ) + { + v1.change_dim( mtl::size( v2 ) ); + } +}; -} } } + + +} +} +} #endif /* MTL_BINDINGS_HPP_ */ diff --git a/libs/numeric/odeint/test/integrate.cpp b/libs/numeric/odeint/test/integrate.cpp index 169f5de8..7ab6f8d2 100644 --- a/libs/numeric/odeint/test/integrate.cpp +++ b/libs/numeric/odeint/test/integrate.cpp @@ -21,8 +21,26 @@ #include +// nearly everything from odeint is used in these tests #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + using namespace boost::unit_test; using namespace boost::numeric::odeint; namespace mpl = boost::mpl; diff --git a/libs/numeric/odeint/test/integrate_implicit.cpp b/libs/numeric/odeint/test/integrate_implicit.cpp index 19ba21c2..6d962d8c 100644 --- a/libs/numeric/odeint/test/integrate_implicit.cpp +++ b/libs/numeric/odeint/test/integrate_implicit.cpp @@ -23,7 +23,14 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include + using namespace boost::unit_test; using namespace boost::numeric::odeint; @@ -207,4 +214,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( integrate_n_steps_test_case , Stepper, simple_ste tester(); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END()