|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57373 - sandbox/odeint/boost/numeric/odeint
From: mario.mulansky_at_[hidden]
Date: 2009-11-04 13:09:17
Author: mariomulansky
Date: 2009-11-04 13:09:16 EST (Wed, 04 Nov 2009)
New Revision: 57373
URL: http://svn.boost.org/trac/boost/changeset/57373
Log:
fixed typo
Text files modified:
sandbox/odeint/boost/numeric/odeint/euler.hpp | 91 ++++++++++++++++++++-------------------
sandbox/odeint/boost/numeric/odeint/integrator.hpp | 2
sandbox/odeint/boost/numeric/odeint/runge_kutta_4.hpp | 62 +++++++++++++-------------
3 files changed, 78 insertions(+), 77 deletions(-)
Modified: sandbox/odeint/boost/numeric/odeint/euler.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/euler.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/euler.hpp 2009-11-04 13:09:16 EST (Wed, 04 Nov 2009)
@@ -30,27 +30,27 @@
namespace odeint {
template<
- class Container ,
- class Time = double ,
- class Resizer = resizer< Container >
- >
+ class Container ,
+ class Time = double ,
+ class Resizer = resizer< Container >
+ >
class ode_step_euler
{
- // provide basic typedefs
+ // provide basic typedefs
public:
- typedef Container container_type;
- typedef Resizer resizer_type;
- typedef Time time_type;
- typedef typename container_type::value_type value_type;
+ typedef Container container_type;
+ typedef Resizer resizer_type;
+ typedef Time time_type;
+ typedef typename container_type::value_type value_type;
typedef typename container_type::iterator iterator;
- // check the concept of the ContainerType
+ // check the concept of the ContainerType
private:
BOOST_CLASS_REQUIRE( container_type , boost::numeric::odeint, StateType );
@@ -58,32 +58,32 @@
- // private members
+ // private members
private:
container_type m_dxdt;
- container_type m_xtemp;
+ container_type m_xtemp;
resizer_type m_resizer;
- // public interface
+ // public interface
public:
- const unsigned int order() { return 1; }
+ const unsigned int order() { return 1; }
- template< class DynamicalSystem >
- void next_step( DynamicalSystem system ,
+ template< class DynamicalSystem >
+ void next_step( DynamicalSystem system ,
container_type &x ,
- const container_type &dxdt ,
+ const container_type &dxdt ,
time_type t ,
time_type dt )
{
- detail::it_algebra::scale_and_add( x.begin() , x.end() , dxdt.begin() , dt );
- }
+ detail::it_algebra::scale_and_add( x.begin() , x.end() , dxdt.begin() , dt );
+ }
@@ -93,48 +93,49 @@
time_type t ,
time_type dt )
{
- m_resizer.adjust_size( x , m_dxdt );
+ m_resizer.adjust_size( x , m_dxdt );
system( x , m_dxdt , t );
- next_step( system , x , m_dxdt , t , dt );
+ next_step( system , x , m_dxdt , t , dt );
}
- template< class DynamicalSystem >
- void next_step( DynamicalSystem system ,
- container_type &x ,
- const container_type &dxdt ,
- time_type t ,
- time_type dt ,
- container_type &xerr )
+ template< class DynamicalSystem >
+ void next_step( DynamicalSystem system ,
+ container_type &x ,
+ const container_type &dxdt ,
+ time_type t ,
+ time_type dt ,
+ container_type &xerr )
{
- m_resizer.adjust_size( x , xerr );
-
- m_xtemp = x;
- time_type dt2 = 0.5 * dt;
+ m_resizer.adjust_size( x , xerr );
- next_step( system , x , dxdt , t , dt );
- next_step( system , m_xtemp , dxdt , t , dt2 );
- next_step( system , m_xtemp , t+dt2 , dt2 );
+ m_xtemp = x;
+ time_type dt2 = 0.5 * dt;
- detail::it_algebra::substract_and_assign(
- x.begin() , x.end() , m_xtemp.begin() , xerr.begin()
- );
- }
+ next_step( system , x , dxdt , t , dt );
+ next_step( system , m_xtemp , dxdt , t , dt2 );
+ next_step( system , m_xtemp , t+dt2 , dt2 );
+
+ detail::it_algebra::substract_and_assign(x.begin() ,
+ x.end() ,
+ m_xtemp.begin() ,
+ xerr.begin() );
+ }
- template< class DynamicalSystem >
+ template< class DynamicalSystem >
void next_step( DynamicalSystem system ,
container_type &x ,
time_type t ,
time_type dt ,
- container_type &xerr )
+ container_type &xerr )
{
- m_resizer.check_size_and_resize( x , m_dxdt );
- system( x , m_dxdt , t );
- next_step( system , x , m_dxdt , t , dt , xerr );
- }
+ m_resizer.check_size_and_resize( x , m_dxdt );
+ system( x , m_dxdt , t );
+ next_step( system , x , m_dxdt , t , dt , xerr );
+ }
};
Modified: sandbox/odeint/boost/numeric/odeint/integrator.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/integrator.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/integrator.hpp 2009-11-04 13:09:16 EST (Wed, 04 Nov 2009)
@@ -124,7 +124,7 @@
{
if( times.size() != x_vec.size() ) throw;
// we use the standard controller for this adaptive integrator
- step_controller_standard< typename StepType::container_type, T, typename StepType::resize_type>
+ step_controller_standard< typename StepType::container_type, T, typename StepType::resizer_type>
controller(eps_abs, eps_rel, a_x, a_dxdt ); // initialized with values from above
// call the normal integrator
Modified: sandbox/odeint/boost/numeric/odeint/runge_kutta_4.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/runge_kutta_4.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/runge_kutta_4.hpp 2009-11-04 13:09:16 EST (Wed, 04 Nov 2009)
@@ -28,9 +28,9 @@
template<
- class ContainerType ,
- class ResizeType = resizer< ContainerType >
- >
+ class ContainerType ,
+ class ResizeType = resizer< ContainerType >
+ >
class ode_step_runge_kutta_4
{
BOOST_CLASS_REQUIRE( ContainerType , boost::numeric::odeint, StateType );
@@ -38,12 +38,12 @@
ContainerType dxdt;
ContainerType dxt;
ContainerType dxm;
- ContainerType xt;
+ ContainerType xt;
ResizeType resizer;
typedef typename ContainerType::iterator iterator;
- typedef typename ContainerType::value_type value_type;
+ typedef typename ContainerType::value_type value_type;
public:
@@ -53,7 +53,7 @@
TimeType t ,
TimeType dt )
{
- const TimeType val2 = TimeType( 2.0 );
+ const TimeType val2 = TimeType( 2.0 );
if( ! resizer.same_size( x , dxdt ) ) resizer.resize( x , dxdt );
if( ! resizer.same_size( x , dxt ) ) resizer.resize( x , dxt );
@@ -61,40 +61,40 @@
if( ! resizer.same_size( x , xt ) ) resizer.resize( x , xt );
TimeType dh = TimeType( 0.5 ) * dt;
- TimeType d6 = dt / TimeType( 6.0 );
+ TimeType d6 = dt / TimeType( 6.0 );
TimeType th = t + dh;
- iterator iter1 , iter2 ,iter3 , iter4;
- iterator x_end = x.end() , xt_end = xt.end();
+ iterator iter1 , iter2 ,iter3 , iter4;
+ iterator x_end = x.end() , xt_end = xt.end();
system( x , dxdt , t );
- iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxdt.begin();
- while( iter1 != xt_end )
- (*iter1++) = (*iter2++) + dh * (*iter3++);
-
- system( xt , dxt , th );
- iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxt.begin();
- while( iter1 != xt_end )
- (*iter1++) = (*iter2++) + dh * (*iter3++);
-
- system( xt , dxm , th );
- iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxm.begin() ; iter4 = dxt.begin();
- while( iter1 != xt_end )
- {
- (*iter1++) = (*iter2++) + dt * (*iter3);
- (*iter3++) += (*iter4++);
- }
-
- system( xt , dxt , value_type( t + dt ) );
- iter1 = x.begin() ; iter2 = dxdt.begin() ; iter3 = dxt.begin() ; iter4 = dxm.begin();
- while( iter1 != x_end )
- (*iter1++) += d6 * ( (*iter2++) + (*iter3++) + val2 * (*iter4++) );
+ iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxdt.begin();
+ while( iter1 != xt_end )
+ (*iter1++) = (*iter2++) + dh * (*iter3++);
+
+ system( xt , dxt , th );
+ iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxt.begin();
+ while( iter1 != xt_end )
+ (*iter1++) = (*iter2++) + dh * (*iter3++);
+
+ system( xt , dxm , th );
+ iter1 = xt.begin() ; iter2 = x.begin() ; iter3 = dxm.begin() ; iter4 = dxt.begin();
+ while( iter1 != xt_end )
+ {
+ (*iter1++) = (*iter2++) + dt * (*iter3);
+ (*iter3++) += (*iter4++);
+ }
+
+ system( xt , dxt , value_type( t + dt ) );
+ iter1 = x.begin() ; iter2 = dxdt.begin() ; iter3 = dxt.begin() ; iter4 = dxm.begin();
+ while( iter1 != x_end )
+ (*iter1++) += d6 * ( (*iter2++) + (*iter3++) + val2 * (*iter4++) );
}
};
} // namespace odeint
} // namespace numeric
-} // namespace boost
+ } // namespace boost
#endif // BOOST_NUMERIC_ODEINT_RUNGE_KUTTA_4_HPP
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