Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61126 - in sandbox/odeint: boost/numeric/odeint libs/numeric/odeint/doc libs/numeric/odeint/doc/html libs/numeric/odeint/doc/html/odeint libs/numeric/odeint/examples
From: mario.mulansky_at_[hidden]
Date: 2010-04-07 10:14:20


Author: mariomulansky
Date: 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
New Revision: 61126
URL: http://svn.boost.org/trac/boost/changeset/61126

Log:
+stepper concepts doc
Text files modified:
   sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp | 13 +
   sandbox/odeint/libs/numeric/odeint/doc/html/index.html | 24 +-
   sandbox/odeint/libs/numeric/odeint/doc/html/odeint/short_example.html | 14 +-
   sandbox/odeint/libs/numeric/odeint/doc/steppers.qbk | 251 ++++++++++++++++++++++++++++++++++++++-
   sandbox/odeint/libs/numeric/odeint/examples/Jamfile | 3
   5 files changed, 275 insertions(+), 30 deletions(-)

Modified: sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/controlled_stepper_bs.hpp 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
@@ -98,7 +98,7 @@
     public:
         
         // constructor
- controlled_stepper_bs(
+ controlled_stepper_bs(
                 time_type abs_err, time_type rel_err,
                 time_type factor_x, time_type factor_dxdt )
             : m_error_checker( abs_err, rel_err, factor_x, factor_dxdt ),
@@ -123,6 +123,17 @@
             m_d.resize(m_k_max);
         }
 
+ //constructor
+ controlled_stepper_bs(
+ const container_type &x,
+ time_type abs_err, time_type rel_err,
+ time_type factor_x, time_type factor_dxdt )
+ {
+ adjust_size(x);
+ this(abs_err , rel_err , factor_x , factor_dxdt);
+ }
+
+
 
         void adjust_size( const container_type &x )
         {

Modified: sandbox/odeint/libs/numeric/odeint/doc/html/index.html
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/doc/html/index.html (original)
+++ sandbox/odeint/libs/numeric/odeint/doc/html/index.html 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
@@ -1,10 +1,10 @@
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Chapter&#160;1.&#160;boost.sandbox.numeric.odeint</title>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Chapter 1. boost.sandbox.numeric.odeint</title>
 <link rel="stylesheet" href="boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="index.html" title="Chapter&#160;1.&#160;boost.sandbox.numeric.odeint">
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
+<link rel="start" href="index.html" title="Chapter 1. boost.sandbox.numeric.odeint">
 <link rel="next" href="odeint/short_example.html" title="Short Example">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -18,19 +18,19 @@
 </tr></table>
 <hr>
 <div class="spirit-nav"><a accesskey="n" href="odeint/short_example.html"><img src="../../doc/html/images/next.png" alt="Next"></a></div>
-<div class="chapter" title="Chapter&#160;1.&#160;boost.sandbox.numeric.odeint">
+<div class="chapter" lang="en">
 <div class="titlepage"><div>
 <div><h2 class="title">
-<a name="odeint"></a>Chapter&#160;1.&#160;boost.sandbox.numeric.odeint</h2></div>
+<a name="odeint"></a>Chapter 1. boost.sandbox.numeric.odeint</h2></div>
 <div><div class="author"><h3 class="author">
 <span class="firstname">Karsten</span> <span class="surname">Ahnert</span>
 </h3></div></div>
 <div><div class="author"><h3 class="author">
 <span class="firstname">Mario</span> <span class="surname">Mulansky</span>
 </h3></div></div>
-<div><p class="copyright">Copyright &#169; 2009 Karsten Ahnert and Mario Mulansky</p></div>
-<div><div class="legalnotice" title="Legal Notice">
-<a name="id366480"></a><p>
+<div><p class="copyright">Copyright © 2009 Karsten Ahnert and Mario Mulansky</p></div>
+<div><div class="legalnotice">
+<a name="id325363"></a><p>
         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)
       </p>
@@ -68,7 +68,7 @@
       your own traits</a></span></dt></dl></dd>
 </dl>
 </div>
-<div class="section" title="Overview">
+<div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
 <a name="odeint.overview"></a><a class="link" href="index.html#odeint.overview" title="Overview">Overview</a>
 </h2></div></div></div>
