|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68946 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/algebra boost/numeric/odeint/stepper boost/numeric/odeint/stepper/base libs/numeric/odeint/ideas/butcher libs/numeric/odeint/ideas/generic_stepper libs/numeric/odeint/ideas/units libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-02-16 04:27:09
Author: karsten
Date: 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
New Revision: 68946
URL: http://svn.boost.org/trac/boost/changeset/68946
Log:
* restoring algebra with static functions, enhancing compile time
Text files modified:
sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/fusion_algebra.hpp | 159 +++++++++++-------------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/range_algebra.hpp | 174 ++++++++-------------------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp | 170 ++++++++++++--------------------------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp | 40 +-------
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp | 16 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/controlled_error_stepper.hpp | 4
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_dopri5.hpp | 16 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp | 14 +-
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_euler.hpp | 4
sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/explicit_rk4.hpp | 8
sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/butcher/algebra.hpp | 10 +-
sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/generic_stepper/fusion_algebra.hpp | 8
sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/units/explicit_euler_units.hpp | 2
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/fusion_algebra.cpp | 18 +--
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/is_pair.cpp | 2
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/range_algebra.cpp | 35 ++-----
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_ranges.cpp | 34 -------
17 files changed, 206 insertions(+), 508 deletions(-)
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/fusion_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/fusion_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/fusion_algebra.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -24,8 +24,6 @@
#include <boost/fusion/view.hpp>
#include <boost/fusion/functional.hpp>
-#define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 9
-#include <boost/functional/forward_adapter.hpp>
@@ -36,139 +34,80 @@
struct fusion_algebra
{
- struct for_each1_impl
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
{
- template< class S1 , class Op >
- void operator()( S1 &s1 , Op op ) const
- {
- boost::fusion::for_each( s1 , op );
- }
- typedef void result_type;
+ boost::fusion::for_each( s1 , op );
};
- struct for_each2_impl
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
{
- template< class S1 , class S2 , class Op >
- void operator()( S1 &s1 , S2 &s2 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& > Sequences;
- Sequences sequences( s1 , s2 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& > Sequences;
+ Sequences sequences( s1 , s2 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each3_impl
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
{
- template< class S1 , class S2 , class S3 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& > Sequences;
- Sequences sequences( s1 , s2 , s3 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& > Sequences;
+ Sequences sequences( s1 , s2 , s3 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each4_impl
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& , S4& > Sequences;
- Sequences sequences( s1 , s2 , s3 , s4 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each5_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& > Sequences;
- Sequences sequences( s1 , s2 , s3 , s4 , s5 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each6_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& > Sequences;
- Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each7_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& > Sequences;
- Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct for_each8_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) const
- {
- typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& > Sequences;
- Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
- boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
- }
- typedef void result_type;
- };
+ typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& > Sequences;
+ Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
+ boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
+ }
- struct reduce_impl
+ template< class Value , class S , class Reduction >
+ static Value reduce( const S &s , Reduction red , Value init)
{
- template< class Value , class S , class Reduction >
- Value operator()( S &s , Reduction red , Value init) const
- {
- return boost::fusion::accumulate( s , init , red );
- }
-
- template< class T > struct result;
- template< class F , class T1 , class T2 , class T3 >
- struct result< F( T1 , T2 , T3 ) >
- {
- /*
- * A Simple
- * typedef T3 type;
- * would result in warnings
- */
- typedef typename boost::remove_reference< T3 >::type type;
- };
- };
-
-
-
- typedef boost::forward_adapter< for_each1_impl , 2 > for_each1;
- typedef boost::forward_adapter< for_each2_impl , 3 > for_each2;
- typedef boost::forward_adapter< for_each3_impl , 4 > for_each3;
- typedef boost::forward_adapter< for_each4_impl , 5 > for_each4;
- typedef boost::forward_adapter< for_each5_impl , 6 > for_each5;
- typedef boost::forward_adapter< for_each6_impl , 7 > for_each6;
- typedef boost::forward_adapter< for_each7_impl , 8 > for_each7;
- typedef boost::forward_adapter< for_each8_impl , 9 > for_each8;
- typedef boost::forward_adapter< reduce_impl , 3 > reduce;
+ return boost::fusion::accumulate( s , init , red );
+ }
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/range_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/range_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/range_algebra.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -14,10 +14,6 @@
#define BOOST_BOOST_NUMERIC_ODEINT_STANDARD_ALGEBRA_HPP_INCLUDED
#include <boost/range.hpp>
-#define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 9
-#include <boost/functional/forward_adapter.hpp>
-
-#include <boost/type_traits/remove_reference.hpp>
#include <boost/numeric/odeint/algebra/detail/macros.hpp>
#include <boost/numeric/odeint/algebra/detail/for_each.hpp>
@@ -29,156 +25,62 @@
struct range_algebra
{
- struct for_each1_impl
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
{
- template< class S1 , class Op >
- void operator()( S1 &s1 , Op op ) const
- {
- detail::for_each1( boost::begin( s1 ) , boost::end( s1 ) ,
- op );
- }
- typedef void result_type;
- };
+ detail::for_each1( boost::begin( s1 ) , boost::end( s1 ) ,
+ op );
+ }
- struct for_each2_impl
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
{
- template< class S1 , class S2 , class Op >
- void operator()( S1 &s1 , S2 &s2 , Op op ) const
- {
- detail::for_each2( boost::begin( s1 ) , boost::end( s1 ) ,
- boost::begin( s2 ) , op );
- }
- typedef void result_type;
- };
-
+ detail::for_each2( boost::begin( s1 ) , boost::end( s1 ) ,
+ boost::begin( s2 ) , op );
+ }
- struct for_each3_impl
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
{
+ detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , op );
+ }
- template< class S1 , class S2 , class S3 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) const
- {
- detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , op );
- }
- typedef void result_type;
- };
-
-
-
-
-
- struct for_each4_impl
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
{
+ detail::for_each4( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , op );
+ }
- template< class S1 , class S2 , class S3 , class S4 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) const
- {
- detail::for_each4( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , op );
- }
- typedef void result_type;
- };
-
-
-
-
- struct for_each5_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
{
+ detail::for_each5( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , op );
+ }
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) const
- {
- detail::for_each5( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , op );
- }
- typedef void result_type;
- };
-
-
-
-
-
-
- struct for_each6_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
{
+ detail::for_each6( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , op );
+ }
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) const
- {
- detail::for_each6( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , op );
- }
- typedef void result_type;
- };
-
-
-
-
-
-
- struct for_each7_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
{
+ detail::for_each7( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , op );
+ }
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) const
- {
- detail::for_each7( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , op );
- }
- typedef void result_type;
- };
-
-
-
-
-
-
- struct for_each8_impl
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
{
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) const
- {
- detail::for_each8( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , op );
- }
- typedef void result_type;
- };
-
+ detail::for_each8( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , boost::begin( s4 ) , boost::begin( s5 ) , boost::begin( s6 ) , boost::begin( s7 ) , boost::begin( s8 ) , op );
+ }
-// struct reduce
-// {
-// template< class Value , class S , class Red >
-// Value operator()( const S &s , Red red , Value init) const
-// {
-// return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
-// }
-// };
-
- struct reduce_impl
+ template< class Value , class S , class Red >
+ static Value reduce( const S &s , Red red , Value init)
{
- template< class Value , class S , class Red >
- Value operator()( const S &s , Red red , Value init) const
- {
- return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
- }
-
- template< class T > struct result;
- template< class F , class T1 , class T2 , class T3 >
- struct result< F( T1 , T2 , T3 ) >
- {
- /*
- * typedef T3 type would result in warnings
- */
- typedef typename boost::remove_reference< T3 >::type type;
- };
- };
-
-
+ return detail::reduce( boost::begin( s ) , boost::end( s ) , red , init );
+ }
- typedef boost::forward_adapter< for_each1_impl , 2 > for_each1;
- typedef boost::forward_adapter< for_each2_impl , 3 > for_each2;
- typedef boost::forward_adapter< for_each3_impl , 4 > for_each3;
- typedef boost::forward_adapter< for_each4_impl , 5 > for_each4;
- typedef boost::forward_adapter< for_each5_impl , 6 > for_each5;
- typedef boost::forward_adapter< for_each6_impl , 7 > for_each6;
- typedef boost::forward_adapter< for_each7_impl , 8 > for_each7;
- typedef boost::forward_adapter< for_each8_impl , 9 > for_each8;
- typedef boost::forward_adapter< reduce_impl , 3 > reduce;
};
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/algebra/vector_space_algebra.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -13,9 +13,6 @@
#ifndef BOOST_BOOST_NUMERIC_ODEINT_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
#define BOOST_BOOST_NUMERIC_ODEINT_VECTOR_SPACE_ALGEBRA_HPP_INCLUDED
-#define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 9
-#include <boost/functional/forward_adapter.hpp>
-
#include <boost/type_traits/remove_reference.hpp>
@@ -49,123 +46,62 @@
struct vector_space_algebra
{
- struct for_each1_impl
+ template< class S1 , class Op >
+ static void for_each1( S1 &s1 , Op op )
+ {
+ // ToDo : build checks, that the +-*/ operators are well defined
+ op( s1 );
+ }
+
+ template< class S1 , class S2 , class Op >
+ static void for_each2( S1 &s1 , S2 &s2 , Op op )
+ {
+ op( s1 , s2 );
+ }
+
+ template< class S1 , class S2 , class S3 , class Op >
+ static void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
+ {
+ op( s1 , s2 , s3 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class Op >
+ static void for_each4( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
+ static void for_each5( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
+ static void for_each6( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
+ static void for_each7( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op )
+ {
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
+ }
+
+ template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
+ static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
{
- template< class S1 , class Op >
- void operator()( S1 &s1 , Op op ) const
- {
- // ToDo : build checks, that the +-*/ operators are well defined
- op( s1 );
- }
- typedef void result_type;
- };
-
- struct for_each2_impl
- {
- template< class S1 , class S2 , class Op >
- void operator()( S1 &s1 , S2 &s2 , Op op ) const
- {
- op( s1 , s2 );
- }
- typedef void result_type;
- };
-
- struct for_each3_impl
- {
-
- template< class S1 , class S2 , class S3 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , Op op ) const
- {
- op( s1 , s2 , s3 );
- }
- typedef void result_type;
- };
-
- struct for_each4_impl
- {
-
- template< class S1 , class S2 , class S3 , class S4 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , Op op ) const
- {
- op( s1 , s2 , s3 , s4 );
- }
- typedef void result_type;
- };
-
- struct for_each5_impl
- {
-
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , Op op ) const
- {
- op( s1 , s2 , s3 , s4 , s5 );
- }
- typedef void result_type;
- };
-
- struct for_each6_impl
- {
-
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , Op op ) const
- {
- op( s1 , s2 , s3 , s4 , s5 , s6 );
- }
- typedef void result_type;
- };
-
- struct for_each7_impl
- {
-
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , Op op ) const
- {
- op( s1 , s2 , s3 , s4 , s5 , s6 , s7 );
- }
- typedef void result_type;
- };
-
- struct for_each8_impl
- {
-
- template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 ,class S7 , class S8 , class Op >
- void operator()( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op ) const
- {
- op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
- }
- typedef void result_type;
- };
-
-
- struct reduce_impl
- {
- template< class Value , class S , class Red >
- Value operator()( const S &s , Red red , Value init ) const
- {
- boost::numeric::odeint::vector_space_reduce< S > r;
- return r( s , red , init );
- }
-
- template< class T > struct result;
- template< class F , class T1 , class T2 , class T3 >
- struct result< F( T1 , T2 , T3 ) >
- {
- typedef typename boost::remove_reference< T3 >::type type;
- };
- };
-
-
- typedef boost::forward_adapter< for_each1_impl , 2 > for_each1;
- typedef boost::forward_adapter< for_each2_impl , 3 > for_each2;
- typedef boost::forward_adapter< for_each3_impl , 4 > for_each3;
- typedef boost::forward_adapter< for_each4_impl , 5 > for_each4;
- typedef boost::forward_adapter< for_each5_impl , 6 > for_each5;
- typedef boost::forward_adapter< for_each6_impl , 7 > for_each6;
- typedef boost::forward_adapter< for_each7_impl , 8 > for_each7;
- typedef boost::forward_adapter< for_each8_impl , 9 > for_each8;
- typedef boost::forward_adapter< reduce_impl , 3 > reduce;
+ op( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
+ }
+ template< class Value , class S , class Red >
+ static Value reduce( const S &s , Red red , Value init )
+ {
+ boost::numeric::odeint::vector_space_reduce< S > r;
+ return r( s , red , init );
+ }
};
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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -121,7 +121,7 @@
/*
* Version 2 : do_step( sys , x , dxdt , t , dt )
*
- * the two overloads are needed in order to solve the forwarding problem
+ * this version does not solve the forwarding problem, boost.range can not be used
*/
template< class System , class StateInOut , class DerivIn >
void do_step( System system , StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
@@ -129,11 +129,6 @@
this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
}
- template< class System , class StateInOut , class DerivIn >
- void do_step( System system , const StateInOut &x , const DerivIn &dxdt , const time_type &t , const time_type &dt )
- {
- this->stepper().do_step_impl( system , x , dxdt , t , x , dt );
- }
@@ -141,26 +136,24 @@
/*
* Version 3 : do_step( sys , in , t , out , dt )
*
- * the two overloads are needed in order to solve the forwarding problem
+ * this version does not solve the forwarding problem, boost.range can not be used
*/
template< class System , class StateIn , class StateOut >
void do_step( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
{
- do_step_caller_v3( system , in , t , out , dt );
+ typename boost::unwrap_reference< System >::type &sys = system;
+ m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
+ sys( in , m_dxdt ,t );
+ this->stepper().do_step_impl( system , in , m_dxdt , t , out , dt );
}
- template< class System , class StateIn , class StateOut >
- void do_step( System system , const StateIn &in , const time_type &t , const StateOut &out , const time_type &dt )
- {
- do_step_caller_v3( system , in , t , out , dt );
- }
/*
* Version 4 : do_step( sys , in , dxdt , t , out , dt )
*
- * the two overloads are needed in order to solve the forwarding problem
+ * this version does not solve the forwarding problem, boost.range can not be used
*/
template< class System , class StateIn , class DerivIn , class StateOut >
void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
@@ -168,12 +161,6 @@
this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
}
- template< class System , class StateIn , class DerivIn , class StateOut >
- void do_step( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , const StateOut &out , const time_type &dt )
- {
- this->stepper().do_step_impl( system , in , dxdt , t , out , dt );
- }
-
@@ -195,19 +182,6 @@
this->stepper().do_step_impl( system , x , m_dxdt , t , x , dt );
}
- // do_step_caller_v2 is not needed since it calls do_step_impl directly
-
- template< class System , class StateIn , class StateOut >
- void do_step_caller_v3( System system , const StateIn &in , const time_type &t , StateOut &out , const time_type &dt )
- {
- typename boost::unwrap_reference< System >::type &sys = system;
- m_size_adjuster.adjust_size_by_policy( in , adjust_size_policy() );
- sys( in , m_dxdt ,t );
- this->stepper().do_step_impl( system , in , m_dxdt , t , out , dt );
- }
-
- // do_step_caller_v4 is not needed since it calls do_step_impl directly
-
protected:
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -209,19 +209,19 @@
if( l == 0 )
{
coor_func( momentum_in , m_dqdt );
- typename algebra_type::for_each2()( coor_out , coor_in , m_dqdt ,
+ algebra_type::for_each2( coor_out , coor_in , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , coef_a[l] * dt ) );
momentum_func( coor_out , m_dqdt );
- typename algebra_type::for_each2()( momentum_out , momentum_in , m_dqdt ,
+ algebra_type::for_each2( momentum_out , momentum_in , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , coef_b[l] * dt ) );
}
else
{
coor_func( momentum_out , m_dqdt );
- typename algebra_type::for_each2()( coor_out , coor_out , m_dqdt ,
+ algebra_type::for_each2( coor_out , coor_out , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , coef_a[l] * dt ) );
momentum_func( coor_out , m_dqdt );
- typename algebra_type::for_each2()( momentum_out , momentum_out , m_dqdt ,
+ algebra_type::for_each2( momentum_out , momentum_out , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , coef_b[l] * dt ) );
}
}
@@ -260,18 +260,18 @@
{
if( l == 0 )
{
- typename algebra_type::for_each3()( coor_out , coor_in , momentum_in ,
+ algebra_type::for_each3( coor_out , coor_in , momentum_in ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
momentum_func( coor_out , m_dqdt );
- typename algebra_type::for_each3()( momentum_out , momentum_in , m_dqdt ,
+ algebra_type::for_each3( momentum_out , momentum_in , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * dt ) );
}
else
{
- typename algebra_type::for_each3()( coor_out , coor_out , momentum_out ,
+ algebra_type::for_each3( coor_out , coor_out , momentum_out ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_a[l] * dt ) );
momentum_func( coor_out , m_dqdt );
- typename algebra_type::for_each3()( momentum_out , momentum_out , m_dqdt ,
+ algebra_type::for_each3( momentum_out , momentum_out , m_dqdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , m_coef_b[l] * 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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -63,10 +63,10 @@
value_type error( const State &x_old , const Deriv &dxdt_old , Err &x_err , const Time &dt )
{
// this overwrites x_err !
- typename algebra_type::for_each3()( x_old , dxdt_old , x_err ,
+ algebra_type::for_each3( x_old , dxdt_old , x_err ,
typename operations_type::template rel_error< value_type >( m_eps_abs , m_eps_rel , m_a_x , m_a_dxdt * detail::get_value( dt ) ) );
- value_type res = typename algebra_type::reduce()( x_err , typename operations_type::template maximum< value_type >() , 0.0 );
+ value_type res = algebra_type::reduce( x_err , typename operations_type::template maximum< value_type >() , 0.0 );
return res;
}
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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -151,29 +151,29 @@
typename boost::unwrap_reference< System >::type &sys = system;
//m_x_tmp = x + dt*b21*dxdt
- typename algebra_type::for_each3()( m_x_tmp , in , dxdt_in ,
+ algebra_type::for_each3( m_x_tmp , in , dxdt_in ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
sys( m_x_tmp , m_k2 , t + dt*a2 );
// m_x_tmp = x + dt*b31*dxdt + dt*b32*m_k2
- typename algebra_type::for_each4()( m_x_tmp , in , dxdt_in , m_k2 ,
+ algebra_type::for_each4( m_x_tmp , in , dxdt_in , m_k2 ,
typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
sys( m_x_tmp , m_k3 , t + dt*a3 );
// m_x_tmp = x + dt * (b41*dxdt + b42*m_k2 + b43*m_k3)
- typename algebra_type::for_each5()( m_x_tmp , in , dxdt_in , m_k2 , m_k3 ,
+ algebra_type::for_each5( m_x_tmp , in , dxdt_in , m_k2 , m_k3 ,
typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
sys( m_x_tmp, m_k4 , t + dt*a4 );
- typename algebra_type::for_each6()( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 ,
+ algebra_type::for_each6( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 ,
typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
sys( m_x_tmp , m_k5 , t + dt*a5 );
- typename algebra_type::for_each7()( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 , m_k5 ,
+ algebra_type::for_each7( m_x_tmp , in , dxdt_in , m_k2 , m_k3 , m_k4 , m_k5 ,
typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
sys( m_x_tmp , m_k6 , t + dt );
- typename algebra_type::for_each7()( out , in , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 ,
+ algebra_type::for_each7( out , in , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 ,
typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c5 , dt*c6 ));
// the new derivative
@@ -201,7 +201,7 @@
do_step_impl( system , in , dxdt_in , t , out , dxdt_out , dt );
//error estimate
- typename algebra_type::for_each7()( xerr , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 , dxdt_out ,
+ algebra_type::for_each7( xerr , dxdt_in , m_k3 , m_k4 , m_k5 , m_k6 , dxdt_out ,
typename operations_type::template scale_sum6< time_type , time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 , dt*dc7 ) );
}
@@ -271,7 +271,7 @@
// const state_type &k6 = dopri5().m_k6;
// const state_type &k7 = *m_current_deriv;
- typename algebra_type::for_each8()( x , x_old , deriv_old , m_k3 , m_k4 , m_k5 , m_k6 , deriv_new ,
+ algebra_type::for_each8( x , x_old , deriv_old , m_k3 , m_k4 , m_k5 , m_k6 , deriv_new ,
typename operations_type::template scale_sum7< value_type , time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt * b1_theta , dt * b3_theta , dt * b4_theta , dt * b5_theta , dt * b6_theta , dt * b7_theta ) );
}
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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -124,7 +124,7 @@
do_step_impl( system , in , dxdt , t , out , dt );
//error estimate
- typename algebra_type::for_each6()( xerr , dxdt , m_k3 , m_k4 , m_k5 , m_k6 ,
+ algebra_type::for_each6( xerr , dxdt , m_k3 , m_k4 , m_k5 , m_k6 ,
typename operations_type::template scale_sum5< time_type , time_type , time_type , time_type , time_type >( dt*dc1 , dt*dc3 , dt*dc4 , dt*dc5 , dt*dc6 ));
}
@@ -167,29 +167,29 @@
typename boost::unwrap_reference< System >::type &sys = system;
//m_x1 = x + dt*b21*dxdt
- typename algebra_type::for_each3()( m_x_tmp , in , dxdt ,
+ algebra_type::for_each3( m_x_tmp , in , dxdt ,
typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt*b21 ) );
sys( m_x_tmp , m_k2 , t + dt*a2 );
// m_x_tmp = x + dt*b31*dxdt + dt*b32*m_x2
- typename algebra_type::for_each4()( m_x_tmp , in , dxdt , m_k2 ,
+ algebra_type::for_each4( m_x_tmp , in , dxdt , m_k2 ,
typename operations_type::template scale_sum3< value_type , time_type , time_type >( 1.0 , dt*b31 , dt*b32 ));
sys( m_x_tmp , m_k3 , t + dt*a3 );
// m_x_tmp = x + dt * (b41*dxdt + b42*m_x2 + b43*m_x3)
- typename algebra_type::for_each5()( m_x_tmp , in , dxdt , m_k2 , m_k3 ,
+ algebra_type::for_each5( m_x_tmp , in , dxdt , m_k2 , m_k3 ,
typename operations_type::template scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt*b41 , dt*b42 , dt*b43 ));
sys( m_x_tmp, m_k4 , t + dt*a4 );
- typename algebra_type::for_each6()( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 ,
+ algebra_type::for_each6( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 ,
typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b51 , dt*b52 , dt*b53 , dt*b54 ));
sys( m_x_tmp , m_k5 , t + dt*a5 );
- typename algebra_type::for_each7()( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 , m_k5 ,
+ algebra_type::for_each7( m_x_tmp , in , dxdt , m_k2 , m_k3 , m_k4 , m_k5 ,
typename operations_type::template scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt*b61 , dt*b62 , dt*b63 , dt*b64 , dt*b65 ));
sys( m_x_tmp , m_k6 , t + dt*a6 );
- typename algebra_type::for_each6()( out , in , dxdt , m_k3 , m_k4 , m_k6 ,
+ algebra_type::for_each6( out , in , dxdt , m_k3 , m_k4 , m_k6 ,
typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt*c1 , dt*c3 , dt*c4 , dt*c6 ));
}
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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -48,7 +48,7 @@
template< class System , class StateIn , class DerivIn , class StateOut >
void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , const time_type &t , StateOut &out , const time_type &dt )
{
- typename algebra_type::for_each3()( out , in , dxdt , typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
+ algebra_type::for_each3( out , in , dxdt , typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , dt ) );
}
@@ -56,7 +56,7 @@
void calc_state( StateOut &x , const time_type &t , const StateIn1 &old_state , const time_type &t_old , const StateIn2 ¤t_state , const time_type &t_new )
{
time_type delta = t - t_old;
- typename algebra_type::for_each3()( x , old_state , stepper_base_type::m_dxdt , typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
+ algebra_type::for_each3( x , old_state , stepper_base_type::m_dxdt , typename operations_type::template scale_sum2< value_type , time_type >( 1.0 , delta ) );
}
};
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 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -111,7 +111,7 @@
// dt * dxdt = k1
// m_x_tmp = x + dh*dxdt
- typename algebra_type::for_each3()( m_x_tmp , in , dxdt ,
+ algebra_type::for_each3( m_x_tmp , in , dxdt ,
typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
@@ -119,14 +119,14 @@
sys( m_x_tmp , m_dxt , th );
// m_x_tmp = x + dh*m_dxt
- typename algebra_type::for_each3()( m_x_tmp , in , m_dxt ,
+ algebra_type::for_each3( m_x_tmp , in , m_dxt ,
typename operations_type::template scale_sum2< value_type , time_type >( val1 , dh ) );
// dt * m_dxm = k3
sys( m_x_tmp , m_dxm , th );
//m_x_tmp = x + dt*m_dxm
- typename algebra_type::for_each3()( m_x_tmp , in , m_dxm ,
+ algebra_type::for_each3( m_x_tmp , in , m_dxm ,
typename operations_type::template scale_sum2< value_type , time_type >( val1 , dt ) );
@@ -135,7 +135,7 @@
//x += dt/6 * ( m_dxdt + m_dxt + val2*m_dxm )
time_type dt6 = dt / static_cast< value_type >( 6.0 );
time_type dt3 = dt / static_cast< value_type >( 3.0 );
- typename algebra_type::for_each6()( out , in , dxdt , m_dxt , m_dxm , m_dxh ,
+ algebra_type::for_each6( out , in , dxdt , m_dxt , m_dxm , m_dxh ,
typename operations_type::template scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt6 , dt3 , dt3 , dt6 ) );
}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/butcher/algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/butcher/algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/butcher/algebra.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -44,7 +44,7 @@
// *first1++ = *first2++ + a1 * *first3++ ;
- std_algebra::for_each3()( x_tmp , x , k_vector[0] ,
+ std_algebra::for_each3( x_tmp , x , k_vector[0] ,
std_op::scale_sum2<>( 1.0 , a1 ) );
@@ -74,7 +74,7 @@
// while( first1 != last1 )
// *first1++ = *first2++ + a1 * *first3++ + a2 * *first4++;
- std_algebra::for_each4()( x_tmp , x , k_vector[0] , k_vector[1] ,
+ std_algebra::for_each4( x_tmp , x , k_vector[0] , k_vector[1] ,
std_op::scale_sum3<>( 1.0 , a1 , a2 ) );
// for( size_t i=0 ; i<x.size() ; ++i )
@@ -106,7 +106,7 @@
// while( first1 != last1 )
// *first1++ = *first2++ + a1 * *first3++ + a2 * *first4++ + a3 * *first5++;
- std_algebra::for_each5()( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] ,
+ std_algebra::for_each5( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] ,
std_op::scale_sum4<>( 1.0 , a1 , a2 , a3 ) );
// for( size_t i=0 ; i<x.size() ; ++i )
@@ -141,7 +141,7 @@
// while( first1 != last1 )
// *first1++ = *first2++ + a1 * *first3++ + a2 * *first4++ + a3 * *first5++ + a4 * *first6++;
- std_algebra::for_each6()( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] ,
+ std_algebra::for_each6( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] ,
std_op::scale_sum5<>( 1.0 , a1 , a2 , a3 , a4 ) );
// for( size_t i=0 ; i<x.size() ; ++i )
@@ -178,7 +178,7 @@
// while( first1 != last1 )
// *first1++ = *first2++ + a1 * *first3++ + a2 * *first4++ + a3 * *first5++ + a4 * *first6++ + a5 * *first7++;
- std_algebra::for_each7()( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] , k_vector[4] ,
+ std_algebra::for_each7( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] , k_vector[4] ,
std_op::scale_sum6<>( 1.0 , a1 , a2 , a3 , a4 , a5 ) );
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/generic_stepper/fusion_algebra.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/generic_stepper/fusion_algebra.hpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/generic_stepper/fusion_algebra.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -40,7 +40,7 @@
inline static void foreach( state_type &x_tmp , const state_type &x , const boost::array< double , 1 > &a ,
const state_type *k_vector , const double dt )
{
- std_algebra::for_each3()( x_tmp , x , k_vector[0] , std_op::scale_sum2<>( 1.0 , a[0]*dt ) );
+ std_algebra::for_each3( x_tmp , x , k_vector[0] , std_op::scale_sum2<>( 1.0 , a[0]*dt ) );
}
};
@@ -57,7 +57,7 @@
inline static void foreach( state_type &x_tmp , const state_type &x , const boost::array< double , 2 > &a ,
const state_type *k_vector , const double dt )
{
- std_algebra::for_each4()( x_tmp , x , k_vector[0] , k_vector[1] ,
+ std_algebra::for_each4( x_tmp , x , k_vector[0] , k_vector[1] ,
std_op::scale_sum3<>( 1.0 , a[0]*dt , a[1]*dt ) );
}
@@ -75,7 +75,7 @@
inline static void foreach( state_type &x_tmp , const state_type &x , const boost::array< double , 3 > &a ,
const state_type *k_vector , const double dt )
{
- std_algebra::for_each5()( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] ,
+ std_algebra::for_each5( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] ,
std_op::scale_sum4<>( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt) );
}
@@ -94,7 +94,7 @@
inline static void foreach( state_type &x_tmp , const state_type &x , const boost::array< double , 4 > &a ,
const state_type *k_vector , const double dt )
{
- std_algebra::for_each6()( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] ,
+ std_algebra::for_each6( x_tmp , x , k_vector[0] , k_vector[1] , k_vector[2] , k_vector[3] ,
std_op::scale_sum5<>( 1.0 , a[0]*dt , a[1]*dt , a[2]*dt , a[3]*dt ) );
}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/units/explicit_euler_units.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/units/explicit_euler_units.hpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/units/explicit_euler_units.hpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -52,7 +52,7 @@
template< class System , class State >
void do_step_impl( System system , const State &in , const deriv_type &dxdt , const time_type t , State & out , const time_type dt )
{
- typename algebra_type::for_each3()( out , in , dxdt , operations_type::make_scale_sum2( static_cast< value_type >( 1.0 ) , dt ) );
+ algebra_type::for_each3( out , in , dxdt , operations_type::make_scale_sum2( static_cast< value_type >( 1.0 ) , dt ) );
}
};
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/fusion_algebra.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/fusion_algebra.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/fusion_algebra.cpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -15,8 +15,6 @@
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
-#include <boost/range.hpp>
-
#include <boost/units/systems/si/length.hpp>
#include <boost/units/systems/si/time.hpp>
#include <boost/units/systems/si/velocity.hpp>
@@ -87,7 +85,7 @@
BOOST_AUTO_TEST_CASE( for_each2 )
{
fusion_fixture f;
- fusion_algebra::for_each2()( f.res , f.k1 ,
+ fusion_algebra::for_each2( f.res , f.k1 ,
default_operations::scale_sum1< time_type >( dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 0.1 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 0.1 , 1.0e-10 );
@@ -96,7 +94,7 @@
BOOST_AUTO_TEST_CASE( for_each3 )
{
fusion_fixture f;
- fusion_algebra::for_each3()( f.res , f.x , f.k1 ,
+ fusion_algebra::for_each3( f.res , f.x , f.k1 ,
default_operations::scale_sum2< value_type , time_type >( 1.0 , dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 1.1 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 1.1 , 1.0e-10 );
@@ -105,7 +103,7 @@
BOOST_AUTO_TEST_CASE( for_each4 )
{
fusion_fixture f;
- fusion_algebra::for_each4()( f.res , f.x , f.k1 , f.k2 ,
+ fusion_algebra::for_each4( f.res , f.x , f.k1 , f.k2 ,
default_operations::scale_sum3< value_type , time_type , time_type >( 1.0 , dt , dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 1.3 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 1.3 , 1.0e-10 );
@@ -114,7 +112,7 @@
BOOST_AUTO_TEST_CASE( for_each5 )
{
fusion_fixture f;
- fusion_algebra::for_each5()( f.res , f.x , f.k1 , f.k2 , f.k3 ,
+ fusion_algebra::for_each5( f.res , f.x , f.k1 , f.k2 , f.k3 ,
default_operations::scale_sum4< value_type , time_type , time_type , time_type >( 1.0 , dt , dt , dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 1.6 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 1.6 , 1.0e-10 );
@@ -123,7 +121,7 @@
BOOST_AUTO_TEST_CASE( for_each6 )
{
fusion_fixture f;
- fusion_algebra::for_each6()( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 ,
+ fusion_algebra::for_each6( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 ,
default_operations::scale_sum5< value_type , time_type , time_type , time_type , time_type >( 1.0 , dt , dt , dt , dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 2.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 2.0 , 1.0e-10 );
@@ -132,7 +130,7 @@
BOOST_AUTO_TEST_CASE( for_each7 )
{
fusion_fixture f;
- fusion_algebra::for_each7()( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 , f.k5 ,
+ fusion_algebra::for_each7( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 , f.k5 ,
default_operations::scale_sum6< value_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt , dt , dt , dt , dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 2.5 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 2.5 , 1.0e-10 );
@@ -141,7 +139,7 @@
BOOST_AUTO_TEST_CASE( for_each8 )
{
fusion_fixture f;
- fusion_algebra::for_each8()( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 , f.k5 , f.k6 ,
+ fusion_algebra::for_each8( f.res , f.x , f.k1 , f.k2 , f.k3 , f.k4 , f.k5 , f.k6 ,
default_operations::scale_sum7< value_type , time_type , time_type , time_type , time_type , time_type , time_type >( 1.0 , dt , dt , dt , dt , dt ,dt ) );
BOOST_CHECK_CLOSE( fusion::at_c< 0 >( f.res ).value() , 3.1 , 1.0e-10 );
BOOST_CHECK_CLOSE( fusion::at_c< 1 >( f.res ).value() , 3.1 , 1.0e-10 );
@@ -150,7 +148,7 @@
BOOST_AUTO_TEST_CASE( reduce )
{
- double sum = fusion_algebra::reduce()( fusion::make_vector( 1.0 , 2.0 , 3.0 ) , std::plus< double >() , 0.0 );
+ double sum = fusion_algebra::reduce( fusion::make_vector( 1.0 , 2.0 , 3.0 ) , std::plus< double >() , 0.0 );
BOOST_CHECK_CLOSE( sum , 6.0 , 1.0e-10 );
}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/is_pair.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/is_pair.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/is_pair.cpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -5,7 +5,7 @@
* Author: karsten
*/
-#define BOOST_TEST_MODULE odeint_standard_algebra
+#define BOOST_TEST_MODULE odeint_is_pair
#include <utility>
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/range_algebra.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/range_algebra.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/range_algebra.cpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -16,8 +16,6 @@
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
-#include <boost/range.hpp>
-
#include <boost/units/systems/si/length.hpp>
#include <boost/units/systems/si/time.hpp>
#include <boost/units/systems/si/velocity.hpp>
@@ -39,7 +37,7 @@
BOOST_AUTO_TEST_CASE( for_each2 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }};
- range_algebra::for_each2()( x1 , x2 , default_operations::scale_sum1<>( 1.0 ) );
+ range_algebra::for_each2( x1 , x2 , default_operations::scale_sum1<>( 1.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 2.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 2.0 , 1.0e-10 );
}
@@ -47,7 +45,7 @@
BOOST_AUTO_TEST_CASE( for_each3 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }};
- range_algebra::for_each3()( x1 , x2 , x3 , default_operations::scale_sum2<>( 1.0 , 2.0 ) );
+ range_algebra::for_each3( x1 , x2 , x3 , default_operations::scale_sum2<>( 1.0 , 2.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 8.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 8.0 , 1.0e-10 );
}
@@ -55,7 +53,7 @@
BOOST_AUTO_TEST_CASE( for_each4 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }};
- range_algebra::for_each4()( x1 , x2 , x3 , x4 , default_operations::scale_sum3<>( 1.0 , 2.0 , 3.0 ) );
+ range_algebra::for_each4( x1 , x2 , x3 , x4 , default_operations::scale_sum3<>( 1.0 , 2.0 , 3.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 20.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 20.0 , 1.0e-10 );
}
@@ -63,7 +61,7 @@
BOOST_AUTO_TEST_CASE( for_each5 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }};
- range_algebra::for_each5()( x1 , x2 , x3 , x4 , x5 , default_operations::scale_sum4<>( 1.0 , 2.0 , 3.0 , 4.0 ) );
+ range_algebra::for_each5( x1 , x2 , x3 , x4 , x5 , default_operations::scale_sum4<>( 1.0 , 2.0 , 3.0 , 4.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 40.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 40.0 , 1.0e-10 );
}
@@ -71,7 +69,7 @@
BOOST_AUTO_TEST_CASE( for_each6 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }};
- range_algebra::for_each6()( x1 , x2 , x3 , x4 , x5 , x6 ,default_operations::scale_sum5<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 ) );
+ range_algebra::for_each6( x1 , x2 , x3 , x4 , x5 , x6 ,default_operations::scale_sum5<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 70.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 70.0 , 1.0e-10 );
}
@@ -79,7 +77,7 @@
BOOST_AUTO_TEST_CASE( for_each7 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }} , x7 = {{ 7.0 , 7.0 }};
- range_algebra::for_each7()( x1 , x2 , x3 , x4 , x5 , x6 , x7 , default_operations::scale_sum6<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ) );
+ range_algebra::for_each7( x1 , x2 , x3 , x4 , x5 , x6 , x7 , default_operations::scale_sum6<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 112.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 112.0 , 1.0e-10 );
}
@@ -87,7 +85,7 @@
BOOST_AUTO_TEST_CASE( for_each8 )
{
std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }} , x2 = {{ 2.0 , 2.0 }} , x3 = {{ 3.0 , 3.0 }} , x4 = {{ 4.0 , 4.0 }} , x5 = {{ 5.0 , 5.0 }} , x6 = {{ 6.0 , 6.0 }} , x7 = {{ 7.0 , 7.0 }} , x8 = {{ 8.0 , 8.0 }};
- range_algebra::for_each8()( x1 , x2 , x3 , x4 , x5 , x6 , x7 , x8 , default_operations::scale_sum7<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 ) );
+ range_algebra::for_each8( x1 , x2 , x3 , x4 , x5 , x6 , x7 , x8 , default_operations::scale_sum7<>( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 ) );
BOOST_CHECK_CLOSE( x1[0] , 168.0 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1] , 168.0 , 1.0e-10 );
}
@@ -95,28 +93,13 @@
BOOST_AUTO_TEST_CASE( reduce )
{
std::tr1::array< double , 2 > x = {{ 1.25 , 2.25 }};
- double sum = range_algebra::reduce()( x , std::plus< double >() , 0.0 );
+ double sum = range_algebra::reduce( x , std::plus< double >() , 0.0 );
BOOST_CHECK_CLOSE( sum , 3.5 , 1.0e-10 );
BOOST_CHECK_CLOSE( x[0] , 1.25 , 1.0e-10 );
BOOST_CHECK_CLOSE( x[1] , 2.25 , 1.0e-10 );
}
-BOOST_AUTO_TEST_CASE( for_each2_with_range )
-{
- std::tr1::array< double , 2 > x1 = {{ 1.0 , 1.0 }};
- std::tr1::array< double , 4 > x2 = {{ 2.0 , 3.0 , 4.0 , 5.0 }};
- range_algebra::for_each2()( x1 , std::make_pair( x2.begin() + 1 , x2.begin() + 3 ) , default_operations::scale_sum1<>( 1.0 ) );
- BOOST_CHECK_CLOSE( x1[0] , 3.0 , 1.0e-10 );
- BOOST_CHECK_CLOSE( x1[1] , 4.0 , 1.0e-10 );
-
- range_algebra::for_each2()( std::make_pair( x2.begin() , x2.begin() + 2 ) , std::make_pair( x2.begin() + 2 ,x2.begin() + 4 ) , default_operations::scale_sum1<>( 2.0 ) );
- BOOST_CHECK_CLOSE( x2[0] , 8.0 , 1.0e-10 );
- BOOST_CHECK_CLOSE( x2[1] , 10.0 , 1.0e-10 );
- BOOST_CHECK_CLOSE( x2[2] , 4.0 , 1.0e-10 );
- BOOST_CHECK_CLOSE( x2[3] , 5.0 , 1.0e-10 );
-}
-
BOOST_AUTO_TEST_CASE( for_each2_with_units )
{
typedef units::quantity< si::time , double > time_type;
@@ -124,7 +107,7 @@
typedef units::quantity< si::velocity , double > velocity_type;
std::tr1::array< length_type , 2 > x1 = {{ 1.0 * si::meter , 1.0 * si::meter }};
std::tr1::array< velocity_type , 2 > x2 = {{ 2.0 * si::meter / si::seconds , 2.0 * si::meter / si::seconds }};
- range_algebra::for_each2()( x1 , x2 , default_operations::scale_sum1< time_type >( 0.1 * si::second ) );
+ range_algebra::for_each2( x1 , x2 , default_operations::scale_sum1< time_type >( 0.1 * si::second ) );
BOOST_CHECK_CLOSE( x1[0].value() , 0.2 , 1.0e-10 );
BOOST_CHECK_CLOSE( x1[1].value() , 0.2 , 1.0e-10 );
}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_ranges.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_ranges.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_ranges.cpp 2011-02-16 04:27:01 EST (Wed, 16 Feb 2011)
@@ -112,40 +112,6 @@
CHECK_DXDT_DEFAULT( f.dxdt );
}
-BOOST_AUTO_TEST_CASE( explicit_euler_with_range_v2 )
-{
- vector_fixture f;
- lorenz()( std::make_pair( f.in.begin() , f.in.begin() + 3 ) ,
- std::make_pair( f.dxdt.begin() + 3 , f.dxdt.begin() + 6 ) , 0.0 );
- f.euler.do_step( lorenz() , std::make_pair( f.in.begin() , f.in.begin() + 3 ) ,
- std::make_pair( f.dxdt.begin() + 3 , f.dxdt.begin() + 6 ) , 0.1 , 0.1 );
- CHECK_VALUES( f.in , 0.0 , 1.2 , 2.3 , 3.0 , 4.0 , 5.0 );
- CHECK_OUT_DEFAULT( f.out );
- CHECK_VALUES( f.dxdt , 100.0 , 101.0 , 102.0 , 0.0 , 2.0 , 3.0 );
-}
-
-BOOST_AUTO_TEST_CASE( explicit_euler_with_range_v3 )
-{
- vector_fixture f;
- f.euler.do_step( lorenz() , std::make_pair( f.in.begin() + 2 , f.in.begin() + 5 ) , 0.1 ,
- std::make_pair( f.out.begin() , f.out.begin() +3 ) , 0.1 );
- CHECK_IN_DEFAULT( f.in );
- CHECK_VALUES( f.out , 2.2 , 3.2 , 4.3 , 13.0 , 14.0 , 15.0 );
- CHECK_DXDT_DEFAULT( f.dxdt );
-}
-
-BOOST_AUTO_TEST_CASE( explicit_euler_with_range_v4 )
-{
- vector_fixture f;
- lorenz()( std::make_pair( f.in.begin() , f.in.begin() + 3 ) ,
- std::make_pair( f.dxdt.begin() + 3 , f.dxdt.begin() + 6 ) , 0.0 );
- f.euler.do_step( lorenz() , std::make_pair( f.in.begin() , f.in.begin() + 3 ) ,
- std::make_pair( f.dxdt.begin() + 3 , f.dxdt.begin() + 6 ) , 0.1 ,
- std::make_pair( f.out.begin() , f.out.begin() + 3 ) , 0.1 );
- CHECK_IN_DEFAULT( f.in );
- CHECK_VALUES( f.out , 0.0 , 1.2 , 2.3 , 13.0 , 14.0 , 15.0 );
- CHECK_VALUES( f.dxdt , 100.0 , 101.0 , 102.0 , 0.0 , 2.0 , 3.0 );
-}
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