blob: 0bb44d98f626289d0f82c90ed4c4f46eb61558fd [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template runge_kutta_cash_karp54</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Boost.Numeric.Odeint">
<link rel="up" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp&gt;">
<link rel="prev" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp&gt;">
<link rel="next" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp&gt;">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../logo.jpg"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.numeric.odeint.runge_kutta_cash_karp54"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template runge_kutta_cash_karp54</span></h2>
<p>boost::numeric::odeint::runge_kutta_cash_karp54 &#8212; The Runge-Kutta Cash-Karp method. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp&gt;">boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp</a>&gt;
</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Value <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span> <span class="keyword">typename</span> Deriv <span class="special">=</span> <span class="identifier">State</span><span class="special">,</span>
<span class="keyword">typename</span> Time <span class="special">=</span> <span class="identifier">Value</span><span class="special">,</span>
<span class="keyword">typename</span> Algebra <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">algebra_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">algebra_type</span><span class="special">,</span>
<span class="keyword">typename</span> Operations <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">operations_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">operations_type</span><span class="special">,</span>
<span class="keyword">typename</span> Resizer <span class="special">=</span> <span class="identifier">initially_resizer</span><span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="runge_kutta_cash_karp54.html" title="Class template runge_kutta_cash_karp54">runge_kutta_cash_karp54</a> <span class="special">:</span> <span class="keyword">public</span> boost::numeric::odeint::explicit_error_generic_rk&lt; StageCount, Order, StepperOrder, ErrorOrder, State, Value, Deriv, Time, Algebra, Operations, Resizer &gt;
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// types</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">state_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.state_type"></a><span class="identifier">state_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">value_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.value_type"></a><span class="identifier">value_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">deriv_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.deriv_type"></a><span class="identifier">deriv_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">time_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.time_type"></a><span class="identifier">time_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">algebra_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.algebra_type"></a><span class="identifier">algebra_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">operations_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.operations_type"></a><span class="identifier">operations_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">stepper_base_type</span><span class="special">::</span><span class="identifier">resizer_type</span> <a name="boost.numeric.odeint.runge_kutta_cash_karp54.resizer_typ"></a><span class="identifier">resizer_typ</span><span class="special">;</span>
<span class="comment">// <a class="link" href="runge_kutta_cash_karp54.html#boost.numeric.odeint.runge_kutta_cash_karp54construct-copy-destruct">construct/copy/destruct</a></span>
<a class="link" href="runge_kutta_cash_karp54.html#idp41413664-bb"><span class="identifier">runge_kutta_cash_karp54</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">algebra_type</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="comment">// <a class="link" href="runge_kutta_cash_karp54.html#idp41379584-bb">public member functions</a></span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="runge_kutta_cash_karp54.html#idp41380144-bb"><span class="identifier">do_step_impl</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span>
<span class="identifier">StateOut</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">Err</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="runge_kutta_cash_karp54.html#idp41396080-bb"><span class="identifier">do_step_impl</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span>
<span class="identifier">StateOut</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="runge_kutta_cash_karp54.html#idp41409888-bb"><span class="identifier">adjust_size</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp117619552"></a><h2>Description</h2>
<p>The Runge-Kutta Cash-Karp method is one of the standard methods for solving ordinary differential equations, see <a href="http://en.wikipedia.org/wiki/Cash%E2%80%93Karp_methods" target="_top">en.wikipedia.org/wiki/Cash-Karp_methods</a>. The method is explicit and fulfills the Error Stepper concept. Step size control is provided but continuous output is not available for this method.</p>
<p>This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern). Furthermore, it derivs from <a class="link" href="explicit_error_generic_rk.html" title="Class template explicit_error_generic_rk">explicit_error_generic_rk</a> which is a generic Runge-Kutta algorithm with error estimation. For more details see explicit_error_stepper_base and <a class="link" href="explicit_error_generic_rk.html" title="Class template explicit_error_generic_rk">explicit_error_generic_rk</a>.</p>
<p>
</p>
<div class="refsect2">
<a name="idp117623888"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> State</pre>
<p>The state type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Value <span class="special">=</span> <span class="keyword">double</span></pre>
<p>The value type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Deriv <span class="special">=</span> <span class="identifier">State</span></pre>
<p>The type representing the time derivative of the state. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Time <span class="special">=</span> <span class="identifier">Value</span></pre>
<p>The time representing the independent variable - the time. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Algebra <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">algebra_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">algebra_type</span></pre>
<p>The algebra type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Operations <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">operations_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">operations_type</span></pre>
<p>The operations type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Resizer <span class="special">=</span> <span class="identifier">initially_resizer</span></pre>
<p>The resizer policy type. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp117654256"></a><h3>
<a name="boost.numeric.odeint.runge_kutta_cash_karp54construct-copy-destruct"></a><code class="computeroutput">runge_kutta_cash_karp54</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a name="idp41413664-bb"></a><span class="identifier">runge_kutta_cash_karp54</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&amp;</span> algebra <span class="special">=</span> <span class="identifier">algebra_type</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>Constructs the <code class="computeroutput"><a class="link" href="runge_kutta_cash_karp54.html" title="Class template runge_kutta_cash_karp54">runge_kutta_cash_karp54</a></code> class. This constructor can be used as a default constructor if the algebra has a default constructor. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">algebra</code></span></p></td>
<td><p>A copy of algebra is made and stored inside explicit_stepper_base. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idp117669328"></a><h3>
<a name="idp41379584-bb"></a><code class="computeroutput">runge_kutta_cash_karp54</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">&gt;</span>
<span class="keyword">void</span> <a name="idp41380144-bb"></a><span class="identifier">do_step_impl</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> in<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span> dxdt<span class="special">,</span>
<span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span> out<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">,</span> <span class="identifier">Err</span> <span class="special">&amp;</span> xerr<span class="special">)</span><span class="special">;</span></pre>This method performs one step. The derivative <code class="computeroutput">dxdt</code> of <code class="computeroutput">in</code> at the time <code class="computeroutput">t</code> is passed to the method. The result is updated out-of-place, hence the input is in <code class="computeroutput">in</code> and the output in <code class="computeroutput">out</code>. Futhermore, an estimation of the error is stored in <code class="computeroutput">xerr</code>. <code class="computeroutput">do_step_impl</code> is used by explicit_error_stepper_base. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">xerr</code></span></p></td>
<td><p>The result of the error estimation is written in xerr. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">&gt;</span>
<span class="keyword">void</span> <a name="idp41396080-bb"></a><span class="identifier">do_step_impl</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> in<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span> dxdt<span class="special">,</span>
<span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span> out<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>This method performs one step. The derivative <code class="computeroutput">dxdt</code> of <code class="computeroutput">in</code> at the time <code class="computeroutput">t</code> is passed to the method. The result is updated out-of-place, hence the input is in <code class="computeroutput">in</code> and the output in <code class="computeroutput">out</code>. Access to this step functionality is provided by explicit_stepper_base and <code class="computeroutput">do_step_impl</code> should not be called directly. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idp41409888-bb"></a><span class="identifier">adjust_size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> x<span class="special">)</span><span class="special">;</span></pre>Adjust the size of all temporaries in the stepper manually. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>A state from which the size of the temporaries to be resized is deduced. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</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-2012 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_hpp.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>