|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58255 - in sandbox/odeint/branches/karsten: boost/numeric boost/numeric/odeint boost/numeric/odeint/detail libs/numeric/odeint/examples
From: karsten.ahnert_at_[hidden]
Date: 2009-12-09 16:44:39
Author: karsten
Date: 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
New Revision: 58255
URL: http://svn.boost.org/trac/boost/changeset/58255
Log:
container_traits included
Binary files modified:
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk5_ck.hpp
Text files modified:
sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp | 6
sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp | 16 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp | 6
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp | 8
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_midpoint.hpp | 62 +++++-----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp | 13 --
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp | 13 --
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk78_fehlberg.hpp | 221 ++++++++++++++++++++-------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk_generic.hpp | 43 +++----
sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile | 3
10 files changed, 182 insertions(+), 209 deletions(-)
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -25,12 +25,10 @@
#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_rk_generic.hpp>
#include <boost/numeric/odeint/stepper_midpoint.hpp>
#include <boost/numeric/odeint/stepper_rk78_fehlberg.hpp>
-*/
+
#include <boost/numeric/odeint/controlled_stepper_standard.hpp>
#include <boost/numeric/odeint/controlled_stepper_bs.hpp>
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/detail/iterator_algebra.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -41,7 +41,6 @@
(*first1++) += alpha * static_cast<value_type>(*first2++);
}
- /*
// computes y = x1 - x2
template <
class OutputIterator ,
@@ -57,9 +56,8 @@
while( first1 != last1 )
(*first1++) = (*first2++) - (*first3++);
}
- */
- /*
+
// computes y = x1 + alpha * x2
template <
class OutputIterator ,
@@ -74,13 +72,13 @@
InputIterator2 first3 ,
T alpha )
{
+ typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
while( first1 != last1 )
- (*first1++) = (*first2++) + alpha * (*first3++);
+ (*first1++) = (*first2++) + alpha * static_cast<value_type>(*first3++);
}
- */
- /*
+
// computes y = alpha1 * ( x1 + x2 + alpha2*x3 )
template <
class OutputIterator ,
@@ -99,11 +97,12 @@
T alpha2
)
{
+ typedef typename std::iterator_traits<InputIterator3>::value_type value_type;
while( first1 != last1 )
(*first1++) += alpha1 *
- ( (*first2++) + (*first3++) + alpha2*(*first4++) );
+ ( (*first2++) + (*first3++) + alpha2 * static_cast<value_type>(*first4++) );
}
- */
+
@@ -440,6 +439,7 @@
InputIterator10 x10_begin
)
{
+ typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
while( y_begin != y_end )
(*y_begin++) =
alpha1 * static_cast<value_type>(*x1_begin++) +
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_euler.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -36,13 +36,13 @@
// provide basic typedefs
public:
- typedef const unsigned short order_type;
- typedef Container container_type;
+ typedef unsigned short order_type;
typedef Time time_type;
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 constiterator;
+ typedef typename traits_type::const_iterator const_iterator;
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_half_step.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -103,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) );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_midpoint.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_midpoint.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_midpoint.hpp 2009-12-09 16:44:37 EST (Wed, 09 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/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -17,9 +17,6 @@
#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/container_traits.hpp>
namespace boost {
@@ -43,18 +40,10 @@
typedef Traits traits_type;
typedef typename traits_type::value_type value_type;
typedef typename traits_type::iterator iterator;
- typedef typename traits_type::const_iterator constiterator;
-
-
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk4_classical.hpp 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -17,9 +17,6 @@
#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/container_traits.hpp>
namespace boost {
@@ -43,18 +40,10 @@
typedef Traits traits_type;
typedef typename traits_type::value_type value_type;
typedef typename traits_type::iterator iterator;
- typedef typename traits_type::const_iterator constiterator;
-
-
+ typedef typename traits_type::const_iterator const_iterator;
- // check the concept of the ContainerType
- private:
-
- BOOST_CLASS_REQUIRE( container_type ,
- boost::numeric::odeint, Container );
-
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk5_ck.hpp
==============================================================================
Binary files. No diff available.
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk78_fehlberg.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk78_fehlberg.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk78_fehlberg.hpp 2009-12-09 16:44:37 EST (Wed, 09 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/branches/karsten/boost/numeric/odeint/stepper_rk_generic.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk_generic.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper_rk_generic.hpp 2009-12-09 16:44:37 EST (Wed, 09 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);
}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/Jamfile 2009-12-09 16:44:37 EST (Wed, 09 Dec 2009)
@@ -8,11 +8,14 @@
: requirements
<include>../../../..
<include>$BOOST_ROOT
+ <include>$BLITZ_ROOT
+ <include>$MTL4_ROOT
<define>BOOST_ALL_NO_LIB=1
: build-dir .
;
exe harmonic_oscillator : harmonic_oscillator.cpp ;
+exe test_container_and_stepper : test_container_and_stepper.cpp ;
# exe lorenz_cmp_rk4_rk_generic : lorenz_cmp_rk4_rk_generic.cpp ;
# exe lorenz_controlled : lorenz_controlled.cpp ;
# exe lorenz_integrate_constant_step : lorenz_integrate_constant_step.cpp ;
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