Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70484 - in sandbox/odeint/branches/karsten: boost/numeric/odeint/integrate/detail libs/numeric/odeint/doc libs/numeric/odeint/doc/html libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint libs/numeric/odeint/examples
From: karsten.ahnert_at_[hidden]
Date: 2011-03-23 16:15:05


Author: karsten
Date: 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
New Revision: 70484
URL: http://svn.boost.org/trac/boost/changeset/70484

Log:
documentation
Text files modified:
   sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp | 1
   sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/reference.html | 2
   sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/tutorial.html | 29 +++++++++++++++-
   sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/index.html | 2
   sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/tutorial_stiff_systems.qbk | 3 +
   sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/stiff_system.cpp | 72 ++++++++++++++-------------------------
   6 files changed, 58 insertions(+), 51 deletions(-)

Modified: sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp (original)
+++ sandbox/odeint/branches/karsten/boost/numeric/odeint/integrate/detail/integrate_const.hpp 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -8,7 +8,6 @@
 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_
 #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_CONST_HPP_
 
-
 #include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>
 
 namespace boost {

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/reference.html
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/reference.html (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/reference.html 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -33,7 +33,7 @@
       classes</a>
 </h3></div></div></div>
 <div class="table">
-<a name="id378666"></a><p class="title"><b>Table&#160;1.3.&#160;Stepper Algorithms</b></p>
+<a name="id379162"></a><p class="title"><b>Table&#160;1.3.&#160;Stepper Algorithms</b></p>
 <div class="table-contents"><table class="table" summary="Stepper Algorithms">
 <colgroup>
 <col>

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/tutorial.html
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/tutorial.html (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/boost_sandbox_numeric_odeint/tutorial.html 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -960,11 +960,12 @@
 <pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">rosenbrock4</span><span class="special">&lt;</span> <span class="keyword">double</span> <span class="special">&gt;</span> <span class="identifier">stepper_type</span><span class="special">;</span>
 <span class="keyword">typedef</span> <span class="identifier">rosenbrock4_controller</span><span class="special">&lt;</span> <span class="identifier">stepper_type</span> <span class="special">&gt;</span> <span class="identifier">controlled_stepper_type</span><span class="special">;</span>
 
-<span class="identifier">vector_type</span> <span class="identifier">x</span><span class="special">(</span> <span class="number">3</span> <span class="special">,</span> <span class="number">1.0</span> <span class="special">)</span> <span class="special">,</span> <span class="identifier">xerr</span><span class="special">(</span> <span class="number">3</span> <span class="special">);</span>
+<span class="identifier">vector_type</span> <span class="identifier">x</span><span class="special">(</span> <span class="number">3</span> <span class="special">,</span> <span class="number">1.0</span> <span class="special">);</span>
 
 <span class="identifier">size_t</span> <span class="identifier">num_of_steps</span> <span class="special">=</span> <span class="identifier">integrate_const</span><span class="special">(</span> <span class="identifier">controlled_stepper_type</span><span class="special">()</span> <span class="special">,</span>
                 <span class="identifier">make_pair</span><span class="special">(</span> <span class="identifier">stiff_system</span><span class="special">()</span> <span class="special">,</span> <span class="identifier">stiff_system_jacobi</span><span class="special">()</span> <span class="special">)</span> <span class="special">,</span>
- <span class="identifier">x</span> <span class="special">,</span> <span class="number">0.0</span> <span class="special">,</span> <span class="number">50.0</span> <span class="special">,</span> <span class="number">0.01</span> <span class="special">);</span>
+ <span class="identifier">x</span> <span class="special">,</span> <span class="number">0.0</span> <span class="special">,</span> <span class="number">50.0</span> <span class="special">,</span> <span class="number">0.01</span> <span class="special">,</span>
+ <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg2</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span> <span class="special">&lt;&lt;</span> <span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg1</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span> <span class="special">);</span>
 </pre>
 <p>
         </p>
@@ -977,6 +978,30 @@
         XX steps.
       </p>
 <p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">explicit_error_dopri5</span><span class="special">&lt;</span> <span class="identifier">vector_type</span> <span class="special">&gt;</span> <span class="identifier">dopri5_type</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">controlled_error_stepper</span><span class="special">&lt;</span> <span class="identifier">dopri5_type</span> <span class="special">&gt;</span> <span class="identifier">controlled_dopri5_type</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">dense_output_controlled_explicit_fsal</span><span class="special">&lt;</span> <span class="identifier">controlled_dopri5_type</span> <span class="special">&gt;</span> <span class="identifier">dense_output_dopri5_type</span><span class="special">;</span>
+
+<span class="identifier">vector_type</span> <span class="identifier">x2</span><span class="special">(</span> <span class="number">3</span> <span class="special">,</span> <span class="number">1.0</span> <span class="special">);</span>
+
+<span class="identifier">size_t</span> <span class="identifier">num_of_steps2</span> <span class="special">=</span> <span class="identifier">integrate_const</span><span class="special">(</span> <span class="identifier">dense_output_dopri5_type</span><span class="special">()</span> <span class="special">,</span>
+ <span class="identifier">stiff_system</span><span class="special">()</span> <span class="special">,</span> <span class="identifier">x2</span> <span class="special">,</span> <span class="number">0.0</span> <span class="special">,</span> <span class="number">50.0</span> <span class="special">,</span> <span class="number">0.01</span> <span class="special">,</span>
+ <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg2</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span> <span class="special">&lt;&lt;</span> <span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">arg1</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span> <span class="special">);</span>
+<span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="identifier">num_of_steps2</span> <span class="special">&lt;&lt;</span> <span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Note, that we have used Boost.Phoenix
+ a great functional programming library to create and compose the observer.
+ </p>
+<p>
         The full example can be found here: ../../examples/stiff_system.cpp
       </p>
 </div>

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/index.html
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/index.html (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/html/index.html 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -93,7 +93,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 22, 2011 at 17:34:59 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 23, 2011 at 08:22:08 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/tutorial_stiff_systems.qbk
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/tutorial_stiff_systems.qbk (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/doc/tutorial_stiff_systems.qbk 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -30,6 +30,9 @@
 
 During the integration approximately XX steps have been done. Comparing to a classical Runge-Kutta solver this is a very good result. For example the Dormand-Prince 5 method with step size control and dense output yields ca. XX steps.
 
+[integrate_stiff_system_alternative]
+
+Note, that we have used __boost_phoenix a great functional programming library to create and compose the observer.
 
 The full example can be found here: [@../../examples/stiff_system.cpp]
 

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/stiff_system.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/stiff_system.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/examples/stiff_system.cpp 2011-03-23 16:15:03 EDT (Wed, 23 Mar 2011)
@@ -12,9 +12,14 @@
 
 #include <boost/numeric/odeint.hpp>
 
+#include <boost/spirit/include/phoenix.hpp>
+
 using namespace std;
 using namespace boost::numeric::odeint;
+namespace phoenix = boost::phoenix;
+
 
+/*
 //[ stiff_system_definition
 typedef boost::numeric::ublas::vector< double > vector_type;
 typedef boost::numeric::ublas::matrix< double > matrix_type;
@@ -41,16 +46,18 @@
         }
 };
 //]
+*/
 
 
-/*
 //[ stiff_system_alternative_definition
+typedef boost::numeric::ublas::vector< double > vector_type;
+typedef boost::numeric::ublas::matrix< double > matrix_type;
+
 struct stiff_system
 {
         template< class State >
         void operator()( const State &x , State &dxdt , double t )
         {
- ...
         }
 };
 
@@ -59,50 +66,9 @@
         template< class State , class Matrix >
         void operator()( const State &x , Matrix &J , const double &t , State &dfdt )
         {
- ...
         }
 };
 //]
-*/
-
-
-
-
-
-void rk54_ck_controlled_with_stiff_system( void )
-{
- typedef explicit_error_rk54_ck< vector_type > stepper_type;
- typedef controlled_error_stepper< stepper_type > controlled_stepper_type;
- controlled_stepper_type stepper;
-
- vector_type x( 3 , 1.0 );
- double t = 0.0 , dt = 0.00001;
- ofstream fout( "rk54_ck_controller_stiff.dat" );
- size_t count = 0;
- while( t < 50.0 )
- {
- fout << t << "\t" << dt << "\t" << stepper.last_error() << "\t";
- fout << x[0] << "\t" << x[1] << "\t" << x[2] << "\t";
- fout <<std::endl;
-
- size_t trials = 0;
- while( trials < 100 )
- {
- if( stepper.try_step( stiff_system() , x , t , dt ) != step_size_decreased )
- break;
- ++trials;
- }
- if( trials == 100 )
- {
- cerr << "Error : stepper did not converge! " << endl;
- break;
- }
- ++count;
- }
- clog << "RK 54 : " << count << endl;
-}
-
-
 
 
 
@@ -113,15 +79,29 @@
         typedef rosenbrock4< double > stepper_type;
         typedef rosenbrock4_controller< stepper_type > controlled_stepper_type;
 
- vector_type x( 3 , 1.0 ) , xerr( 3 );
+ vector_type x( 3 , 1.0 );
 
         size_t num_of_steps = integrate_const( controlled_stepper_type() ,
                         make_pair( stiff_system() , stiff_system_jacobi() ) ,
- x , 0.0 , 50.0 , 0.01 );
+ x , 0.0 , 50.0 , 0.01 ,
+ cout << phoenix::arg_names::arg2 << " " << phoenix::arg_names::arg1[0] << "\n" );
 //]
         clog << num_of_steps << endl;
 
- rk54_ck_controlled_with_stiff_system();
+
+
+//[ integrate_stiff_system_alternative
+ typedef explicit_error_dopri5< vector_type > dopri5_type;
+ typedef controlled_error_stepper< dopri5_type > controlled_dopri5_type;
+ typedef dense_output_controlled_explicit_fsal< controlled_dopri5_type > dense_output_dopri5_type;
+
+ vector_type x2( 3 , 1.0 );
+
+ size_t num_of_steps2 = integrate_const( dense_output_dopri5_type() ,
+ stiff_system() , x2 , 0.0 , 50.0 , 0.01 ,
+ cout << phoenix::arg_names::arg2 << " " << phoenix::arg_names::arg1[0] << "\n" );
+ clog << num_of_steps2 << endl;
+//]
 
         return 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