|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58351 - in sandbox/odeint/boost: . numeric numeric/odeint numeric/odeint/concepts numeric/odeint/detail
From: karsten.ahnert_at_[hidden]
Date: 2009-12-13 08:30:55
Author: karsten
Date: 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
New Revision: 58351
URL: http://svn.boost.org/trac/boost/changeset/58351
Log:
merging branch back into trunk
Added:
sandbox/odeint/boost/numeric/odeint/container_traits.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits.hpp
sandbox/odeint/boost/numeric/odeint/container_traits_blitz_array.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_blitz_array.hpp
sandbox/odeint/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_mtl4_dense2d.hpp
sandbox/odeint/boost/numeric/odeint/container_traits_tr1_array.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_tr1_array.hpp
sandbox/odeint/boost/numeric/odeint/container_traits_ublas_matrix.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/container_traits_ublas_matrix.hpp
sandbox/odeint/boost/numeric/odeint/hamiltonian_stepper_euler.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/hamiltonian_stepper_euler.hpp
sandbox/odeint/boost/numeric/odeint/hamiltonian_stepper_rk.hpp
- copied unchanged from r58350, /sandbox/odeint/branches/karsten/boost/numeric/odeint/hamiltonian_stepper_rk.hpp
Properties modified:
sandbox/odeint/boost/ (props changed)
sandbox/odeint/boost/numeric/odeint/concepts/ (props changed)
sandbox/odeint/boost/numeric/odeint/concepts/state_concept.hpp (props changed)
sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp (contents, props changed)
sandbox/odeint/boost/numeric/odeint/integrator_constant_stepsize.hpp (props changed)
sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp (contents, props changed)
sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp (contents, props changed)
Binary files modified:
sandbox/odeint/boost/numeric/odeint/stepper_rk5_ck.hpp
Text files modified:
sandbox/odeint/boost/numeric/odeint.hpp | 13 +
sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp | 45 +++----
sandbox/odeint/boost/numeric/odeint/controlled_stepper_standard.hpp | 29 ++--
sandbox/odeint/boost/numeric/odeint/detail/iterator_algebra.hpp | 180 ++++++++++++++++++++------------
sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp | 9
sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp | 46 +++-----
sandbox/odeint/boost/numeric/odeint/stepper_half_step.hpp | 33 ++---
sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp | 62 +++++-----
sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp | 84 +++++++--------
sandbox/odeint/boost/numeric/odeint/stepper_rk4_classical.hpp | 58 ++++-----
sandbox/odeint/boost/numeric/odeint/stepper_rk78_fehlberg.hpp | 221 ++++++++++++++++++++-------------------
sandbox/odeint/boost/numeric/odeint/stepper_rk_generic.hpp | 43 +++----
12 files changed, 418 insertions(+), 405 deletions(-)
Modified: sandbox/odeint/boost/numeric/odeint.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -15,15 +15,24 @@
#ifndef BOOST_NUMERIC_ODEINT_HPP
#define BOOST_NUMERIC_ODEINT_HPP
+#include <boost/config.hpp>
+
+#include <boost/numeric/odeint/container_traits.hpp>
+#include <boost/numeric/odeint/container_traits_tr1_array.hpp>
+
#include <boost/numeric/odeint/stepper_euler.hpp>
+#include <boost/numeric/odeint/stepper_half_step.hpp>
#include <boost/numeric/odeint/stepper_rk4.hpp>
#include <boost/numeric/odeint/stepper_rk4_classical.hpp>
#include <boost/numeric/odeint/stepper_rk5_ck.hpp>
-#include <boost/numeric/odeint/stepper_rk_generic.hpp>
-#include <boost/numeric/odeint/stepper_half_step.hpp>
+//#include <boost/numeric/odeint/stepper_rk_generic.hpp>
#include <boost/numeric/odeint/stepper_midpoint.hpp>
#include <boost/numeric/odeint/stepper_rk78_fehlberg.hpp>
+#include <boost/numeric/odeint/hamiltonian_stepper_euler.hpp>
+#include <boost/numeric/odeint/hamiltonian_stepper_rk.hpp>
+
+
#include <boost/numeric/odeint/controlled_stepper_standard.hpp>
#include <boost/numeric/odeint/controlled_stepper_bs.hpp>
Modified: sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -19,13 +19,11 @@
#include <limits>
-#include <boost/concept_check.hpp>
-
#include <boost/numeric/odeint/detail/iterator_algebra.hpp>
#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
#include <boost/numeric/odeint/stepper_midpoint.hpp>
#include <boost/numeric/odeint/error_checker_standard.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
#include <iostream>
@@ -33,38 +31,32 @@
namespace numeric {
namespace odeint {
- // typedef enum{success, step_size_decreased, step_size_increased} controlled_step_result;
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class controlled_stepper_bs
{
// provide basic typedefs
public:
- typedef Container container_type;
- typedef Resizer resizer_type;
+ typedef unsigned short order_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
- // check the concept of the ContainerType
- private:
+ typedef Traits traits_type;
+ typedef typename traits_type::container_type container_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
// private memebers
private:
- stepper_midpoint< Container, Time, Resizer > m_stepper_mp;
- resizer_type m_resizer;
- error_checker_standard<container_type, time_type> m_error_checker;
+
+ stepper_midpoint< container_type, time_type, traits_type > m_stepper_mp;
+ error_checker_standard< container_type, time_type > m_error_checker;
const unsigned short m_k_max;
@@ -141,9 +133,9 @@
time_type &t ,
time_type &dt )
{
- m_resizer.adjust_size(x, m_xerr);
- m_resizer.adjust_size(x, m_x_mp);
- m_resizer.adjust_size(x, m_x_scale);
+ traits_type::adjust_size(x, m_xerr);
+ traits_type::adjust_size(x, m_x_mp);
+ traits_type::adjust_size(x, m_x_scale);
// get error scale
m_error_checker.fill_scale(x, dxdt, dt, m_x_scale);
@@ -275,7 +267,7 @@
time_type &t,
time_type &dt )
{
- m_resizer.adjust_size(x, m_dxdt);
+ traits_type::adjust_size(x, m_dxdt);
system(x, m_dxdt, t);
return try_step(system, x, m_dxdt, t, dt );
}
@@ -318,10 +310,10 @@
container_type &x,
container_type &x_err )
{
- //m_resizer.adjust_size(x, m_c);
+ //traits_type::adjust_size(x, m_c);
//std::vector< container_type > m_d_iter = m_d.begin();
//while( m_d_iter != m_d.end() )
- // m_resizer.adjust_size(x, (*m_d_iter++));
+ // traits_type::adjust_size(x, (*m_d_iter++));
m_times[k_est] = t_est;
x_err = x = x_est;
@@ -331,7 +323,8 @@
if( k_est == 0 )
{
m_d[0] = x_est;
- } else
+ }
+ else
{
m_c = x_est;
for( unsigned short k=0; k<k_est; k++ )
Modified: sandbox/odeint/boost/numeric/odeint/controlled_stepper_standard.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/controlled_stepper_standard.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/controlled_stepper_standard.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -21,7 +21,7 @@
#include <boost/numeric/odeint/detail/iterator_algebra.hpp>
#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
namespace boost {
namespace numeric {
@@ -33,6 +33,7 @@
step_size_increased
} controlled_step_result;
+
/*
The initial state is given in x.
@@ -55,27 +56,27 @@
the increase factor to 5.0.
*/
- template<
- class ErrorStepper,
- class ResizeType = resizer< typename ErrorStepper::container_type > >
+ template< class ErrorStepper >
class controlled_stepper_standard
{
public:
// forward types from ErrorStepper
- typedef typename ErrorStepper::container_type container_type;
- typedef typename ErrorStepper::resizer_type resizer_type;
- typedef typename ErrorStepper::time_type time_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef ErrorStepper stepper_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::container_type container_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::traits_type traits_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::iterator iterator;
+ typedef typename stepper_type::const_iterator const_iterator;
- typedef unsigned short order_type;
// private members
private:
- ErrorStepper &m_stepper;
+ stepper_type &m_stepper;
time_type m_eps_abs;
time_type m_eps_rel;
@@ -84,8 +85,6 @@
container_type m_dxdt;
container_type m_x_tmp;
container_type m_x_err;
- resizer_type m_resizer;
-
// private methods
@@ -145,8 +144,8 @@
time_type &t,
time_type &dt )
{
- m_resizer.adjust_size( x , m_x_err );
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_x_err );
+ traits_type::adjust_size( x , m_dxdt );
m_x_tmp = x;
system( x , m_dxdt , t );
Modified: sandbox/odeint/boost/numeric/odeint/detail/iterator_algebra.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/detail/iterator_algebra.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/detail/iterator_algebra.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -40,7 +40,6 @@
(*first1++) += alpha * (*first2++);
}
-
// computes y = x1 - x2
template <
class OutputIterator ,
@@ -57,6 +56,7 @@
(*first1++) = (*first2++) - (*first3++);
}
+
// computes y = x1 + alpha * x2
template <
class OutputIterator ,
@@ -76,6 +76,7 @@
}
+
// computes y = alpha1 * ( x1 + x2 + alpha2*x3 )
template <
class OutputIterator ,
@@ -96,9 +97,12 @@
{
while( first1 != last1 )
(*first1++) += alpha1 *
- ( (*first2++) + (*first3++) + alpha2*(*first4++) );
+ ( (*first2++) + (*first3++) + alpha2 * (*first4++) );
}
+
+
+
// computes y = alpha1*x1 + alpha2*x2
template <
class OutputIterator ,
@@ -114,24 +118,28 @@
InputIterator2 x2_begin )
{
while( y_begin != y_end )
- (*y_begin++) = alpha1 * (*x1_begin++) + alpha2 * (*x2_begin++);
+ (*y_begin++) =
+ alpha1 * (*x1_begin++) +
+ alpha2 * (*x2_begin++);
}
// computes y = x1 + alpha2*x2 + alpha3*x3
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin )
+ InputIterator3 x3_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -143,19 +151,22 @@
// computes y = x1 + alpha2*x2 + alpha3*x3 + alpha4*x4
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin )
+ InputIterator4 x4_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -168,21 +179,25 @@
// computes y = x1 + alpha2*x2 + alpha3*x3 + alpha4*x4 + alpha5*x5
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin )
+ InputIterator5 x5_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -198,23 +213,28 @@
// + alpha6*x6
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
+ class InputIterator6 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin ,
+ InputIterator5 x5_begin ,
T alpha6 ,
- InputIterator x6_begin )
+ InputIterator6 x6_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -231,25 +251,31 @@
// + alpha6*x6 + alpha7*x7
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
+ class InputIterator6 ,
+ class InputIterator7 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin ,
+ InputIterator5 x5_begin ,
T alpha6 ,
- InputIterator x6_begin ,
+ InputIterator6 x6_begin ,
T alpha7 ,
- InputIterator x7_begin )
+ InputIterator7 x7_begin )
{
while( y_begin != y_end )
@@ -269,29 +295,34 @@
// + alpha6*x6 + alpha7*x7 + alpha8*x8
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
+ class InputIterator6 ,
+ class InputIterator7 ,
+ class InputIterator8 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin ,
+ InputIterator5 x5_begin ,
T alpha6 ,
- InputIterator x6_begin ,
+ InputIterator6 x6_begin ,
T alpha7 ,
- InputIterator x7_begin ,
+ InputIterator7 x7_begin ,
T alpha8 ,
- InputIterator x8_begin )
-
-
+ InputIterator8 x8_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -309,31 +340,37 @@
// + alpha6*x6 + alpha7*x7 + alpha8*x8 + alpha9*x9
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
+ class InputIterator6 ,
+ class InputIterator7 ,
+ class InputIterator8 ,
+ class InputIterator9 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin ,
+ InputIterator5 x5_begin ,
T alpha6 ,
- InputIterator x6_begin ,
+ InputIterator6 x6_begin ,
T alpha7 ,
- InputIterator x7_begin ,
+ InputIterator7 x7_begin ,
T alpha8 ,
- InputIterator x8_begin ,
+ InputIterator8 x8_begin ,
T alpha9 ,
- InputIterator x9_begin )
-
-
+ InputIterator9 x9_begin )
{
while( y_begin != y_end )
(*y_begin++) =
@@ -355,31 +392,40 @@
// + alpha6*x6 + alpha7*x7 + alpha8*x8 + alpha9*x9 + alpha10*x10
template <
class OutputIterator ,
- class InputIterator ,
+ class InputIterator1 ,
+ class InputIterator2 ,
+ class InputIterator3 ,
+ class InputIterator4 ,
+ class InputIterator5 ,
+ class InputIterator6 ,
+ class InputIterator7 ,
+ class InputIterator8 ,
+ class InputIterator9 ,
+ class InputIterator10 ,
class T
>
inline void scale_sum( OutputIterator y_begin ,
OutputIterator y_end ,
T alpha1 ,
- InputIterator x1_begin ,
+ InputIterator1 x1_begin ,
T alpha2 ,
- InputIterator x2_begin ,
+ InputIterator2 x2_begin ,
T alpha3 ,
- InputIterator x3_begin ,
+ InputIterator3 x3_begin ,
T alpha4 ,
- InputIterator x4_begin ,
+ InputIterator4 x4_begin ,
T alpha5 ,
- InputIterator x5_begin ,
+ InputIterator5 x5_begin ,
T alpha6 ,
- InputIterator x6_begin ,
+ InputIterator6 x6_begin ,
T alpha7 ,
- InputIterator x7_begin ,
+ InputIterator7 x7_begin ,
T alpha8 ,
- InputIterator x8_begin ,
+ InputIterator8 x8_begin ,
T alpha9 ,
- InputIterator x9_begin ,
+ InputIterator9 x9_begin ,
T alpha10 ,
- InputIterator x10_begin
+ InputIterator10 x10_begin
)
{
while( y_begin != y_end )
Modified: sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/integrator_adaptive_stepsize.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -14,7 +14,6 @@
#define BOOST_NUMERIC_ODEINT_INTEGRATOR_ADAPTIVE_STEPSIZE_HPP
#include <boost/numeric/odeint/controlled_stepper_standard.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
#include <boost/numeric/odeint/observer.hpp>
#include <vector>
#include <limits>
@@ -117,7 +116,8 @@
if( times.empty() ) return 0;
else
{
- state_copy_observer<InsertIterator, TimeSequence> observer(times, state_inserter);
+ state_copy_observer<InsertIterator, TimeSequence>
+ observer(times, state_inserter);
return integrate_adaptive(stepper, system, state,
times.front() , times.back(), dt , observer);
}
@@ -149,10 +149,11 @@
T a_dxdt = 1.0
)
{
+ typedef stepper_euler< ContainerType , T > stepper_type;
// we use cash karp stepper as base stepper
- stepper_rk5_ck< ContainerType > stepper_cash_karp;
+ stepper_type stepper_cash_karp;
// we use the standard controller for this adaptive integrator
- controlled_stepper_standard< ContainerType, T>
+ controlled_stepper_standard< stepper_type >
controlled_stepper(stepper_cash_karp, eps_abs, eps_rel, a_x, a_dxdt );
// initialized with values from above
Modified: sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_euler.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -18,12 +18,8 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP
#define BOOST_NUMERIC_ODEINT_STEPPER_EULER_HPP
-#include <boost/concept_check.hpp>
-
#include <boost/numeric/odeint/detail/iterator_algebra.hpp>
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
-
+#include <boost/numeric/odeint/container_traits.hpp>
namespace boost {
@@ -33,29 +29,20 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_euler
{
// provide basic typedefs
public:
- typedef Container container_type;
- typedef Resizer resizer_type;
+ typedef unsigned short order_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
-
-
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
+ typedef Traits traits_type;
+ typedef typename traits_type::container_type container_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
@@ -63,8 +50,6 @@
private:
container_type m_dxdt;
- resizer_type m_resizer;
-
@@ -77,13 +62,16 @@
template< class DynamicalSystem >
void do_step( DynamicalSystem &system ,
- container_type &x ,
- const container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ const container_type &dxdt ,
+ time_type t ,
+ time_type dt )
{
//x = x + dt*dxdt
- detail::it_algebra::increment( x.begin() , x.end() , dxdt.begin() , dt );
+ detail::it_algebra::increment( traits_type::begin(x) ,
+ traits_type::end(x) ,
+ traits_type::begin(dxdt) ,
+ dt );
}
template< class DynamicalSystem >
@@ -92,7 +80,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_half_step.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_half_step.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_half_step.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -29,24 +29,20 @@
namespace odeint {
- template<
- class Stepper
- >
+ template< class Stepper >
class stepper_half_step
{
// provide basic typedefs
public:
typedef Stepper stepper_type;
- typedef typename Stepper::container_type container_type;
- typedef typename Stepper::resizer_type resizer_type;
- typedef typename Stepper::time_type time_type;
- typedef typename Stepper::order_type order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
-
+ typedef typename stepper_type::container_type container_type;
+ typedef typename stepper_type::traits_type traits_type;
+ typedef typename stepper_type::time_type time_type;
+ typedef typename stepper_type::order_type order_type;
+ typedef typename stepper_type::value_type value_type;
+ typedef typename stepper_type::iterator iterator;
+ typedef typename stepper_type::const_iterator const_iterator;
@@ -56,7 +52,6 @@
container_type m_dxdt;
container_type m_xtemp;
- resizer_type m_resizer;
stepper_type m_stepper;
@@ -99,7 +94,7 @@
time_type dt ,
container_type &xerr )
{
- m_resizer.adjust_size( x , xerr );
+ traits_type::adjust_size( x , xerr );
m_xtemp = x;
time_type dt2 = static_cast<time_type>(0.5) * dt;
@@ -108,10 +103,10 @@
do_step( system , x , dxdt , t , dt2 );
do_step( system , x , t+dt2 , dt2 );
- detail::it_algebra::assign_diff( xerr.begin() ,
- xerr.end() ,
- m_xtemp.begin() ,
- x.begin() );
+ detail::it_algebra::assign_diff( traits_type::begin(xerr) ,
+ traits_type::begin(xerr) ,
+ traits_type::begin(m_xtemp) ,
+ traits_type::begin(x) );
}
@@ -123,7 +118,7 @@
time_type dt ,
container_type &xerr )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt , xerr );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_midpoint.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -17,11 +17,9 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_MIDPOINT_HPP
#define BOOST_NUMERIC_ODEINT_STEPPER_MIDPOINT_HPP
-#include <boost/concept_check.hpp>
#include <boost/numeric/odeint/detail/iterator_algebra.hpp>
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
#include <iostream>
@@ -32,41 +30,37 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_midpoint
{
// provide basic typedefs
public:
+ typedef const unsigned short order_type;
typedef Container container_type;
- typedef Resizer resizer_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
// private memebers
private:
- resizer_type m_resizer;
-
unsigned short m_stepcount;
container_type m_x0;
container_type m_x1;
container_type m_dxdt;
+
+
+
public:
stepper_midpoint( unsigned short stepcount = 2 ) { }
@@ -82,6 +76,8 @@
unsigned short get_stepcount() const { return m_stepcount; }
+
+
template< class DynamicalSystem >
void do_step(
DynamicalSystem &system ,
@@ -98,16 +94,16 @@
const time_type h2 = static_cast<time_type>( 2.0 )*h;
time_type th = t + h;
- m_resizer.adjust_size(x, m_x0);
- m_resizer.adjust_size(x, m_x1);
- m_resizer.adjust_size(x, m_dxdt);
+ traits_type::adjust_size(x, m_x0);
+ traits_type::adjust_size(x, m_x1);
+ traits_type::adjust_size(x, m_dxdt);
using namespace detail::it_algebra;
// m_x0 = x + h*dxdt
- scale_sum( m_x1.begin(), m_x1.end(),
- t_1, x.begin(),
- h, dxdt.begin() );
+ scale_sum( traits_type::begin(m_x1), traits_type::end(m_x1),
+ t_1, traits_type::begin(x),
+ h, traits_type::begin(dxdt) );
system( m_x1, m_dxdt, th );
m_x0 = x;
@@ -118,9 +114,9 @@
while( i != m_stepcount )
{ // general step
//tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
- scale_sum_swap( m_x1.begin(), m_x1.end(),
- m_x0.begin(),
- h2, m_dxdt.begin() );
+ scale_sum_swap( traits_type::begin(m_x1), traits_type::begin(m_x1),
+ traits_type::begin(m_x0),
+ h2, traits_type::begin(m_dxdt) );
th += h;
system( m_x1, m_dxdt, th);
i++;
@@ -130,12 +126,16 @@
// last step
// x = 0.5*( m_x0 + m_x1 + h*m_dxdt )
- scale_sum( x_out.begin(), x_out.end(),
- t_05, m_x0.begin(),
- t_05, m_x1.begin(),
- t_05*h, m_dxdt.begin() );
+ scale_sum( traits_type::begin(x_out), traits_type::end(x_out),
+ t_05, traits_type::begin(m_x0),
+ t_05, traits_type::begin(m_x1),
+ t_05*h, traits_type::begin(m_dxdt) );
}
+
+
+
+
template< class DynamicalSystem >
void do_step(
DynamicalSystem &system ,
@@ -149,6 +149,8 @@
+
+
template< class DynamicalSystem >
void do_step(
DynamicalSystem &system ,
@@ -156,7 +158,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size(x, m_dxdt);
+ traits_type::adjust_size(x, m_dxdt);
system( x, m_dxdt, t );
do_step( system , x, m_dxdt, t, dt );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_rk4.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -17,10 +17,7 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RK4_HPP
#define BOOST_NUMERIC_ODEINT_STEPPER_RK4_HPP
-#include <boost/concept_check.hpp>
-
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
namespace boost {
namespace numeric {
@@ -29,7 +26,7 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_rk4
{
@@ -37,25 +34,18 @@
// provide basic typedefs
public:
+ typedef const unsigned short order_type;
typedef Container container_type;
- typedef Resizer resizer_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
-
-
// private members
private:
@@ -65,7 +55,6 @@
container_type m_dxm;
container_type m_dxh;
container_type m_xt;
- resizer_type m_resizer;
// private member functions
@@ -75,71 +64,76 @@
// public interface
public:
- stepper_rk4( void )
- {
- }
order_type order() const { return 4; }
+
+
template< class DynamicalSystem >
void do_step( DynamicalSystem &system ,
- container_type &x ,
- container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ container_type &dxdt ,
+ time_type t ,
+ time_type dt )
{
using namespace detail::it_algebra;
const time_type val1 = static_cast<time_type>( 1.0 );
- m_resizer.adjust_size( x , m_dxt );
- m_resizer.adjust_size( x , m_dxm );
- m_resizer.adjust_size( x , m_xt );
- m_resizer.adjust_size( x , m_dxh );
+ traits_type::adjust_size( x , m_dxt );
+ traits_type::adjust_size( x , m_dxm );
+ traits_type::adjust_size( x , m_xt );
+ traits_type::adjust_size( x , m_dxh );
time_type dh = static_cast<time_type>( 0.5 ) * dt;
time_type th = t + dh;
// dt * dxdt = k1
// m_xt = x + dh*dxdt
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dh, dxdt.begin() );
+ scale_sum( traits_type::begin(m_xt),
+ traits_type::end(m_xt),
+ val1, traits_type::begin(x),
+ dh, traits_type::begin(dxdt) );
// dt * m_dxt = k2
system( m_xt , m_dxt , th );
//m_xt = x + dh*m_dxt
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dh, m_dxt.begin() );
+ scale_sum( traits_type::begin(m_xt) ,
+ traits_type::end(m_xt) ,
+ val1, traits_type::begin(x) ,
+ dh, traits_type::begin(m_dxt) );
// dt * m_dxm = k3
system( m_xt , m_dxm , th );
//m_xt = x + dt*m_dxm
- scale_sum( m_xt.begin(), m_xt.end(),
- val1, x.begin(),
- dt, m_dxm.begin() );
+ scale_sum( traits_type::begin(m_xt), traits_type::end(m_xt),
+ val1, traits_type::begin(x) ,
+ dt, traits_type::begin(m_dxm) );
// dt * m_dxh = k4
system( m_xt , m_dxh , t + dt );
//x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
- scale_sum( x.begin(), x.end(),
- val1, x.begin(),
- dt / static_cast<time_type>( 6.0 ), dxdt.begin(),
- dt / static_cast<time_type>( 3.0 ), m_dxt.begin(),
- dt / static_cast<time_type>( 3.0 ), m_dxm.begin(),
- dt / static_cast<time_type>( 6.0 ), m_dxh.begin() );
+ time_type dt6 = dt / static_cast<time_type>( 6.0 );
+ time_type dt3 = dt / static_cast<time_type>( 3.0 );
+ scale_sum( traits_type::begin(x) , traits_type::end(x),
+ val1, traits_type::begin(x),
+ dt6 , traits_type::begin(dxdt),
+ dt3 , traits_type::begin(m_dxt),
+ dt3 , traits_type::begin(m_dxm),
+ dt6 , traits_type::begin(m_dxh) );
}
+
+
template< class DynamicalSystem >
void do_step( DynamicalSystem &system ,
container_type &x ,
time_type t ,
time_type dt )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_rk4_classical.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_rk4_classical.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_rk4_classical.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -17,10 +17,7 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RK4_CLASSICAL_HPP
#define BOOST_NUMERIC_ODEINT_STEPPER_RK4_CLASSICAL_HPP
-#include <boost/concept_check.hpp>
-
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
namespace boost {
namespace numeric {
@@ -29,7 +26,7 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_rk4_classical
{
@@ -37,25 +34,18 @@
// provide basic typedefs
public:
+ typedef const unsigned short order_type;
typedef Container container_type;
- typedef Resizer resizer_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
-
-
// private members
private:
@@ -65,7 +55,6 @@
container_type m_dxm;
container_type m_dxh;
container_type m_xt;
- resizer_type m_resizer;
@@ -78,38 +67,43 @@
template< class DynamicalSystem >
void do_step( DynamicalSystem &system ,
- container_type &x ,
- container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ container_type &dxdt ,
+ time_type t ,
+ time_type dt )
{
using namespace detail::it_algebra;
const time_type val2 = time_type( 2.0 );
- m_resizer.adjust_size( x , m_dxt );
- m_resizer.adjust_size( x , m_dxm );
- m_resizer.adjust_size( x , m_xt );
+ traits_type::adjust_size( x , m_dxt );
+ traits_type::adjust_size( x , m_dxm );
+ traits_type::adjust_size( x , m_xt );
time_type dh = time_type( 0.5 ) * dt;
time_type th = t + dh;
//m_xt = x + dh*dxdt
- assign_sum( m_xt.begin() , m_xt.end() , x.begin() , dxdt.begin() , dh );
+ assign_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(dxdt) , dh );
system( m_xt , m_dxt , th );
//m_xt = x + dh*m_dxdt
- assign_sum( m_xt.begin() , m_xt.end() , x.begin() , m_dxt.begin() , dh );
+ assign_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(m_dxt) , dh );
system( m_xt , m_dxm , th );
//m_xt = x + dt*m_dxm ; m_dxm += m_dxt
- assign_sum_increment( m_xt.begin() , m_xt.end() , x.begin() ,
- m_dxm.begin() , m_dxt.begin() , dt );
+ assign_sum_increment( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ traits_type::begin(x) , traits_type::begin(m_dxm) ,
+ traits_type::begin(m_dxt) , dt );
system( m_xt , m_dxt , t + dt );
//x = dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
- increment_sum_sum( x.begin() , x.end() , dxdt.begin() ,
- m_dxt.begin() , m_dxm.begin() ,
+ increment_sum_sum( traits_type::begin(x) , traits_type::end(x) ,
+ traits_type::begin(dxdt) ,
+ traits_type::begin(m_dxt) ,
+ traits_type::begin(m_dxm) ,
dt / time_type( 6.0 ) , val2 );
}
@@ -121,7 +115,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_rk5_ck.hpp
==============================================================================
Binary files. No diff available.
Modified: sandbox/odeint/boost/numeric/odeint/stepper_rk78_fehlberg.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_rk78_fehlberg.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_rk78_fehlberg.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -13,6 +13,8 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_RK78_FEHLBERG_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_RK78_FEHLBERG_HPP_INCLUDED
+#include <boost/numeric/odeint/container_traits.hpp>
+
namespace boost {
namespace numeric {
namespace odeint {
@@ -20,20 +22,20 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_rk78_fehlberg
{
// provide basic typedefs
public:
+ typedef const unsigned short order_type;
typedef Container container_type;
- typedef Resizer resizer_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
@@ -46,7 +48,6 @@
container_type m_k02 , m_k03 , m_k04 , m_k05 , m_k06 , m_k07 ,
m_k08 , m_k09 , m_k10 , m_k11 , m_k12 , m_k13;
- resizer_type m_resizer;
// the times at which system is called
time_type m_t02 , m_t03 , m_t04 , m_t05 , m_t06 , m_t07 , m_t08 ,
@@ -174,157 +175,157 @@
m_t13 = t + dt;
// resize
- m_resizer.adjust_size( x , m_xt );
- m_resizer.adjust_size( x , m_k02 );
- m_resizer.adjust_size( x , m_k03 );
- m_resizer.adjust_size( x , m_k04 );
- m_resizer.adjust_size( x , m_k05 );
- m_resizer.adjust_size( x , m_k06 );
- m_resizer.adjust_size( x , m_k07 );
- m_resizer.adjust_size( x , m_k08 );
- m_resizer.adjust_size( x , m_k09 );
- m_resizer.adjust_size( x , m_k10 );
- m_resizer.adjust_size( x , m_k11 );
- m_resizer.adjust_size( x , m_k12 );
- m_resizer.adjust_size( x , m_k13 );
+ traits_type::adjust_size( x , m_xt );
+ traits_type::adjust_size( x , m_k02 );
+ traits_type::adjust_size( x , m_k03 );
+ traits_type::adjust_size( x , m_k04 );
+ traits_type::adjust_size( x , m_k05 );
+ traits_type::adjust_size( x , m_k06 );
+ traits_type::adjust_size( x , m_k07 );
+ traits_type::adjust_size( x , m_k08 );
+ traits_type::adjust_size( x , m_k09 );
+ traits_type::adjust_size( x , m_k10 );
+ traits_type::adjust_size( x , m_k11 );
+ traits_type::adjust_size( x , m_k12 );
+ traits_type::adjust_size( x , m_k13 );
// k1, the first system call has allready been evaluated
// k2 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b02_01 , dxdt.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b02_01 , traits_type::begin(dxdt) );
system( m_xt , m_k02 , m_t02 );
// k3 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b03_01 , dxdt.begin() ,
- dt * b03_02 , m_k02.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b03_01 , traits_type::begin(dxdt) ,
+ dt * b03_02 , traits_type::begin(m_k02) );
system( m_xt , m_k03 , m_t03 );
// k4 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b04_01 , dxdt.begin() ,
- dt * b04_03 , m_k03.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b04_01 , traits_type::begin(dxdt) ,
+ dt * b04_03 , traits_type::begin(m_k03) );
system( m_xt , m_k04 , m_t04 );
// k5 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b05_01 , dxdt.begin() ,
- dt * b05_03 , m_k03.begin() ,
- dt * b05_04 , m_k04.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b05_01 , traits_type::begin(dxdt) ,
+ dt * b05_03 , traits_type::begin(m_k03) ,
+ dt * b05_04 , traits_type::begin(m_k04) );
system( m_xt , m_k05 , m_t05 );
// k6 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b06_01 , dxdt.begin() ,
- dt * b06_04 , m_k04.begin() ,
- dt * b06_05 , m_k05.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b06_01 , traits_type::begin(dxdt) ,
+ dt * b06_04 , traits_type::begin(m_k04) ,
+ dt * b06_05 , traits_type::begin(m_k05) );
system( m_xt , m_k06 , m_t06 );
// k7 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b07_01 , dxdt.begin() ,
- dt * b07_04 , m_k04.begin() ,
- dt * b07_05 , m_k05.begin() ,
- dt * b07_06 , m_k06.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b07_01 , traits_type::begin(dxdt) ,
+ dt * b07_04 , traits_type::begin(m_k04) ,
+ dt * b07_05 , traits_type::begin(m_k05) ,
+ dt * b07_06 , traits_type::begin(m_k06) );
system( m_xt , m_k07 , m_t07 );
// k8 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b08_01 , dxdt.begin() ,
- dt * b08_05 , m_k05.begin() ,
- dt * b08_06 , m_k06.begin() ,
- dt * b08_07 , m_k07.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b08_01 , traits_type::begin(dxdt) ,
+ dt * b08_05 , traits_type::begin(m_k05) ,
+ dt * b08_06 , traits_type::begin(m_k06) ,
+ dt * b08_07 , traits_type::begin(m_k07) );
system( m_xt , m_k08 , m_t08 );
// k9 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b09_01 , dxdt.begin() ,
- dt * b09_04 , m_k04.begin() ,
- dt * b09_05 , m_k05.begin() ,
- dt * b09_06 , m_k06.begin() ,
- dt * b09_07 , m_k07.begin() ,
- dt * b09_08 , m_k08.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b09_01 , traits_type::begin(dxdt) ,
+ dt * b09_04 , traits_type::begin(m_k04) ,
+ dt * b09_05 , traits_type::begin(m_k05) ,
+ dt * b09_06 , traits_type::begin(m_k06) ,
+ dt * b09_07 , traits_type::begin(m_k07) ,
+ dt * b09_08 , traits_type::begin(m_k08) );
system( m_xt , m_k09 , m_t09 );
// k10 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b10_01 , dxdt.begin() ,
- dt * b10_04 , m_k04.begin() ,
- dt * b10_05 , m_k05.begin() ,
- dt * b10_06 , m_k06.begin() ,
- dt * b10_07 , m_k07.begin() ,
- dt * b10_08 , m_k08.begin() ,
- dt * b10_09 , m_k09.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b10_01 , traits_type::begin(dxdt) ,
+ dt * b10_04 , traits_type::begin(m_k04) ,
+ dt * b10_05 , traits_type::begin(m_k05) ,
+ dt * b10_06 , traits_type::begin(m_k06) ,
+ dt * b10_07 , traits_type::begin(m_k07) ,
+ dt * b10_08 , traits_type::begin(m_k08) ,
+ dt * b10_09 , traits_type::begin(m_k09) );
system( m_xt , m_k10 , m_t10 );
// k11 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b11_01 , dxdt.begin() ,
- dt * b11_04 , m_k04.begin() ,
- dt * b11_05 , m_k05.begin() ,
- dt * b11_06 , m_k06.begin() ,
- dt * b11_07 , m_k07.begin() ,
- dt * b11_08 , m_k08.begin() ,
- dt * b11_09 , m_k09.begin() ,
- dt * b11_10 , m_k10.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b11_01 , traits_type::begin(dxdt) ,
+ dt * b11_04 , traits_type::begin(m_k04) ,
+ dt * b11_05 , traits_type::begin(m_k05) ,
+ dt * b11_06 , traits_type::begin(m_k06) ,
+ dt * b11_07 , traits_type::begin(m_k07) ,
+ dt * b11_08 , traits_type::begin(m_k08) ,
+ dt * b11_09 , traits_type::begin(m_k09) ,
+ dt * b11_10 , traits_type::begin(m_k10) );
system( m_xt , m_k11 , m_t11 );
// k12 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b12_01 , dxdt.begin() ,
- dt * b12_06 , m_k06.begin() ,
- dt * b12_07 , m_k07.begin() ,
- dt * b12_08 , m_k08.begin() ,
- dt * b12_09 , m_k09.begin() ,
- dt * b12_10 , m_k10.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b12_01 , traits_type::begin(dxdt) ,
+ dt * b12_06 , traits_type::begin(m_k06) ,
+ dt * b12_07 , traits_type::begin(m_k07) ,
+ dt * b12_08 , traits_type::begin(m_k08) ,
+ dt * b12_09 , traits_type::begin(m_k09) ,
+ dt * b12_10 , traits_type::begin(m_k10) );
system( m_xt , m_k12 , m_t12 );
// k13 step
- scale_sum( m_xt.begin() , m_xt.end() ,
- val1 , x.begin() ,
- dt * b13_01 , dxdt.begin() ,
- dt * b13_04 , m_k04.begin() ,
- dt * b13_05 , m_k05.begin() ,
- dt * b13_06 , m_k06.begin() ,
- dt * b13_07 , m_k07.begin() ,
- dt * b13_08 , m_k08.begin() ,
- dt * b13_09 , m_k09.begin() ,
- dt * b13_10 , m_k10.begin() ,
- dt * b13_12 , m_k12.begin() );
+ scale_sum( traits_type::begin(m_xt) , traits_type::end(m_xt) ,
+ val1 , traits_type::begin(x) ,
+ dt * b13_01 , traits_type::begin(dxdt) ,
+ dt * b13_04 , traits_type::begin(m_k04) ,
+ dt * b13_05 , traits_type::begin(m_k05) ,
+ dt * b13_06 , traits_type::begin(m_k06) ,
+ dt * b13_07 , traits_type::begin(m_k07) ,
+ dt * b13_08 , traits_type::begin(m_k08) ,
+ dt * b13_09 , traits_type::begin(m_k09) ,
+ dt * b13_10 , traits_type::begin(m_k10) ,
+ dt * b13_12 , traits_type::begin(m_k12) );
system( m_xt , m_k13 , m_t13 );
- scale_sum( x.begin() , x.end() ,
- val1 , x.begin() ,
- dt * c06 , m_k06.begin() ,
- dt * c07 , m_k07.begin() ,
- dt * c08 , m_k08.begin() ,
- dt * c09 , m_k09.begin() ,
- dt * c10 , m_k10.begin() ,
- dt * c12 , m_k12.begin() ,
- dt * c13 , m_k13.begin() );
+ scale_sum( traits_type::begin(x) , traits_type::end(x) ,
+ val1 , traits_type::begin(x) ,
+ dt * c06 , traits_type::begin(m_k06) ,
+ dt * c07 , traits_type::begin(m_k07) ,
+ dt * c08 , traits_type::begin(m_k08) ,
+ dt * c09 , traits_type::begin(m_k09) ,
+ dt * c10 , traits_type::begin(m_k10) ,
+ dt * c12 , traits_type::begin(m_k12) ,
+ dt * c13 , traits_type::begin(m_k13) );
}
@@ -334,7 +335,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt );
}
@@ -382,7 +383,7 @@
time_type dt ,
container_type &xerr )
{
- m_resizer.adjust_size( x , m_dxdt );
+ traits_type::adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
do_step( system , x , m_dxdt , t , dt , xerr );
}
Modified: sandbox/odeint/boost/numeric/odeint/stepper_rk_generic.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepper_rk_generic.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepper_rk_generic.hpp 2009-12-13 08:30:54 EST (Sun, 13 Dec 2009)
@@ -21,10 +21,8 @@
#include <exception>
#include <cmath> // for pow( ) and abs()
#include <limits>
-#include <boost/concept_check.hpp>
-#include <boost/numeric/odeint/concepts/state_concept.hpp>
-#include <boost/numeric/odeint/resizer.hpp>
+#include <boost/numeric/odeint/container_traits.hpp>
namespace boost {
@@ -52,7 +50,7 @@
template<
class Container ,
class Time = double ,
- class Resizer = resizer< Container >
+ class Traits = container_traits< Container >
>
class stepper_rk_generic
{
@@ -61,21 +59,15 @@
// provide basic typedefs
public:
+ typedef const unsigned short order_type;
typedef Container container_type;
- typedef Resizer resizer_type;
typedef Time time_type;
- typedef const unsigned short order_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::iterator iterator;
-
-
-
+ typedef Traits traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::iterator iterator;
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
@@ -96,7 +88,6 @@
order_type m_q;
- resizer_type m_resizer;
// private member functions
@@ -201,10 +192,10 @@
template< class DynamicalSystem >
void do_step( DynamicalSystem &system ,
- container_type &x ,
- container_type &dxdt ,
- time_type t ,
- time_type dt )
+ container_type &x ,
+ container_type &dxdt ,
+ time_type t ,
+ time_type dt )
{
using namespace detail::it_algebra;
typename container_vector::iterator x_iter = m_xvec.begin();
@@ -215,10 +206,10 @@
while( x_iter != m_xvec.end() )
{
- m_resizer.adjust_size(x, (*x_iter));
+ traits_type::adjust_size(x, (*x_iter));
(*xiter_iter++) = (*x_iter++).begin();
}
- m_resizer.adjust_size(x, m_xtmp);
+ traits_type::adjust_size(x, m_xtmp);
x_iter = m_xvec.begin()+1;
@@ -247,7 +238,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size(x, m_xtmp);
+ traits_type::adjust_size(x, m_xtmp);
system(x, m_xtmp, t);
do_step( system, x, m_xtmp, t, dt);
}
@@ -399,10 +390,10 @@
while( x_iter != m_xvec.end() )
{
- m_resizer.adjust_size(x, (*x_iter));
+ traits_type::adjust_size(x, (*x_iter));
(*xiter_iter++) = (*x_iter++).begin();
}
- m_resizer.adjust_size(x, m_xtmp);
+ traits_type::adjust_size(x, m_xtmp);
x_iter = m_xvec.begin()+1;
@@ -435,7 +426,7 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size(x, m_xtmp);
+ traits_type::adjust_size(x, m_xtmp);
system(x, m_xtmp, t);
do_step( system, x, m_xtmp, t, dt);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk