summaryrefslogtreecommitdiff
path: root/libs/numeric/odeint/doc/html/boost/numeric/odeint/explicit_generic_rk.html
blob: baa6a0d71d0c9bd4a3f342ea633978270eefca2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template explicit_generic_rk</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/explicit_generic_rk_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/explicit_generic_rk.hpp&gt;">
<link rel="prev" href="../../../header/boost/numeric/odeint/stepper/explicit_generic_rk_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/explicit_generic_rk.hpp&gt;">
<link rel="next" href="../../../header/boost/numeric/odeint/stepper/extrapolation_stepper_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/extrapolation_stepper.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/explicit_generic_rk_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/explicit_generic_rk_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/extrapolation_stepper_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.numeric.odeint.explicit_generic_rk"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template explicit_generic_rk</span></h2>
<p>boost::numeric::odeint::explicit_generic_rk &#8212; A generic implementation of explicit Runge-Kutta algorithms. This class is as a base class for all explicit Runge-Kutta steppers. </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/explicit_generic_rk_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/explicit_generic_rk.hpp&gt;">boost/numeric/odeint/stepper/explicit_generic_rk.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="identifier">size_t</span> StageCount<span class="special">,</span> <span class="identifier">size_t</span> Order<span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Value<span class="special">,</span> 
         <span class="keyword">typename</span> Deriv<span class="special">,</span> <span class="keyword">typename</span> Time<span class="special">,</span> <span class="keyword">typename</span> Algebra<span class="special">,</span> <span class="keyword">typename</span> Operations<span class="special">,</span> 
         <span class="keyword">typename</span> Resizer<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="explicit_generic_rk.html" title="Class template explicit_generic_rk">explicit_generic_rk</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">explicit_stepper_base</span> <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">explicit_stepper_base</span><span class="special">&lt;</span> <span class="special">...</span> <span class="special">&gt;</span>          <a name="boost.numeric.odeint.explicit_generic_rk.stepper_base_type"></a><span class="identifier">stepper_base_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">state_type</span>         <a name="boost.numeric.odeint.explicit_generic_rk.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">wrapped_state_type</span> <a name="boost.numeric.odeint.explicit_generic_rk.wrapped_state_type"></a><span class="identifier">wrapped_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.explicit_generic_rk.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.explicit_generic_rk.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">wrapped_deriv_type</span> <a name="boost.numeric.odeint.explicit_generic_rk.wrapped_deriv_type"></a><span class="identifier">wrapped_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.explicit_generic_rk.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.explicit_generic_rk.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.explicit_generic_rk.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.explicit_generic_rk.resizer_type"></a><span class="identifier">resizer_type</span><span class="special">;</span>      
  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span>                           <a name="boost.numeric.odeint.explicit_generic_rk.rk_algorithm_type"></a><span class="identifier">rk_algorithm_type</span><span class="special">;</span> 
  <span class="keyword">typedef</span> <span class="identifier">rk_algorithm_type</span><span class="special">::</span><span class="identifier">coef_a_type</span>        <a name="boost.numeric.odeint.explicit_generic_rk.coef_a_type"></a><span class="identifier">coef_a_type</span><span class="special">;</span>       
  <span class="keyword">typedef</span> <span class="identifier">rk_algorithm_type</span><span class="special">::</span><span class="identifier">coef_b_type</span>        <a name="boost.numeric.odeint.explicit_generic_rk.coef_b_type"></a><span class="identifier">coef_b_type</span><span class="special">;</span>       
  <span class="keyword">typedef</span> <span class="identifier">rk_algorithm_type</span><span class="special">::</span><span class="identifier">coef_c_type</span>        <a name="boost.numeric.odeint.explicit_generic_rk.coef_c_type"></a><span class="identifier">coef_c_type</span><span class="special">;</span>       

  <span class="comment">// <a class="link" href="explicit_generic_rk.html#boost.numeric.odeint.explicit_generic_rkconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="explicit_generic_rk.html#idp40863552-bb"><span class="identifier">explicit_generic_rk</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">coef_a_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">coef_b_type</span> <span class="special">&amp;</span><span class="special">,</span> 
                      <span class="keyword">const</span> <span class="identifier">coef_c_type</span> <span class="special">&amp;</span><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="explicit_generic_rk.html#idp40845408-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">&gt;</span> 
    <span class="keyword">void</span> <a class="link" href="explicit_generic_rk.html#idp40845968-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="explicit_generic_rk.html#idp40859776-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="comment">// <a class="link" href="explicit_generic_rk.html#idp40870208-bb">private member functions</a></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">bool</span> <a class="link" href="explicit_generic_rk.html#idp40870784-bb"><span class="identifier">resize_impl</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="idp114450768"></a><h2>Description</h2>
<p>This class implements the explicit Runge-Kutta algorithms without error estimation in a generic way. The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a template-metaprogramming algorithm. ToDo : Add example!</p>
<p>This class derives explicit_stepper_base which provides the stepper interface.</p>
<p>
</p>
<div class="refsect2">
<a name="idp114452320"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_t</span> StageCount</pre>
<p>The number of stages of the Runge-Kutta algorithm. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_t</span> Order</pre>
<p>The order of the stepper. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> State</pre>
<p>The type representing the state of the ODE. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Value</pre>
<p>The floating point type which is used in the computations. </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="keyword">typename</span> Deriv</pre></li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Time</pre>
<p>The type representing the independent variable - the time - of the ODE. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Algebra</pre>
<p>The algebra type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Operations</pre>
<p>The operations type. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Resizer</pre>
<p>The resizer policy type. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp114471696"></a><h3>
<a name="boost.numeric.odeint.explicit_generic_rkconstruct-copy-destruct"></a><code class="computeroutput">explicit_generic_rk</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a name="idp40863552-bb"></a><span class="identifier">explicit_generic_rk</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">coef_a_type</span> <span class="special">&amp;</span> a<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">coef_b_type</span> <span class="special">&amp;</span> b<span class="special">,</span> 
                    <span class="keyword">const</span> <span class="identifier">coef_c_type</span> <span class="special">&amp;</span> c<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="explicit_generic_rk.html" title="Class template explicit_generic_rk">explicit_generic_rk</a></code> class. See examples section for details on the coefficients. <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">a</code></span></p></td>
<td><p>Triangular matrix of parameters b in the Butcher tableau. </p></td>
</tr>
<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>
<tr>
<td><p><span class="term"><code class="computeroutput">b</code></span></p></td>
<td><p>Last row of the butcher tableau. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">c</code></span></p></td>
<td><p>Parameters to calculate the time points in the Butcher tableau. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idp114498656"></a><h3>
<a name="idp40845408-bb"></a><code class="computeroutput">explicit_generic_rk</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">&gt;</span> 
  <span class="keyword">void</span> <a name="idp40845968-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="idp40859776-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 class="refsect2">
<a name="idp114549152"></a><h3>
<a name="idp40870208-bb"></a><code class="computeroutput">explicit_generic_rk</code> private 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> StateIn<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idp40870784-bb"></a><span class="identifier">resize_impl</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></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/explicit_generic_rk_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/explicit_generic_rk_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/extrapolation_stepper_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>