|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65677 - in sandbox/odeint/branches/karsten/boost/numeric/odeint: algebra stepper stepper/base
From: mario.mulansky_at_[hidden]
Date: 2010-09-29 11:52:06
Author: mariomulansky
Date: 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
New Revision: 65677
URL: http://svn.boost.org/trac/boost/changeset/65677
Log:
added some const correctness
Text files modified:
sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp | 32 ++++++++++++++++----------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp | 16 ++++++++--------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp | 16 ++++++++--------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp | 16 ++++++++--------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp | 8 ++++----
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp | 1 +
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp | 4 ++--
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp | 4 ++--
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp | 2 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp | 2 +-
10 files changed, 51 insertions(+), 50 deletions(-)
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/standard_operations.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -30,10 +30,10 @@
struct scale_sum2
{
- time_type m_alpha1;
- time_type m_alpha2;
+ const time_type m_alpha1;
+ const time_type m_alpha2;
- scale_sum2( time_type alpha1 , time_type alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
+ scale_sum2( const time_type alpha1 , const time_type alpha2 ) : m_alpha1( alpha1 ) , m_alpha2( alpha2 ) { }
template< class T1 , class T2 , class T3 >
void operator()( T1 &t1 , const T2 &t2 , const T3 &t3) const
@@ -44,9 +44,9 @@
struct scale_sum3
{
- time_type m_alpha1 , m_alpha2 , m_alpha3;
+ const time_type m_alpha1 , m_alpha2 , m_alpha3;
- scale_sum3( time_type alpha1 , time_type alpha2 , time_type alpha3 )
+ scale_sum3( const time_type alpha1 , const time_type alpha2 , const time_type alpha3 )
: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) { }
template< class T1 , class T2 , class T3 , class T4 >
@@ -58,9 +58,9 @@
struct scale_sum4
{
- time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4;
+ const time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4;
- scale_sum4( time_type alpha1 , time_type alpha2 , time_type alpha3 , time_type alpha4)
+ scale_sum4( const time_type alpha1 , const time_type alpha2 , const time_type alpha3 , const time_type alpha4)
: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) { }
template< class T1 , class T2 , class T3 , class T4 , class T5 >
@@ -72,9 +72,9 @@
struct scale_sum5
{
- time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4 , m_alpha5;
+ const time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4 , m_alpha5;
- scale_sum5( time_type alpha1 , time_type alpha2 , time_type alpha3 , time_type alpha4 , time_type alpha5)
+ scale_sum5( const time_type alpha1 , const time_type alpha2 , const time_type alpha3 , const time_type alpha4 , const time_type alpha5)
: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) { }
template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
@@ -86,9 +86,9 @@
struct scale_sum6
{
- time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4 , m_alpha5 , m_alpha6;
+ const time_type m_alpha1 , m_alpha2 , m_alpha3 , m_alpha4 , m_alpha5 , m_alpha6;
- scale_sum6( time_type alpha1 , time_type alpha2 , time_type alpha3 , time_type alpha4 , time_type alpha5 , time_type alpha6 )
+ scale_sum6( const time_type alpha1 , const time_type alpha2 , const time_type alpha3 , const time_type alpha4 , const time_type alpha5 , const time_type alpha6 )
: m_alpha1( alpha1 ) , m_alpha2( alpha2 ) , m_alpha3( alpha3 ) , m_alpha4( alpha4 ) , m_alpha5( alpha5 ) , m_alpha6( alpha6 ){ }
template< class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
@@ -106,14 +106,14 @@
struct rel_error
{
- time_type m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
+ const time_type m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt;
- rel_error( time_type eps_abs , time_type eps_rel , time_type a_x , time_type a_dxdt )
+ rel_error( const time_type eps_abs , const time_type eps_rel , const time_type a_x , const time_type a_dxdt )
: m_eps_abs( eps_abs ) , m_eps_rel( eps_rel ) , m_a_x( a_x ) , m_a_dxdt( a_dxdt ) { }
template< class T1 , class T2 , class T3 >
- void operator()( const T1 &t1 , const T2 &t2 , T3 &t3 )
+ void operator()( const T1 &t1 , const T2 &t2 , T3 &t3 ) const
{
using std::abs;
t3 = abs( t3 ) / ( m_eps_abs + m_eps_rel * ( m_a_x * abs( t1 ) + m_a_dxdt * abs( t2 ) ) );
@@ -128,14 +128,14 @@
struct maximum
{
template< class T1 , class T2 >
- time_type operator()( const T1 &t1 , const T2 &t2 )
+ time_type operator()( const T1 &t1 , const T2 &t2 ) const
{
using std::max;
return max( t1 , t2 );
}
template< class T >
- time_type operator()( const T &t1 )
+ time_type operator()( const T &t1 ) const
{ // for the vector space algebra
return max( t1 );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -78,31 +78,31 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
{
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
system( x , m_dxdt ,t );
- this->stepper().do_step_impl( system , x , m_dxdt , x , t , dt , xerr );
+ this->stepper().do_step_impl( system , x , m_dxdt , t , x , dt , xerr );
}
template< class System >
- void do_step( System &system , state_type &x , const state_type &dxdt , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
{
- this->stepper().do_step_impl( system , x , dxdt , x , t , dt , xerr );
+ this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
template< class System >
- void do_step( System &system , const state_type &in , state_type &out , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
system( in , m_dxdt ,t );
- this->stepper().do_step_impl( system , in , m_dxdt , out , t , dt , xerr );
+ this->stepper().do_step_impl( system , in , m_dxdt , t , out , dt , xerr );
}
template< class System >
- void do_step( System &system , const state_type &in , const state_type &dxdt , state_type &out , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
- this->stepper().do_step_impl( system , in , dxdt , out , t , dt , xerr );
+ this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_base.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -78,7 +78,7 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
system( x , m_dxdt ,t );
@@ -86,13 +86,13 @@
}
template< class System >
- void do_step( System &system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
template< class System >
- void do_step( System &system , const state_type &in , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , const time_type t , state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
system( in , m_dxdt ,t );
@@ -100,7 +100,7 @@
}
template< class System >
- void do_step( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
@@ -108,7 +108,7 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
{
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
system( x , m_dxdt ,t );
@@ -117,13 +117,13 @@
template< class System >
- void do_step( System &system , state_type &x , const state_type &dxdt , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
template< class System >
- void do_step( System &system , const state_type &in , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
system( in , m_dxdt ,t );
@@ -131,7 +131,7 @@
}
template< class System >
- void do_step( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_and_error_stepper_fsal_base.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -78,7 +78,7 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
system( x , m_dxdt ,t );
@@ -86,13 +86,13 @@
}
template< class System >
- void do_step( System &system , state_type &x , const state_type &dxdt , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const state_type &dxdt , const time_type t , const time_type dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
template< class System >
- void do_step( System &system , const state_type &in , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , const time_type t , state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
system( in , m_dxdt ,t );
@@ -100,7 +100,7 @@
}
template< class System >
- void do_step( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
@@ -108,7 +108,7 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt , state_type &xerr )
{
if( m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() ) || m_first_call )
{
@@ -119,13 +119,13 @@
}
template< class System >
- void do_step( System &system , state_type &x , state_type &dxdt , time_type t , time_type dt , state_type &xerr )
+ void do_step( System &system , state_type &x , state_type &dxdt , const time_type t , const time_type dt , state_type &xerr )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt , xerr );
}
template< class System >
- void do_step( System &system , const state_type &in , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
if( m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() ) || m_first_call )
{
@@ -136,7 +136,7 @@
}
template< class System >
- void do_step( System &system , const state_type &in , state_type &dxdt , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step( System &system , const state_type &in , state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt , xerr );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -74,7 +74,7 @@
template< class System >
- void do_step( System &system , state_type &x , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const time_type t , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( x , adjust_size_policy() );
system( x , m_dxdt ,t );
@@ -82,13 +82,13 @@
}
template< class System >
- void do_step( System &system , state_type &x , const state_type dxdt , time_type t , time_type dt )
+ void do_step( System &system , state_type &x , const state_type dxdt , const time_type t , const time_type dt )
{
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
template< class System >
- void do_step( System &system , const state_type &in , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , time_type t , const state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
system( in , m_dxdt ,t );
@@ -96,7 +96,7 @@
}
template< class System >
- void do_step( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -95,6 +95,7 @@
if( max_rel_err > 1.1 )
{
// error too large - decrease dt ,limit scaling factor to 0.2 and reset state
+ /* ToDo: for fsal steppers we have to do some resetting of dxdt */
dt *= max( 0.9 * pow( max_rel_err , -1.0 / ( m_stepper.error_order() - 1.0 ) ) , 0.2 );
boost::numeric::odeint::copy( m_x_old , x );
return step_size_decreased;
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -72,7 +72,7 @@
template< class System >
- void do_step_impl( System system , const state_type &in , state_type &dxdt , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step_impl( System system , const state_type &in , state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
const time_type c1 = static_cast<time_type> ( 35.0 ) / static_cast<time_type>( 384.0 );
@@ -106,7 +106,7 @@
template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -77,7 +77,7 @@
template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt , state_type &xerr )
+ void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt , state_type &xerr )
{
const time_type c1 = static_cast<time_type> ( 37.0 ) / static_cast<time_type>( 378.0 );
@@ -102,7 +102,7 @@
template< class System >
- void do_step_impl( System system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step_impl( System system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -41,7 +41,7 @@
BOOST_ODEINT_EXPLICIT_STEPPERS_TYPEDEFS( explicit_euler , 1 );
template< class System >
- void do_step_impl( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type & out , time_type dt )
+ void do_step_impl( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type & out , const time_type dt )
{
algebra_type::for_each3( out , in , dxdt , typename operations_type::scale_sum2( 1.0 , dt ) );
}
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp 2010-09-29 11:52:02 EDT (Wed, 29 Sep 2010)
@@ -65,7 +65,7 @@
}
template< class System >
- void do_step_impl( System &system , const state_type &in , const state_type &dxdt , time_type t , state_type &out , time_type dt )
+ void do_step_impl( System &system , const state_type &in , const state_type &dxdt , const time_type t , state_type &out , const time_type dt )
{
m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
// ToDo : check if size of in,dxdt,out are equal?
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