1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Error Stepper</title> 5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Numeric.Odeint"> 8<link rel="up" href="../concepts.html" title="Concepts"> 9<link rel="prev" href="stepper.html" title="Stepper"> 10<link rel="next" href="controlled_stepper.html" title="Controlled Stepper"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../logo.jpg"></td> 15<td align="center"><a href="../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="stepper.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="controlled_stepper.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_numeric_odeint.concepts.error_stepper"></a><a class="link" href="error_stepper.html" title="Error Stepper">Error Stepper</a> 28</h3></div></div></div> 29<p> 30 This concepts specifies the interface an error stepper has to fulfill to 31 be used within a ControlledErrorStepper. An error stepper must always fulfill 32 the stepper concept. This can trivially implemented by 33 </p> 34<p> 35</p> 36<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">System</span> <span class="special">></span> 37<span class="identifier">error_stepper</span><span class="special">::</span><span class="identifier">do_step</span><span class="special">(</span> <span class="identifier">System</span> <span class="identifier">sys</span> <span class="special">,</span> <span class="identifier">state_type</span> <span class="special">&</span><span class="identifier">x</span> <span class="special">,</span> <span class="identifier">time_type</span> <span class="identifier">t</span> <span class="special">,</span> <span class="identifier">time_type</span> <span class="identifier">dt</span> <span class="special">)</span> 38<span class="special">{</span> 39 <span class="identifier">state_type</span> <span class="identifier">xerr</span><span class="special">;</span> 40 <span class="comment">// allocate xerr</span> 41 <span class="identifier">do_step</span><span class="special">(</span> <span class="identifier">sys</span> <span class="special">,</span> <span class="identifier">x</span> <span class="special">,</span> <span class="identifier">t</span> <span class="special">,</span> <span class="identifier">dt</span> <span class="special">,</span> <span class="identifier">xerr</span> <span class="special">);</span> 42<span class="special">}</span> 43</pre> 44<p> 45 </p> 46<h5> 47<a name="boost_numeric_odeint.concepts.error_stepper.h0"></a> 48 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.description"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.description">Description</a> 49 </h5> 50<p> 51 An error stepper following this Error Stepper concept is capable of doing 52 one step of the solution <span class="emphasis"><em>x(t)</em></span> of an ODE with step-size 53 <span class="emphasis"><em>dt</em></span> to obtain <span class="emphasis"><em>x(t+dt)</em></span> and also computing 54 an error estimate <span class="emphasis"><em>x<sub>err</sub></em></span> of the result. Error Steppers 55 can be Runge-Kutta steppers, symplectic steppers as well as implicit steppers. 56 Based on the stepper type, the ODE is defined as <a class="link" href="system.html" title="System">System</a>, 57 <a class="link" href="symplectic_system.html" title="Symplectic System">Symplectic 58 System</a>, <a class="link" href="simple_symplectic_system.html" title="Simple Symplectic System">Simple 59 Symplectic System</a> or <a class="link" href="implicit_system.html" title="Implicit System">Implicit 60 System</a>. 61 </p> 62<h5> 63<a name="boost_numeric_odeint.concepts.error_stepper.h1"></a> 64 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.refinement_of"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.refinement_of">Refinement 65 of</a> 66 </h5> 67<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 68<li class="listitem"> 69 DefaultConstructable 70 </li> 71<li class="listitem"> 72 CopyConstructable 73 </li> 74<li class="listitem"> 75 Stepper 76 </li> 77</ul></div> 78<h5> 79<a name="boost_numeric_odeint.concepts.error_stepper.h2"></a> 80 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.associated_types"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.associated_types">Associated 81 types</a> 82 </h5> 83<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 84<li class="listitem"> 85 <p><span class="bold"><strong>state_type</strong></span></p> 86<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">state_type</span></code></p> 87<p>The 88 type characterizing the state of the ODE, hence <span class="emphasis"><em>x</em></span>.</p> 89 </li> 90<li class="listitem"> 91 <p><span class="bold"><strong>deriv_type</strong></span></p> 92<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">deriv_type</span></code></p> 93<p>The 94 type characterizing the derivative of the ODE, hence <span class="emphasis"><em>d x/dt</em></span>.</p> 95 </li> 96<li class="listitem"> 97 <p><span class="bold"><strong>time_type</strong></span></p> 98<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">time_type</span></code></p> 99<p>The 100 type characterizing the dependent variable of the ODE, hence the time 101 <span class="emphasis"><em>t</em></span>.</p> 102 </li> 103<li class="listitem"> 104 <p><span class="bold"><strong>value_type</strong></span></p> 105<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">value_type</span></code></p> 106<p>The 107 numerical data type which is used within the stepper, something like 108 <code class="computeroutput"><span class="keyword">float</span></code>, <code class="computeroutput"><span class="keyword">double</span></code>, 109 <code class="computeroutput"><span class="identifier">complex</span><span class="special">&</span><span class="identifier">lt</span><span class="special">;</span> <span class="keyword">double</span> <span class="special">&</span><span class="identifier">gt</span><span class="special">;</span></code>.</p> 110 </li> 111<li class="listitem"> 112 <p><span class="bold"><strong>order_type</strong></span></p> 113<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">order_type</span></code></p> 114<p>The 115 type characterizing the order of the ODE, typically <code class="computeroutput"><span class="keyword">unsigned</span> 116 <span class="keyword">short</span></code>.</p> 117 </li> 118<li class="listitem"> 119 <p><span class="bold"><strong>stepper_category</strong></span></p> 120<p><code class="computeroutput"><span class="identifier">Stepper</span><span class="special">::</span><span class="identifier">stepper_category</span></code></p> 121<p>A 122 tag type characterizing the category of the stepper. This type must be 123 convertible to <code class="computeroutput"><span class="identifier">error_stepper_tag</span></code>.</p> 124 </li> 125</ul></div> 126<h5> 127<a name="boost_numeric_odeint.concepts.error_stepper.h3"></a> 128 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.notation"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.notation">Notation</a> 129 </h5> 130<div class="variablelist"> 131<p class="title"><b></b></p> 132<dl class="variablelist"> 133<dt><span class="term"><code class="computeroutput"><span class="identifier">ErrorStepper</span></code></span></dt> 134<dd><p> 135 A type that is a model of Error Stepper 136 </p></dd> 137<dt><span class="term"><code class="computeroutput"><span class="identifier">State</span></code></span></dt> 138<dd><p> 139 A type representing the state <span class="emphasis"><em>x</em></span> of the ODE 140 </p></dd> 141<dt><span class="term"><code class="computeroutput"><span class="identifier">Error</span></code></span></dt> 142<dd><p> 143 A type representing the error calculated by the stepper, usually same 144 as <code class="computeroutput"><span class="identifier">State</span></code> 145 </p></dd> 146<dt><span class="term"><code class="computeroutput"><span class="identifier">Time</span></code></span></dt> 147<dd><p> 148 A type representing the time <span class="emphasis"><em>t</em></span> of the ODE 149 </p></dd> 150<dt><span class="term"><code class="computeroutput"><span class="identifier">stepper</span></code></span></dt> 151<dd><p> 152 An object of type <code class="computeroutput"><span class="identifier">ErrorStepper</span></code> 153 </p></dd> 154<dt><span class="term"><code class="computeroutput"><span class="identifier">x</span></code></span></dt> 155<dd><p> 156 Object of type <code class="computeroutput"><span class="identifier">State</span></code> 157 </p></dd> 158<dt><span class="term"><code class="computeroutput"><span class="identifier">xerr</span></code></span></dt> 159<dd><p> 160 Object of type <code class="computeroutput"><span class="identifier">Error</span></code> 161 </p></dd> 162<dt><span class="term"><code class="computeroutput"><span class="identifier">t</span></code>, <code class="computeroutput"><span class="identifier">dt</span></code></span></dt> 163<dd><p> 164 Objects of type <code class="computeroutput"><span class="identifier">Time</span></code> 165 </p></dd> 166<dt><span class="term"><code class="computeroutput"><span class="identifier">sys</span></code></span></dt> 167<dd><p> 168 An object defining the ODE, should be a model of either <a class="link" href="system.html" title="System">System</a>, 169 <a class="link" href="symplectic_system.html" title="Symplectic System">Symplectic 170 System</a>, <a class="link" href="simple_symplectic_system.html" title="Simple Symplectic System">Simple 171 Symplectic System</a> or <a class="link" href="implicit_system.html" title="Implicit System">Implicit 172 System</a>. 173 </p></dd> 174</dl> 175</div> 176<h5> 177<a name="boost_numeric_odeint.concepts.error_stepper.h4"></a> 178 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.valid_expressions"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.valid_expressions">Valid 179 Expressions</a> 180 </h5> 181<div class="informaltable"><table class="table"> 182<colgroup> 183<col> 184<col> 185<col> 186<col> 187</colgroup> 188<thead><tr> 189<th> 190 <p> 191 Name 192 </p> 193 </th> 194<th> 195 <p> 196 Expression 197 </p> 198 </th> 199<th> 200 <p> 201 Type 202 </p> 203 </th> 204<th> 205 <p> 206 Semantics 207 </p> 208 </th> 209</tr></thead> 210<tbody> 211<tr> 212<td> 213 <p> 214 Get the stepper order 215 </p> 216 </td> 217<td> 218 <p> 219 <code class="computeroutput"><span class="identifier">stepper</span><span class="special">.</span><span class="identifier">order</span><span class="special">()</span></code> 220 </p> 221 </td> 222<td> 223 <p> 224 <code class="computeroutput"><span class="identifier">order_type</span></code> 225 </p> 226 </td> 227<td> 228 <p> 229 Returns the order of the stepper for one step without error estimation. 230 </p> 231 </td> 232</tr> 233<tr> 234<td> 235 <p> 236 Get the stepper order 237 </p> 238 </td> 239<td> 240 <p> 241 <code class="computeroutput"><span class="identifier">stepper</span><span class="special">.</span><span class="identifier">stepper_order</span><span class="special">()</span></code> 242 </p> 243 </td> 244<td> 245 <p> 246 <code class="computeroutput"><span class="identifier">order_type</span></code> 247 </p> 248 </td> 249<td> 250 <p> 251 Returns the order of the stepper for one error estimation step 252 which is used for error calculation. 253 </p> 254 </td> 255</tr> 256<tr> 257<td> 258 <p> 259 Get the error order 260 </p> 261 </td> 262<td> 263 <p> 264 <code class="computeroutput"><span class="identifier">stepper</span><span class="special">.</span><span class="identifier">errorr_order</span><span class="special">()</span></code> 265 </p> 266 </td> 267<td> 268 <p> 269 <code class="computeroutput"><span class="identifier">order_type</span></code> 270 </p> 271 </td> 272<td> 273 <p> 274 Returns the order of the error step which is used for error calculation. 275 </p> 276 </td> 277</tr> 278<tr> 279<td> 280 <p> 281 Do step 282 </p> 283 </td> 284<td> 285 <p> 286 <code class="computeroutput"><span class="identifier">stepper</span><span class="special">.</span><span class="identifier">do_step</span><span class="special">(</span> 287 <span class="identifier">sys</span> <span class="special">,</span> 288 <span class="identifier">x</span> <span class="special">,</span> 289 <span class="identifier">t</span> <span class="special">,</span> 290 <span class="identifier">dt</span> <span class="special">)</span></code> 291 </p> 292 </td> 293<td> 294 <p> 295 <code class="computeroutput"><span class="keyword">void</span></code> 296 </p> 297 </td> 298<td> 299 <p> 300 Performs one step of step size <code class="computeroutput"><span class="identifier">dt</span></code>. 301 The newly obtained state is written in-place to <code class="computeroutput"><span class="identifier">x</span></code>. 302 </p> 303 </td> 304</tr> 305<tr> 306<td> 307 <p> 308 Do step with error estimation 309 </p> 310 </td> 311<td> 312 <p> 313 <code class="computeroutput"><span class="identifier">stepper</span><span class="special">.</span><span class="identifier">do_step</span><span class="special">(</span> 314 <span class="identifier">sys</span> <span class="special">,</span> 315 <span class="identifier">x</span> <span class="special">,</span> 316 <span class="identifier">t</span> <span class="special">,</span> 317 <span class="identifier">dt</span> <span class="special">,</span> 318 <span class="identifier">xerr</span> <span class="special">)</span></code> 319 </p> 320 </td> 321<td> 322 <p> 323 <code class="computeroutput"><span class="keyword">void</span></code> 324 </p> 325 </td> 326<td> 327 <p> 328 Performs one step of step size <code class="computeroutput"><span class="identifier">dt</span></code> 329 with error estimation. The newly obtained state is written in-place 330 to <code class="computeroutput"><span class="identifier">x</span></code> and the estimated 331 error to <code class="computeroutput"><span class="identifier">xerr</span></code>. 332 </p> 333 </td> 334</tr> 335</tbody> 336</table></div> 337<h5> 338<a name="boost_numeric_odeint.concepts.error_stepper.h5"></a> 339 <span class="phrase"><a name="boost_numeric_odeint.concepts.error_stepper.models"></a></span><a class="link" href="error_stepper.html#boost_numeric_odeint.concepts.error_stepper.models">Models</a> 340 </h5> 341<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 342<li class="listitem"> 343 <code class="computeroutput"><span class="identifier">runge_kutta_cash_karp54</span></code> 344 </li> 345<li class="listitem"> 346 <code class="computeroutput"><span class="identifier">runge_kutta_dopri5</span></code> 347 </li> 348<li class="listitem"> 349 <code class="computeroutput"><span class="identifier">runge_kutta_fehlberg78</span></code> 350 </li> 351<li class="listitem"> 352 <code class="computeroutput"><span class="identifier">rosenbrock4</span></code> 353 </li> 354</ul></div> 355</div> 356<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 357<td align="left"></td> 358<td align="right"><div class="copyright-footer">Copyright © 2009-2015 Karsten Ahnert and Mario Mulansky<p> 359 Distributed under the Boost Software License, Version 1.0. (See accompanying 360 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>) 361 </p> 362</div></td> 363</tr></table> 364<hr> 365<div class="spirit-nav"> 366<a accesskey="p" href="stepper.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="controlled_stepper.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 367</div> 368</body> 369</html> 370