|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70778 - in sandbox/odeint/branches/karsten: . boost/numeric/odeint/integrate libs/numeric/odeint/test
From: karsten.ahnert_at_[hidden]
Date: 2011-03-31 03:57:55
Author: karsten
Date: 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
New Revision: 70778
URL: http://svn.boost.org/trac/boost/changeset/70778
Log:
dense output and integrate function
Text files modified:
sandbox/odeint/branches/karsten/TODO | 26 +++++++++++----------
sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp | 24 ++++++++++++++++++++
sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_adaptive.hpp | 31 +++++++++++++++++++++++++
sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_n_steps.hpp | 47 ++++++++++++++++++++++++++++++++++++++++
sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp | 3 ++
5 files changed, 118 insertions(+), 13 deletions(-)
Modified: sandbox/odeint/branches/karsten/TODO
==============================================================================
--- sandbox/odeint/branches/karsten/TODO (original)
+++ sandbox/odeint/branches/karsten/TODO 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
@@ -19,22 +19,13 @@
* check copyright note
* documente every file in the preamble
* check once more, if all contructor, destructors and assign-operators are present
-* INTEGRATE FUNCTIONS
- * check forwarding problem, ranges
- OK * check where exactly the observer will be called (before, after each step?)
- OK * functions without obversers
- OK * integrate without stepper , intelligent choice of the stepper
- OK * check function signatures
- OK * what to throw?
- OK * check lambdas, lambda is broken
* Factory functions for steppers, controlled_steppers, error_checker und dense_output_stepper
-* implicit euler, include dfdt
* same interface for implicit_euler and rosenbrock4
-DIFFICULT * finishing change of controlled_stepper to units
+ * implicit euler, include dfdt
+* Controlled stepper and dense output stepper
* check if rosenbrock controller and controlled_stepper can both be used with the explicit steppers
- OK * move error_checker into controlled_stepper
+ * check if rosenbrock4_dense_output and dense_output_explicit can be used unified to one dense output stepper
* rename controlled_stepper to a more specific name
-* dense output for rosenbrock
* skript for setting the include defines according to the position in file system an writing a general copyright comment at the beginning
* Documentation
* Tutorials
@@ -43,6 +34,17 @@
DONE:
+OK * INTEGRATE FUNCTIONS
+ OK * check forwarding problem, ranges
+ OK * check where exactly the observer will be called (before, after each step?)
+ OK * functions without obversers
+ OK * integrate without stepper , intelligent choice of the stepper
+ OK * check function signatures
+ OK * what to throw?
+ OK * check lambdas, lambda is broken
+OK * move error_checker into controlled_stepper
+OK * finishing change of controlled_stepper to units
+OK * dense output for rosenbrock
OK * symplecit_stepper
OK * find an appropriate name, (symplectic stroemer nystroem)
OK * check is the coefficients are named good
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate.hpp 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
@@ -34,6 +34,8 @@
* ToDo :
*
* determine type of dxdt for units
+ *
+ * the two overloads are needed in order to solve the forwarding problem
*/
template< class System , class State , class Time , class Observer >
size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
@@ -41,12 +43,34 @@
return integrate_adaptive( controlled_error_stepper< explicit_error_rk54_ck< State > >() , system , start_state , start_time , end_time , dt , observer );
}
+template< class System , class State , class Time , class Observer >
+size_t integrate( System system , const State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
+{
+ return integrate_adaptive( controlled_error_stepper< explicit_error_rk54_ck< State > >() , system , start_state , start_time , end_time , dt , observer );
+}
+
+
+
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
template< class System , class State , class Time >
size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
{
return integrate( system , start_state , start_time , end_time , dt , do_nothing_observer() );
}
+template< class System , class State , class Time >
+size_t integrate( System system , const State &start_state , Time start_time , Time end_time , Time dt )
+{
+ return integrate( system , start_state , start_time , end_time , dt , do_nothing_observer() );
+}
+
+
} // namespace odeint
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_adaptive.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_adaptive.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_adaptive.hpp 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
@@ -20,7 +20,9 @@
namespace odeint {
-
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
template< class Stepper , class System , class State , class Time , class Observer >
size_t integrate_adaptive(
Stepper stepper , System system , State &start_state ,
@@ -33,6 +35,24 @@
observer , typename Stepper::stepper_category() );
}
+template< class Stepper , class System , class State , class Time , class Observer >
+size_t integrate_adaptive(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt ,
+ Observer observer )
+{
+ return detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+}
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
template< class Stepper , class System , class State , class Time >
size_t integrate_adaptive(
Stepper stepper , System system , State &start_state ,
@@ -41,6 +61,15 @@
return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , do_nothing_observer() );
}
+template< class Stepper , class System , class State , class Time >
+size_t integrate_adaptive(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time end_time , Time dt )
+{
+ return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , do_nothing_observer() );
+}
+
+
Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_n_steps.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_n_steps.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/integrate_n_steps.hpp 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
@@ -22,6 +22,8 @@
/*
* Integrates n steps
+ *
+ * the two overloads are needed in order to solve the forwarding problem
*/
template< class Stepper , class System , class State , class Time , class Observer >
Time integrate_n_steps(
@@ -49,6 +51,42 @@
return end_time;
}
+template< class Stepper , class System , class State , class Time , class Observer >
+Time integrate_n_steps(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps ,
+ Observer observer )
+{
+ Time end_time = dt * num_of_steps;
+
+ // we want to get as fast as possible to the end
+ if( boost::is_same< do_nothing_observer , Observer >::type::value )
+ {
+ detail::integrate_adaptive(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+ else
+ {
+ detail::integrate_const(
+ stepper , system , start_state ,
+ start_time , end_time , dt ,
+ observer , typename Stepper::stepper_category() );
+ }
+ return end_time;
+}
+
+
+
+
+
+
+
+
+/*
+ * the two overloads are needed in order to solve the forwarding problem
+ */
template< class Stepper , class System , class State , class Time >
Time integrate_n_steps(
Stepper stepper , System system , State &start_state ,
@@ -57,6 +95,15 @@
return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , do_nothing_observer() );
}
+template< class Stepper , class System , class State , class Time >
+Time integrate_n_steps(
+ Stepper stepper , System system , const State &start_state ,
+ Time start_time , Time dt , size_t num_of_steps )
+{
+ return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , do_nothing_observer() );
+}
+
+
} // namespace odeint
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/test/stepper_with_units.cpp 2011-03-31 03:57:54 EDT (Thu, 31 Mar 2011)
@@ -55,6 +55,9 @@
void oscillator( const state_type &x , deriv_type &dxdt , time_type t )
{
+ const units::quantity< si::frequency , value_type > omega = 1.0 * si::hertz;
+ fusion::at_c< 0 >( dxdt ) = fusion::at_c< 1 >( x );
+ fusion::at_c< 1 >( dxdt ) = - omega * omega * fusion::at_c< 0 >( x );
}
template< class Stepper >
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