Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57301 - in sandbox/odeint: boost/numeric/odeint libs/numeric/odeint/examples
From: mario.mulansky_at_[hidden]
Date: 2009-11-03 07:10:58


Author: mariomulansky
Date: 2009-11-03 07:10:57 EST (Tue, 03 Nov 2009)
New Revision: 57301
URL: http://svn.boost.org/trac/boost/changeset/57301

Log:
decreased template parameters in integrate method
Text files modified:
   sandbox/odeint/boost/numeric/odeint/euler.hpp | 2 ++
   sandbox/odeint/boost/numeric/odeint/integrator.hpp | 18 ++++++++++++------
   sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp | 3 +++
   sandbox/odeint/libs/numeric/odeint/examples/lorenz_integrator.cpp | 2 +-
   4 files changed, 18 insertions(+), 7 deletions(-)

Modified: sandbox/odeint/boost/numeric/odeint/euler.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/euler.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/euler.hpp 2009-11-03 07:10:57 EST (Tue, 03 Nov 2009)
@@ -44,6 +44,8 @@
 
     public:
 
+
+ // provide ContainerType, ResizeType, iterator and value_type to users of this class
         typedef ContainerType container_type;
         typedef ResizerType resizer_type;
         typedef typename container_type::iterator iterator;

Modified: sandbox/odeint/boost/numeric/odeint/integrator.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/integrator.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/integrator.hpp 2009-11-03 07:10:57 EST (Tue, 03 Nov 2009)
@@ -21,25 +21,31 @@
 namespace numeric {
 namespace odeint {
 
+
     class integrator {
 
     public:
 
+ /*
+ */
         template< class StepType,
                   class DynamicalSystem,
- class StateType,
                   class T >
- size_t integrate(StepType &stepper, DynamicalSystem &system, StateType &x,
- std::vector<T> &times, std::vector<StateType> &x_vec,
+ size_t integrate(StepType &stepper,
+ DynamicalSystem &system,
+ typename StepType::container_type &x,
+ std::vector<T> &times,
+ std::vector<typename StepType::container_type> &x_vec,
                          T dt = 1E-4, T eps_abs = 1E-7,
                          T eps_rel = 1E-8, T a_x = 1.0 , T a_dxdt = 1.0)
         {
             if( times.size() != x_vec.size() ) throw;
- step_controller_standard< StateType, T >
- controller(eps_abs, eps_rel, a_x, a_dxdt );
+ // we use the standard controller for this adaptive integrator
+ step_controller_standard< typename StepType::container_type, T, typename StepType::resize_type>
+ controller(eps_abs, eps_rel, a_x, a_dxdt ); // initialized with values from above
 
             typename std::vector<T>::iterator t_iter = times.begin();
- typename std::vector<StateType>::iterator x_iter = x_vec.begin();
+ typename std::vector<typename StepType::container_type>::iterator x_iter = x_vec.begin();
             controlled_step_result result;
             T t = *t_iter;
 

Modified: sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/stepsize_controller_standard.hpp 2009-11-03 07:10:57 EST (Tue, 03 Nov 2009)
@@ -46,6 +46,9 @@
         ResizeType resizer;
         
     public:
+
+ typedef ContainerType container_type;
+
         step_controller_standard( T abs_err, T rel_err, T factor_x, T factor_dxdt )
             : eps_abs(abs_err), eps_rel(rel_err), a_x(factor_x), a_dxdt(factor_dxdt)
         { }

Modified: sandbox/odeint/libs/numeric/odeint/examples/lorenz_integrator.cpp
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/lorenz_integrator.cpp (original)
+++ sandbox/odeint/libs/numeric/odeint/examples/lorenz_integrator.cpp 2009-11-03 07:10:57 EST (Tue, 03 Nov 2009)
@@ -80,5 +80,5 @@
 
 /*
   Compile with
- g++ -Wall -I$BOOST_ROOT -I../../../../ lorenz_array.cpp
+ g++ -Wall -I$BOOST_ROOT -I../../../../ lorenz_integrator.cpp
 */


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