ode_step.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2017, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 
24 #ifndef O2SCL_ODE_STEP_H
25 #define O2SCL_ODE_STEP_H
26 
27 /** \file ode_step.h
28  \brief File defining \ref o2scl::ode_step
29 */
30 
31 #include <o2scl/ode_funct.h>
32 
33 #ifndef DOXYGEN_NO_O2NS
34 namespace o2scl {
35 #endif
36 
37  /** \brief ODE stepper base [abstract base]
38  */
39  template<class vec_y_t=boost::numeric::ublas::vector<double>,
40  class vec_dydx_t=vec_y_t, class vec_yerr_t=vec_y_t,
41  class func_t=ode_funct11> class ode_step {
42 
43 #ifndef DOXGYENP
44 
45  protected:
46 
47  /** \brief The order of the ODE stepper
48  */
49  int order;
50 
51 #endif
52 
53  public:
54 
55  ode_step() {
56  order=0;
57  }
58 
59  virtual ~ode_step() {}
60 
61  /** \brief Return the order of the ODE stepper
62 
63  This is used, for example, by \ref astep_gsl to adaptively
64  adjust the stepsize.
65  */
66  virtual int get_order() {
67  return order;
68  }
69 
70  /** \brief Perform an integration step
71 
72  Given initial value of the n-dimensional function in \c y and
73  the derivative in \c dydx (which must generally be computed
74  beforehand) at the point \c x, take a step of size \c h giving
75  the result in \c yout, the uncertainty at \f$ x+h \f$ in \c
76  yerr, and the new derivative at \f$ x+h \f$ in \c dydx_out
77  using function \c derivs to calculate derivatives.
78  Implementations which do not calculate \c yerr and/or \c
79  dydx_out do not reference these variables so that a blank \c
80  vec_t can be given. All of the current \o2 implementations
81  allow \c yout=y and \c dydx_out=dydx if necessary
82  */
83  virtual int step(double x, double h, size_t n, vec_y_t &y,
84  vec_dydx_t &dydx, vec_y_t &yout, vec_yerr_t &yerr,
85  vec_dydx_t &dydx_out, func_t &derivs)=0;
86 
87  };
88 
89 #ifndef DOXYGEN_NO_O2NS
90 }
91 #endif
92 
93 #endif
The main O<span style=&#39;position: relative; top: 0.3em; font-size: 0.8em&#39;>2</span>scl O$_2$scl names...
Definition: anneal.h:42
virtual int step(double x, double h, size_t n, vec_y_t &y, vec_dydx_t &dydx, vec_y_t &yout, vec_yerr_t &yerr, vec_dydx_t &dydx_out, func_t &derivs)=0
Perform an integration step.
int order
The order of the ODE stepper.
Definition: ode_step.h:49
virtual int get_order()
Return the order of the ODE stepper.
Definition: ode_step.h:66
ODE stepper base [abstract base].
Definition: ode_step.h:41

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).