GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ODE.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_ODE_h)
24 #define octave_ODE_h 1
25 
26 #include "octave-config.h"
27 
28 #include "ODEFunc.h"
29 #include "base-de.h"
30 
31 class
32 ODE : public base_diff_eqn, public ODEFunc
33 {
34 public:
35 
36  ODE (void)
37  : base_diff_eqn (), ODEFunc () { }
38 
39  ODE (const ColumnVector& s, double tm, const ODEFunc& f)
40  : base_diff_eqn (s, tm), ODEFunc (f) { }
41 
42  ODE (const ODE& a)
43  : base_diff_eqn (a), ODEFunc (a) { }
44 
45  ODE& operator = (const ODE& a)
46  {
47  if (this != &a)
48  {
51  }
52  return *this;
53  }
54 
55  virtual ~ODE (void) { }
56 
57  // Derived classes must provide functions to actually do the
58  // integration.
59 
60  // Return the vector of states at output time t.
61  virtual ColumnVector do_integrate (double tt) = 0;
62 
63  // Return a matrix of states at each output time specified by t.
64  // The rows of the result matrix should each correspond to a new
65  // output time.
66  virtual Matrix do_integrate (const ColumnVector& tt) = 0;
67 
68  virtual Matrix do_integrate (const ColumnVector& tt,
69  const ColumnVector& ttcrit) = 0;
70 
71  // Lots of ways to call the single function and optionally set and
72  // get additional information.
73 
74  // Integrate to t from current point.
75  virtual ColumnVector integrate (double tt)
76  { return do_integrate (tt); }
77 
78  // Set new x0, t0 and integrate to t.
79  virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt)
80  {
81  initialize (x0, t0);
82  return do_integrate (tt);
83  }
84 
85  // Integrate from current point and return output at all points
86  // specified by t.
87  virtual Matrix integrate (const ColumnVector& tt)
88  { return do_integrate (tt); }
89 
90  // Set new x0, t0 and integrate to return output at all points
91  // specified by t.
92  virtual Matrix integrate (const ColumnVector& x0, double t0,
93  const ColumnVector& tt)
94  {
95  initialize (x0, t0);
96  return do_integrate (tt);
97  }
98 
99  // Integrate from current point and return output at all points
100  // specified by t.
101  virtual Matrix integrate (const ColumnVector& tt,
102  const ColumnVector& ttcrit)
103  { return do_integrate (tt, ttcrit); }
104 
105  // Set new x0, t0 and integrate to return output at all points
106  // specified by t.
107  virtual Matrix integrate (const ColumnVector& x0, double t0,
108  const ColumnVector& tt,
109  const ColumnVector& ttcrit)
110  {
111  initialize (x0, t0);
112  return do_integrate (tt, ttcrit);
113  }
114 };
115 
116 #endif
ODE(const ColumnVector &s, double tm, const ODEFunc &f)
Definition: ODE.h:39
ODE(void)
Definition: ODE.h:36
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt, const ColumnVector &ttcrit)
Definition: ODE.h:107
ODEFunc & operator=(const ODEFunc &a)
Definition: ODEFunc.h:51
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
virtual ColumnVector integrate(double tt)
Definition: ODE.h:75
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt)
Definition: ODE.h:92
s
Definition: file-io.cc:2682
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
virtual Matrix integrate(const ColumnVector &tt, const ColumnVector &ttcrit)
Definition: ODE.h:101
Definition: ODE.h:31
virtual ~ODE(void)
Definition: ODE.h:55
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition: base-de.h:52
virtual Matrix integrate(const ColumnVector &tt)
Definition: ODE.h:87
Definition: dMatrix.h:37
virtual ColumnVector integrate(const ColumnVector &x0, double t0, double tt)
Definition: ODE.h:79
ODE(const ODE &a)
Definition: ODE.h:42
static void initialize(void)
Definition: mkoctfile.cc:123