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