stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork

This commit is contained in:
2026-02-24 18:38:47 +00:00
parent da8c28aaeb
commit 65cb2619a7
13106 changed files with 2484322 additions and 1804 deletions
@@ -0,0 +1,151 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp
[begin_description]
Algebra caller for the Adams Bashforth stepper.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
#include <boost/assert.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< size_t Step , class Algebra , class Operations >
struct adams_bashforth_call_algebra;
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 1 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each3( out , in , steps[0].m_v , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 2 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each4( out , in , steps[0].m_v , steps[1].m_v ,
typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 3 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each5( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
typename Operations::template scale_sum4< value_type , Time , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 4 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each6( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
typename Operations::template scale_sum5< value_type , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 5 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each7( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 6 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each8( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v ,
typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 7 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
//BOOST_ASSERT( false ); // not implemented
typedef typename Coefficients::value_type value_type;
algebra.for_each9( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v ,
typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) );
}
};
template< class Algebra , class Operations >
struct adams_bashforth_call_algebra< 8 , Algebra , Operations >
{
template< class StateIn , class StateOut , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
//BOOST_ASSERT( false ); // not implemented
typedef typename Coefficients::value_type value_type;
algebra.for_each10( out , in , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v , steps[7].m_v ,
typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_CALL_ALGEBRA_HPP_INCLUDED
@@ -0,0 +1,168 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp
[begin_description]
Definition of the coefficients for the Adams-Bashforth method.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011-2012 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class Value , size_t Steps >
class adams_bashforth_coefficients ;
template< class Value >
class adams_bashforth_coefficients< Value , 1 > : public boost::array< Value , 1 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 1 >()
{
(*this)[0] = static_cast< Value >( 1 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 2 > : public boost::array< Value , 2 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 2 >()
{
(*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 2 );
(*this)[1] = -static_cast< Value >( 1 ) / static_cast< Value >( 2 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 3 > : public boost::array< Value , 3 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 3 >()
{
(*this)[0] = static_cast< Value >( 23 ) / static_cast< Value >( 12 );
(*this)[1] = -static_cast< Value >( 4 ) / static_cast< Value >( 3 );
(*this)[2] = static_cast< Value >( 5 ) / static_cast< Value >( 12 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 4 > : public boost::array< Value , 4 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 4 >()
{
(*this)[0] = static_cast< Value >( 55 ) / static_cast< Value >( 24 );
(*this)[1] = -static_cast< Value >( 59 ) / static_cast< Value >( 24 );
(*this)[2] = static_cast< Value >( 37 ) / static_cast< Value >( 24 );
(*this)[3] = -static_cast< Value >( 3 ) / static_cast< Value >( 8 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 5 > : public boost::array< Value , 5 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 5 >()
{
(*this)[0] = static_cast< Value >( 1901 ) / static_cast< Value >( 720 );
(*this)[1] = -static_cast< Value >( 1387 ) / static_cast< Value >( 360 );
(*this)[2] = static_cast< Value >( 109 ) / static_cast< Value >( 30 );
(*this)[3] = -static_cast< Value >( 637 ) / static_cast< Value >( 360 );
(*this)[4] = static_cast< Value >( 251 ) / static_cast< Value >( 720 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 6 > : public boost::array< Value , 6 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 6 >()
{
(*this)[0] = static_cast< Value >( 4277 ) / static_cast< Value >( 1440 );
(*this)[1] = -static_cast< Value >( 2641 ) / static_cast< Value >( 480 );
(*this)[2] = static_cast< Value >( 4991 ) / static_cast< Value >( 720 );
(*this)[3] = -static_cast< Value >( 3649 ) / static_cast< Value >( 720 );
(*this)[4] = static_cast< Value >( 959 ) / static_cast< Value >( 480 );
(*this)[5] = -static_cast< Value >( 95 ) / static_cast< Value >( 288 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 7 > : public boost::array< Value , 7 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 7 >()
{
(*this)[0] = static_cast< Value >( 198721 ) / static_cast< Value >( 60480 );
(*this)[1] = -static_cast< Value >( 18637 ) / static_cast< Value >( 2520 );
(*this)[2] = static_cast< Value >( 235183 ) / static_cast< Value >( 20160 );
(*this)[3] = -static_cast< Value >( 10754 ) / static_cast< Value >( 945 );
(*this)[4] = static_cast< Value >( 135713 ) / static_cast< Value >( 20160 );
(*this)[5] = -static_cast< Value >( 5603 ) / static_cast< Value >( 2520 );
(*this)[6] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 8 > : public boost::array< Value , 8 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 8 >()
{
(*this)[0] = static_cast< Value >( 16083 ) / static_cast< Value >( 4480 );
(*this)[1] = -static_cast< Value >( 1152169 ) / static_cast< Value >( 120960 );
(*this)[2] = static_cast< Value >( 242653 ) / static_cast< Value >( 13440 );
(*this)[3] = -static_cast< Value >( 296053 ) / static_cast< Value >( 13440 );
(*this)[4] = static_cast< Value >( 2102243 ) / static_cast< Value >( 120960 );
(*this)[5] = -static_cast< Value >( 115747 ) / static_cast< Value >( 13440 );
(*this)[6] = static_cast< Value >( 32863 ) / static_cast< Value >( 13440 );
(*this)[7] = -static_cast< Value >( 5257 ) / static_cast< Value >( 17280 );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
@@ -0,0 +1,148 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp
[begin_description]
Algebra caller for the Adams Moulton method.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
#include <boost/assert.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< size_t Step , class Algebra , class Operations >
struct adams_moulton_call_algebra;
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 1 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage& /* steps */ , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each3( out , in , dxdt , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 2 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each4( out , in , dxdt , steps[0].m_v ,
typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 3 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each5( out , in , dxdt , steps[0].m_v , steps[1].m_v ,
typename Operations::template scale_sum4< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 4 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each6( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
typename Operations::template scale_sum5< value_type , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 5 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each7( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 6 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each8( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 7 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each9( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v ,
typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 8 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each10( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v ,
typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
@@ -0,0 +1,168 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp
[begin_description]
Coefficients for the Adams Moulton method.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011-2012 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class Value , size_t Steps >
class adams_moulton_coefficients ;
template< class Value >
class adams_moulton_coefficients< Value , 1 > : public boost::array< Value , 1 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 1 >()
{
(*this)[0] = static_cast< Value >( 1 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 2 > : public boost::array< Value , 2 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 2 >()
{
(*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
(*this)[1] = static_cast< Value >( 1 ) / static_cast< Value >( 2 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 3 > : public boost::array< Value , 3 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 3 >()
{
(*this)[0] = static_cast< Value >( 5 ) / static_cast< Value >( 12 );
(*this)[1] = static_cast< Value >( 2 ) / static_cast< Value >( 3 );
(*this)[2] = -static_cast< Value >( 1 ) / static_cast< Value >( 12 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 4 > : public boost::array< Value , 4 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 4 >()
{
(*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 8 );
(*this)[1] = static_cast< Value >( 19 ) / static_cast< Value >( 24 );
(*this)[2] = -static_cast< Value >( 5 ) / static_cast< Value >( 24 );
(*this)[3] = static_cast< Value >( 1 ) / static_cast< Value >( 24 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 5 > : public boost::array< Value , 5 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 5 >()
{
(*this)[0] = static_cast< Value >( 251 ) / static_cast< Value >( 720 );
(*this)[1] = static_cast< Value >( 323 ) / static_cast< Value >( 360 );
(*this)[2] = -static_cast< Value >( 11 ) / static_cast< Value >( 30 );
(*this)[3] = static_cast< Value >( 53 ) / static_cast< Value >( 360 );
(*this)[4] = -static_cast< Value >( 19 ) / static_cast< Value >( 720 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 6 > : public boost::array< Value , 6 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 6 >()
{
(*this)[0] = static_cast< Value >( 95 ) / static_cast< Value >( 288 );
(*this)[1] = static_cast< Value >( 1427 ) / static_cast< Value >( 1440 );
(*this)[2] = -static_cast< Value >( 133 ) / static_cast< Value >( 240 );
(*this)[3] = static_cast< Value >( 241 ) / static_cast< Value >( 720 );
(*this)[4] = -static_cast< Value >( 173 ) / static_cast< Value >( 1440 );
(*this)[5] = static_cast< Value >( 3 ) / static_cast< Value >( 160 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 7 > : public boost::array< Value , 7 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 7 >()
{
(*this)[0] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 );
(*this)[1] = static_cast< Value >( 2713 ) / static_cast< Value >( 2520 );
(*this)[2] = -static_cast< Value >( 15487 ) / static_cast< Value >( 20160 );
(*this)[3] = static_cast< Value >( 586 ) / static_cast< Value >( 945 );
(*this)[4] = -static_cast< Value >( 6737 ) / static_cast< Value >( 20160 );
(*this)[5] = static_cast< Value >( 263 ) / static_cast< Value >( 2520 );
(*this)[6] = -static_cast< Value >( 863 ) / static_cast< Value >( 60480 );
}
};
template< class Value >
class adams_moulton_coefficients< Value , 8 > : public boost::array< Value , 8 >
{
public:
adams_moulton_coefficients( void )
: boost::array< Value , 8 >()
{
(*this)[0] = static_cast< Value >( 5257 ) / static_cast< Value >( 17280 );
(*this)[1] = static_cast< Value >( 139849 ) / static_cast< Value >( 120960 );
(*this)[2] = -static_cast< Value >( 4511 ) / static_cast< Value >( 4480 );
(*this)[3] = static_cast< Value >( 123133 ) / static_cast< Value >( 120960 );
(*this)[4] = -static_cast< Value >( 88547 ) / static_cast< Value >( 120960 );
(*this)[5] = static_cast< Value >( 1537 ) / static_cast< Value >( 4480 );
(*this)[6] = -static_cast< Value >( 11351 ) / static_cast< Value >( 120960 );
(*this)[7] = static_cast< Value >( 275 ) / static_cast< Value >( 24192 );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_COEFFICIENTS_HPP_INCLUDED
@@ -0,0 +1,247 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp
[begin_description]
Implementation of the generic Runge-Kutta method.
[end_description]
Copyright 2011-2013 Mario Mulansky
Copyright 2011-2012 Karsten Ahnert
Copyright 2012 Christoph Koke
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
#include <boost/static_assert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/fusion/algorithm.hpp>
#include <boost/fusion/iterator.hpp>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/sequence.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
#include <boost/numeric/odeint/algebra/default_operations.hpp>
#include <boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp>
#include <boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp>
#include <boost/numeric/odeint/util/bind.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class T , class Constant >
struct array_wrapper
{
typedef const typename boost::array< T , Constant::value > type;
};
template< class T , size_t i >
struct stage
{
T c;
boost::array< T , i > a;
};
template< class T , class Constant >
struct stage_wrapper
{
typedef stage< T , Constant::value > type;
};
template<
size_t StageCount,
class Value ,
class Algebra ,
class Operations
>
class generic_rk_algorithm {
public:
typedef mpl::range_c< size_t , 1 , StageCount > stage_indices;
typedef typename boost::fusion::result_of::as_vector
<
typename boost::mpl::copy
<
stage_indices ,
boost::mpl::inserter
<
boost::mpl::vector0< > ,
boost::mpl::push_back< boost::mpl::_1 , array_wrapper< Value , boost::mpl::_2 > >
>
>::type
>::type coef_a_type;
typedef boost::array< Value , StageCount > coef_b_type;
typedef boost::array< Value , StageCount > coef_c_type;
typedef typename boost::fusion::result_of::as_vector
<
typename boost::mpl::push_back
<
typename boost::mpl::copy
<
stage_indices,
boost::mpl::inserter
<
boost::mpl::vector0<> ,
boost::mpl::push_back< boost::mpl::_1 , stage_wrapper< Value , boost::mpl::_2 > >
>
>::type ,
stage< Value , StageCount >
>::type
>::type stage_vector_base;
struct stage_vector : public stage_vector_base
{
struct do_insertion
{
stage_vector_base &m_base;
const coef_a_type &m_a;
const coef_c_type &m_c;
do_insertion( stage_vector_base &base , const coef_a_type &a , const coef_c_type &c )
: m_base( base ) , m_a( a ) , m_c( c ) { }
template< class Index >
void operator()( Index ) const
{
//boost::fusion::at< Index >( m_base ) = stage< double , Index::value+1 , intermediate_stage >( m_c[ Index::value ] , boost::fusion::at< Index >( m_a ) );
boost::fusion::at< Index >( m_base ).c = m_c[ Index::value ];
boost::fusion::at< Index >( m_base ).a = boost::fusion::at< Index >( m_a );
}
};
struct print_butcher
{
const stage_vector_base &m_base;
std::ostream &m_os;
print_butcher( const stage_vector_base &base , std::ostream &os )
: m_base( base ) , m_os( os )
{ }
template<class Index>
void operator()(Index) const {
m_os << boost::fusion::at<Index>(m_base).c << " | ";
for( size_t i=0 ; i<Index::value ; ++i )
m_os << boost::fusion::at<Index>(m_base).a[i] << " ";
m_os << std::endl;
}
};
stage_vector( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
{
typedef boost::mpl::range_c< size_t , 0 , StageCount-1 > indices;
boost::mpl::for_each< indices >( do_insertion( *this , a , c ) );
boost::fusion::at_c< StageCount - 1 >( *this ).c = c[ StageCount - 1 ];
boost::fusion::at_c< StageCount - 1 >( *this ).a = b;
}
void print( std::ostream &os ) const
{
typedef boost::mpl::range_c< size_t , 0 , StageCount > indices;
boost::mpl::for_each< indices >( print_butcher( *this , os ) );
}
};
template< class System , class StateIn , class StateTemp , class DerivIn , class Deriv ,
class StateOut , class Time >
struct calculate_stage
{
Algebra &algebra;
System &system;
const StateIn &x;
StateTemp &x_tmp;
StateOut &x_out;
const DerivIn &dxdt;
Deriv *F;
Time t;
Time dt;
calculate_stage( Algebra &_algebra , System &_system , const StateIn &_x , const DerivIn &_dxdt , StateOut &_out ,
StateTemp &_x_tmp , Deriv *_F , Time _t , Time _dt )
: algebra( _algebra ) , system( _system ) , x( _x ) , x_tmp( _x_tmp ) , x_out( _out) , dxdt( _dxdt ) , F( _F ) , t( _t ) , dt( _dt )
{}
template< typename T , size_t stage_number >
void inline operator()( stage< T , stage_number > const &stage ) const
//typename stage_fusion_wrapper< T , mpl::size_t< stage_number > , intermediate_stage >::type const &stage ) const
{
if( stage_number > 1 )
{
#ifdef BOOST_MSVC
#pragma warning( disable : 4307 34 )
#endif
system( x_tmp , F[stage_number-2].m_v , t + stage.c * dt );
#ifdef BOOST_MSVC
#pragma warning( default : 4307 34 )
#endif
}
//std::cout << stage_number-2 << ", t': " << t + stage.c * dt << std::endl;
if( stage_number < StageCount )
detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_tmp , x , dxdt , F ,
detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt) );
// algebra_type::template for_eachn<stage_number>( x_tmp , x , dxdt , F ,
// typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
else
detail::template generic_rk_call_algebra< stage_number , Algebra >()( algebra , x_out , x , dxdt , F ,
detail::generic_rk_scale_sum< stage_number , Operations , Value , Time >( stage.a , dt ) );
// algebra_type::template for_eachn<stage_number>( x_out , x , dxdt , F ,
// typename operations_type::template scale_sumn< stage_number , time_type >( stage.a , dt ) );
}
};
generic_rk_algorithm( const coef_a_type &a , const coef_b_type &b , const coef_c_type &c )
: m_stages( a , b , c )
{ }
template< class System , class StateIn , class DerivIn , class Time , class StateOut , class StateTemp , class Deriv >
void inline do_step( Algebra &algebra , System system , const StateIn &in , const DerivIn &dxdt ,
Time t , StateOut &out , Time dt ,
StateTemp &x_tmp , Deriv F[StageCount-1] ) const
{
typedef typename odeint::unwrap_reference< System >::type unwrapped_system_type;
unwrapped_system_type &sys = system;
boost::fusion::for_each( m_stages , calculate_stage<
unwrapped_system_type , StateIn , StateTemp , DerivIn , Deriv , StateOut , Time >
( algebra , sys , in , dxdt , out , x_tmp , F , t , dt ) );
}
private:
stage_vector m_stages;
};
}
}
}
}
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_ALGORITHM_HPP_INCLUDED
@@ -0,0 +1,263 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp
[begin_description]
Algebra caller for the generic Runge-Kutta methods.
[end_description]
Copyright 2011-2012 Mario Mulansky
Copyright 2011-2012 Karsten Ahnert
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< size_t StageNumber , class Algebra >
struct generic_rk_call_algebra;
template< class Algebra >
struct generic_rk_call_algebra< 1 , Algebra >
{
typedef Algebra algebra_type;
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 * /* s4_array */ , Op op ) const
{
algebra.for_each3( s1 , s2 , s3 , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( algebra_type &algebra , S1 &s1 , S2 &s2 , S4 * /* s4_array */ , Op op ) const
{
algebra.for_each2( s1 , s2 , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 2 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[1] , Op op ) const
{
algebra.for_each4( s1 , s2 , s3 , s4_array[0].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[1] , Op op ) const
{
algebra.for_each3( s1 , s2 , s4_array[0].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 3 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[2] , Op op ) const
{
algebra.for_each5( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[2] , Op op ) const
{
algebra.for_each4( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 4 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[3] , Op op ) const
{
algebra.for_each6( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[3] , Op op ) const
{
algebra.for_each5( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 5 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[4] , Op op ) const
{
algebra.for_each7( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[4] , Op op ) const
{
algebra.for_each6( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 6 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[5] , Op op ) const
{
algebra.for_each8( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[5] , Op op ) const
{
algebra.for_each7( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 7 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[6] , Op op ) const
{
algebra.for_each9( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[6] , Op op ) const
{
algebra.for_each8( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 8 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[7] , Op op ) const
{
algebra.for_each10( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[7] , Op op ) const
{
algebra.for_each9( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 9 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[8] , Op op ) const
{
algebra.for_each11( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[8] , Op op ) const
{
algebra.for_each10( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 10 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[9] , Op op ) const
{
algebra.for_each12( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[9] , Op op ) const
{
algebra.for_each11( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 11 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[10] , Op op ) const
{
algebra.for_each13( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[10] , Op op ) const
{
algebra.for_each12( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 12 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[11] , Op op ) const
{
algebra.for_each14( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[11] , Op op ) const
{
algebra.for_each13( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , op );
}
};
template< class Algebra >
struct generic_rk_call_algebra< 13 , Algebra >
{
template< class S1 , class S2 , class S3 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S3 &s3 , S4 s4_array[12] , Op op ) const
{
algebra.for_each15( s1 , s2 , s3 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op );
}
template< class S1 , class S2 , class S4 , class Op>
void operator()( Algebra &algebra , S1 &s1 , S2 &s2 , S4 s4_array[12] , Op op ) const
{
algebra.for_each14( s1 , s2 , s4_array[0].m_v , s4_array[1].m_v , s4_array[2].m_v , s4_array[3].m_v , s4_array[4].m_v ,
s4_array[5].m_v , s4_array[6].m_v , s4_array[7].m_v , s4_array[8].m_v , s4_array[9].m_v , s4_array[10].m_v , s4_array[11].m_v , op );
}
};
}
}
}
}
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_CALL_ALGEBRA_HPP_INCLUDED
@@ -0,0 +1,252 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp
[begin_description]
Operations caller for the generic Runge Kutta method.
[end_description]
Copyright 2011 Mario Mulansky
Copyright 2011-2012 Karsten Ahnert
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< size_t StageNumber , class Operations , class Fac , class Time >
struct generic_rk_scale_sum;
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 1 , Operations , Fac , Time > : public Operations::template scale_sum2< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum2< Fac , Time >( 1.0 , a[0]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 2 , Operations , Fac , Time > : public Operations::template scale_sum3< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,2> &a , Time dt )
: Operations::template scale_sum3< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 3 , Operations , Fac , Time > : public Operations::template scale_sum4< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,3> &a , Time dt )
: Operations::template scale_sum4< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 4 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,4> &a , Time dt )
: Operations::template scale_sum5< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 5 , Operations , Fac , Time > : public Operations::template scale_sum6< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,5> &a , Time dt )
: Operations::template scale_sum6< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 6 , Operations , Fac , Time > : public Operations::template scale_sum7< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,6> &a , Time dt )
: Operations::template scale_sum7< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 7 , Operations , Fac , Time > : public Operations::template scale_sum8< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,7> &a , Time dt )
: Operations::template scale_sum8< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt , a[6]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 8 , Operations , Fac , Time > : public Operations::template scale_sum9< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,8> &a , Time dt )
: Operations::template scale_sum9< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 9 , Operations , Fac , Time > : public Operations::template scale_sum10< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,9> &a , Time dt )
: Operations::template scale_sum10< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 10 , Operations , Fac , Time > : public Operations::template scale_sum11< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,10> &a , Time dt )
: Operations::template scale_sum11< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 11 , Operations , Fac , Time > : public Operations::template scale_sum12< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,11> &a , Time dt )
: Operations::template scale_sum12< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 12 , Operations , Fac , Time > : public Operations::template scale_sum13< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,12> &a , Time dt )
: Operations::template scale_sum13< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum< 13 , Operations , Fac , Time > : public Operations::template scale_sum14< Fac , Time >
{
generic_rk_scale_sum( const boost::array<Fac,13> &a , Time dt )
: Operations::template scale_sum14< Fac , Time >( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt ,
a[5]*dt , a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt )
{ }
typedef void result_type;
};
// for error estimates
template< size_t StageNumber , class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err;
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 1 , Operations , Fac , Time > : public Operations::template scale_sum1< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,1> &a , Time dt ) : Operations::template scale_sum1< Time >( a[0]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 2 , Operations , Fac , Time > : public Operations::template scale_sum2< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,2> &a , Time dt )
: Operations::template scale_sum2< Time >( a[0]*dt , a[1]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 3 , Operations , Fac , Time > : public Operations::template scale_sum3< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,3> &a , Time dt )
: Operations::template scale_sum3< Time >( a[0]*dt , a[1]*dt , a[2]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 4 , Operations , Fac , Time > : public Operations::template scale_sum4< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,4> &a , Time dt )
: Operations::template scale_sum4< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 5 , Operations , Fac , Time > : public Operations::template scale_sum5< Fac >
{
generic_rk_scale_sum_err( const boost::array<Fac,5> &a , Time dt )
: Operations::template scale_sum5< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt )
{ }
typedef void result_type;
};
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 6 , Operations , Fac , Time > : public Operations::template scale_sum6< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,6> &a , Time dt )
: Operations::template scale_sum6< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt )
{ }
typedef void result_type;
};
// for rk87
template< class Operations , class Fac , class Time >
struct generic_rk_scale_sum_err< 13 , Operations , Fac , Time > : public Operations::template scale_sum13< Time >
{
generic_rk_scale_sum_err( const boost::array<Fac,13> &a , Time dt )
: Operations::template scale_sum13< Time >( a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt , a[4]*dt , a[5]*dt ,
a[6]*dt , a[7]*dt , a[8]*dt , a[9]*dt , a[10]*dt , a[11]*dt , a[12]*dt )
{ }
typedef void result_type;
};
}
}
}
}
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_GENERIC_RK_OPERATIONS_HPP_INCLUDED
@@ -0,0 +1,84 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
[begin_description]
Implemetation of a rotating (cyclic) buffer for use in the Adam Bashforth stepper
[end_description]
Copyright 2011 Karsten Ahnert
Copyright 2011 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class T , size_t N >
class rotating_buffer
{
public:
typedef T value_type;
const static size_t dim = N;
rotating_buffer( void ) : m_first( 0 )
{ }
size_t size( void ) const
{
return dim;
}
value_type& operator[]( size_t i )
{
return m_data[ get_index( i ) ];
}
const value_type& operator[]( size_t i ) const
{
return m_data[ get_index( i ) ];
}
void rotate( void )
{
if( m_first == 0 )
m_first = dim-1;
else
--m_first;
}
protected:
value_type m_data[N];
private:
size_t get_index( size_t i ) const
{
return ( ( i + m_first ) % dim );
}
size_t m_first;
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED