3
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
3
|
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 |
7016
|
9 Free Software Foundation; either version 3 of the License, or (at your |
|
10 option) any later version. |
3
|
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 |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_ODE_h) |
|
24 #define octave_ODE_h 1 |
|
25 |
3
|
26 #include "ODEFunc.h" |
1842
|
27 #include "base-de.h" |
289
|
28 |
1861
|
29 class |
|
30 ODE : public base_diff_eqn, public ODEFunc |
3
|
31 { |
|
32 public: |
|
33 |
1842
|
34 ODE (void) |
|
35 : base_diff_eqn (), ODEFunc () { } |
3
|
36 |
4587
|
37 ODE (const ColumnVector& s, double tm, const ODEFunc& f) |
|
38 : base_diff_eqn (s, tm), ODEFunc (f) { } |
3
|
39 |
1842
|
40 ODE (const ODE& a) |
|
41 : base_diff_eqn (a), ODEFunc (a) { } |
3
|
42 |
1842
|
43 ODE& operator = (const ODE& a) |
|
44 { |
|
45 if (this != &a) |
|
46 { |
|
47 base_diff_eqn::operator = (a); |
|
48 ODEFunc::operator = (a); |
|
49 } |
|
50 return *this; |
|
51 } |
3
|
52 |
1842
|
53 ~ODE (void) { } |
3984
|
54 |
|
55 // Derived classes must provide functions to actually do the |
|
56 // integration. |
|
57 |
|
58 // Return the vector of states at output time t. |
|
59 virtual ColumnVector do_integrate (double tt) = 0; |
|
60 |
|
61 // Return a matrix of states at each output time specified by t. |
|
62 // The rows of the result matrix should each correspond to a new |
|
63 // output time. |
|
64 virtual Matrix do_integrate (const ColumnVector& tt) = 0; |
|
65 |
|
66 virtual Matrix do_integrate (const ColumnVector& tt, |
|
67 const ColumnVector& ttcrit) = 0; |
|
68 |
|
69 // Lots of ways to call the single function and optionally set and |
|
70 // get additional information. |
|
71 |
|
72 // Integrate to t from current point. |
|
73 virtual ColumnVector integrate (double tt) |
|
74 { return do_integrate (tt); } |
|
75 |
|
76 // Set new x0, t0 and integrate to t. |
|
77 virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt) |
|
78 { |
|
79 initialize (x0, t0); |
|
80 return do_integrate (tt); |
|
81 } |
|
82 |
|
83 // Integrate from current point and return output at all points |
|
84 // specified by t. |
|
85 virtual Matrix integrate (const ColumnVector& tt) |
|
86 { return do_integrate (tt); } |
|
87 |
|
88 // Set new x0, t0 and integrate to return output at all points |
|
89 // specified by t. |
|
90 virtual Matrix integrate (const ColumnVector& x0, double t0, |
|
91 const ColumnVector& tt) |
|
92 { |
|
93 initialize (x0, t0); |
|
94 return do_integrate (tt); |
|
95 } |
|
96 |
|
97 // Integrate from current point and return output at all points |
|
98 // specified by t. |
|
99 virtual Matrix integrate (const ColumnVector& tt, |
|
100 const ColumnVector& ttcrit) |
|
101 { return do_integrate (tt, ttcrit); } |
|
102 |
|
103 // Set new x0, t0 and integrate to return output at all points |
|
104 // specified by t. |
|
105 virtual Matrix integrate (const ColumnVector& x0, double t0, |
|
106 const ColumnVector& tt, |
|
107 const ColumnVector& ttcrit) |
|
108 { |
|
109 initialize (x0, t0); |
|
110 return do_integrate (tt, ttcrit); |
|
111 } |
3
|
112 }; |
|
113 |
|
114 #endif |
|
115 |
|
116 /* |
|
117 ;;; Local Variables: *** |
|
118 ;;; mode: C++ *** |
|
119 ;;; End: *** |
|
120 */ |