@@ -86,7 +86,7 @@
       for real life problems and serves just as illustrative example. In <span class="bold"><strong>odeint</strong></span>, the following algorithms are implemented:
     </p>
 <div class="table">
-<a name="id335508"></a><p class="title"><b>Table&#160;1.1.&#160;Stepper Algorithms</b></p>
+<a name="id326850"></a><p class="title"><b>Table 1.1. Stepper Algorithms</b></p>
 <div class="table-contents"><table class="table" summary="Stepper Algorithms">
 <colgroup>
 <col>
@@ -256,7 +256,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 01, 2010 at 12:26:11 GMT</small></p></td>
+<td align="left"><p><small>Last revised: April 07, 2010 at 14:12:31 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/odeint/libs/numeric/odeint/doc/html/odeint/short_example.html
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/doc/html/odeint/short_example.html (original)
+++ sandbox/odeint/libs/numeric/odeint/doc/html/odeint/short_example.html 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
@@ -1,12 +1,12 @@
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Short Example</title>
 <link rel="stylesheet" href="../boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;boost.sandbox.numeric.odeint">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;boost.sandbox.numeric.odeint">
-<link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;boost.sandbox.numeric.odeint">
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
+<link rel="start" href="../index.html" title="Chapter 1. boost.sandbox.numeric.odeint">
+<link rel="up" href="../index.html" title="Chapter 1. boost.sandbox.numeric.odeint">
+<link rel="prev" href="../index.html" title="Chapter 1. boost.sandbox.numeric.odeint">
 <link rel="next" href="../boost_sandbox_numeric_odeint/tutorial.html" title="Tutorial">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -22,7 +22,7 @@
 <div class="spirit-nav">
 <a accesskey="p" href="../index.html"><img src="../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../boost_sandbox_numeric_odeint/tutorial.html"><img src="../../../doc/html/images/next.png" alt="Next"></a>
 </div>
-<div class="section" title="Short Example">
+<div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
 <a name="odeint.short_example"></a><a class="link" href="short_example.html" title="Short Example">Short Example</a>
 </h2></div></div></div>
@@ -146,7 +146,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2009 Karsten Ahnert and Mario Mulansky<p>
+<td align="right"><div class="copyright-footer">Copyright © 2009 Karsten Ahnert and Mario Mulansky<p>
         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)
       </p>

Modified: sandbox/odeint/libs/numeric/odeint/doc/steppers.qbk
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/doc/steppers.qbk (original)
+++ sandbox/odeint/libs/numeric/odeint/doc/steppers.qbk 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
@@ -3,31 +3,264 @@
 
 [section Concepts]
 
-; huhu
+[section Dynamical system]
 
-[section Basic stepper]
+The dynamical system represents the right hand side of the differential equation:
+
+[* x'(t) = f(x(t) , t)]
+
+In this odeint library the dynamical system is realized by a callable object,
+e.g. a function pointer, a functor or an instance of an object with an
+appropriate `()`-operator.
+The parameter structure has to be the following:
 
-definitions
+`(const container_type &x, container_type &dxdt, const time_type t)`
 
-which class models this concept
+`x` is the current state of the system and `t` is the current time.
+The result *x' = f(x,t)* is then returned in `dxdt`.
+See the tutorial for examples on how to define the dynamical system.
 
 [endsect]
 
-[section Error stepper]
+[section Basic stepper]
 
-definitions
+Basic steppers execute one timestep of a specific order with a given stepsize.
+They usually allocate internal memory to store intermediate function call
+results.
+If state types with variable size are used (e.g. `vector`), it has to be assured
+that the stepper gets informed about any change of the state size by calling its
+`adjust_size` method.
+
+[*Template Parameters]
+
+[table
+ [[Parameter] [] [default value] [description]]
+ [[class Container] [required] [-] [Type of container that stores the state of the system]]
+ [[class Time] [optional] [double] [Type of the time variable in the ode]]
+ [[class Traits] [optional] [container_traits< Container >] [container_traits used by the stepper]]
+]
+
+[*Associated Types]
+[table
+ [[] [] [Description]]
+ [[Time] [Stepper::time_type] [Type of the time variable, e.g. `double`]]
+ [[Container] [Stepper::container_type] [Type of the system state, e.g. `vector<double>`]]
+ [[Value] [Stepper::value_type] [Value type of the state, e.g. `double`]]
+ [[Order Type] [Stepper::order_type] [Type of the order parameter, usually `unsigned short`]]
+]
+
+[*Methods]
+
+*`Stepper()` Constructor.
+
+*`Stepper( container_type &x )` Constructor that allocates internal memory to
+store intermediate results of the same size as `x`.
+
+*`void do_step( DynamicalSystem &system ,
+ container_type &x ,
+ time_type t ,
+ time_type dt )`
+
+Executes one timestep with the given parameters:
+[table
+ [[Parameter] [Type] [Description]]
+ [[system] [DynamicalSystem] [Function (callable object) that computes the rhs of the ode]]
+ [[x] [container_type] [The current state of the system *x(t)*]]
+ [[t] [time_type] [The current time *t*]]
+ [[dt] [time_type] [Length of the timestep to be executed]]
+]
+The result of this method is the (approximate) state of the system *x(t+dt)* and
+is stored in the variable `x` (in-place).
+Note, that the time `t` is not automatically increased by this method.
+
+*`void do_step( DynamicalSystem &system ,
+ container_type &x ,
+ const container_type &dxdt ,
+ time_type t ,
+ time_type dt )`
+
+The same as above but with the additional parameter `dxdt` that represents the
+derivative [*x'(t) = f(x,t)] at the time *t*.
+
+*`void adjust_size( const container_type &x )`
+Adjusts the internal memory to store intermediate results of the same size as
+`x`.
+This function /must/ be called whenever the system size changes during the
+integration.
+
+*`order_type order_step()`
+Returns the order of the algorithm. If *n* is the order of a method, then the
+result of one iteration with the timestep *dt* is accurate up to *dt^n*. That
+means the error made by the time discretization is of order *dt^(n+1)*.
+
+[*Stepper that model this concept]
+
+*`stepper_euler`
+*`stepper_rk4`
+*`stepper_rk78_fehlberg`
 
-which class models this concept
+[endsect]
+
+[section Error stepper]
 
+Error steppers execute one timestep of a specific order with a given stepsize.
+Additionally, an error estimation of the obtained result is computed that can
+be used to control the error introduced by the time discretization.
+As the basic steppers, error steppers usually allocate internal memory to store
+intermediate function call results. If state types with variable size are used
+(e.g. `vector`), it has to be assured that the stepper gets informed about any
+change of the state size by calling its `adjust_size` method.
+
+[*Template Parameters]
+
+Same as for /basic steppers/ above.
+
+[*Associated Types]
+
+Same as for /basic steppers/ above.
+
+[*Methods]
+
+*`Error_Stepper()` Constructor.
+
+*`Error_Stepper( container_type &x )` Constructor that allocates internal memory to
+store intermediate results of the same size as `x`.
+
+*`void do_step( DynamicalSystem &system ,
+ container_type &x ,
+ time_type t ,
+ time_type dt ,
+ container_type &xerr)`
+
+Executes one timestep with the given parameters:
+[table
+ [[Parameter] [Type] [Description]]
+ [[system] [DynamicalSystem] [Function (callable object) that computes the rhs of the ode]]
+ [[x] [container_type] [The current state of the system *x(t)*]]
+ [[t] [time_type] [The current time *t*]]
+ [[dt] [time_type] [Length of the timestep to be executed]]
+ [[xerr] [container_type] [Used by the method to return the error estimation of this computation]]
+]
+The result of this method is the (approximate) state of the system *x(t+dt)*,
+which is returned in the variable `x` (in-place), and the corresponding error
+estimation returned in `xerr`.
+Note, that the time `t` is not automatically increased by this method.
+
+*`void do_step( DynamicalSystem &system ,
+ container_type &x ,
+ const container_type &dxdt ,
+ time_type t ,
+ time_type dt ,
+ container_type &xerr)`
+
+The same as above but with the additional parameter `dxdt` that represents the
+derivative [*x'(t) = f(x,t)] at the time *t*.
+
+*`void adjust_size( const container_type &x )`
+Adjusts the internal memory to store intermediate results of the same size as
+`x`.
+This function /must/ be called whenever the system size changes during the
+integration.
+
+*`order_type order_error_step()`
+Returns the order of the result *x(t+dt)* of the algorithm.
+
+*`order_type order_error()`
+Returns the order of the error estimation of the algorithm.
+
+[*Stepper that model this concept]
+
+*`stepper_rk5_ck`
+*`stepper_rk78_fehlberg`
+*`stepper_half_step`
 
 [endsect]
 
 [section Controlled stepper]
 
-definitions
+Controlled steppers try to execute a timestep with a given error threshold.
+If the estimated error of the obtained solution is too big, the result is
+rejected and a new stepsize is proposed.
+If the error is small enough the timestep is accepted and possibly an increased
+stepsize is proposed.
+
+[*Template Parameters]
+
+Same as for /basic steppers/ above.
+
+[*Associated Types]
+
+Same as for /basic steppers/ above.
+
+[*Methods]
+
+*`Controlled_Stepper( time_type abs_err, time_type rel_err,
+ time_type factor_x, time_type factor_dxdt )`
+
+Constructor that initializes the controlled stepper with several parameters of
+the error control. The controlled stepper assures that the error done by each
+individual timestep yields:
+
+[* xerr < 1.1 ( eps_abs + eps_rel * (factor_x |x| + factor_dxdt h |x'|) ) ]
+
+The factor 1.1 is for safety to avoid unnecessary many stepsize adjustings.
+The above inequality should be understand to hold for /all/ components of the
+possibly more dimensional vectors *x*, *x'* and *xerr*.
+If the estimated error is too large, a reduced stepsize will be suggested.
+If the estimated error is less than half of the desired error, an increased
+stepsize will be suggested.
+
+*`Controlled_Stepper( container_type &x, time_type abs_err, time_type rel_err,
+ time_type factor_x, time_type factor_dxdt )`
+Same as above, but with additional allocation of the internal memory to store
+intermediate results of the same size as `x`.
+
+*`controlled_step_result try_step(
+ DynamicalSystem &system,
+ container_type &x,
+ time_type &t,
+ time_type &dt )`
+
+Tries one timestep with the given parameters
+[table
+ [[Parameter] [Type] [Description]]
+ [[system] [DynamicalSystem] [Function (callable object) that computes the rhs of the ode]]
+ [[x] [container_type] [The current state of the system *x(t)*]]
+ [[t] [time_type] [The current time *t*]]
+ [[dt] [time_type] [Length of the timestep to be executed]]
+]
+This method has three possible outcomes represented by the returned value `result`:
+If `result = success` the step has been applied and x contains the new state
+*x(t)* where the time has also been increased *t += dt*.
+If `result = step_size_increased` the step has also been accomplished, but the
+estimated error was so small that a new stepsize is proposed in the variable
+`dt`.
+If `result = step_size_decreased` the step has been rejected due to a too big
+error. `x` and `t` remain unchanged and `dt` now containes the suggested reduced
+stepsize that should give an error below the desired level.
+
+*`controlled_step_result try_step(
+ DynamicalSystem &system,
+ container_type &x,
+ const container_type &dxdt,
+ time_type &t,
+ time_type &dt )`
+Same as above but with the additional parameter `dxdt` that that represents the
+derivative *x'(t) = f(x,t)* at the time *t*.
+
+*`void adjust_size( const container_type &x )`
+Adjusts the internal memory to store intermediate results of the same size as
+`x`.
+This function /must/ be called whenever the system size changes during the
+integration.
+
+*`order_type order_error_step()`
+Returns the order of the result *x(t+dt)* of the algorithm.
 
-which class models this concept
+[*Stepper that model this concept]
 
+*`controlled_stepper_standard`
+*`controlled_stepper_bs`
 
 [endsect]
 

Modified: sandbox/odeint/libs/numeric/odeint/examples/Jamfile
==============================================================================
--- sandbox/odeint/libs/numeric/odeint/examples/Jamfile (original)
+++ sandbox/odeint/libs/numeric/odeint/examples/Jamfile 2010-04-07 10:14:20 EDT (Wed, 07 Apr 2010)
@@ -15,7 +15,8 @@
     ;
 
 exe harmonic_oscillator : harmonic_oscillator.cpp ;
-
+#exe test_container_and_stepper : test_container_and_stepper.cpp ;
+#exe hamiltonian_test : hamiltonian_test.cpp ;
 
 exe lorenz_cmp_rk4_rk_generic : lorenz_cmp_rk4_rk_generic.cpp ;
 exe lorenz_controlled : lorenz_controlled.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