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_ODEFunc_h) |
|
25 #define octave_ODEFunc_h 1 |
|
26 |
465
|
27 class Matrix; |
|
28 class ColumnVector; |
3
|
29 |
1861
|
30 class |
|
31 ODEFunc |
3
|
32 { |
|
33 public: |
|
34 |
1536
|
35 typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double); |
|
36 typedef Matrix (*ODEJacFunc) (const ColumnVector&, double); |
|
37 |
|
38 ODEFunc (void) |
4049
|
39 : fun (0), jac (0), reset (true) { } |
532
|
40 |
1536
|
41 ODEFunc (ODERHSFunc f) |
4049
|
42 : fun (f), jac (0), reset (true) { } |
3
|
43 |
1536
|
44 ODEFunc (ODERHSFunc f, ODEJacFunc j) |
4049
|
45 : fun (f), jac (j), reset (true) { } |
3
|
46 |
1536
|
47 ODEFunc (const ODEFunc& a) |
4049
|
48 : fun (a.fun), jac (a.jac), reset (true) { } |
3
|
49 |
1536
|
50 ODEFunc& operator = (const ODEFunc& a) |
|
51 { |
1844
|
52 if (this != &a) |
|
53 { |
|
54 fun = a.fun; |
|
55 jac = a.jac; |
4049
|
56 reset = a.reset; |
1844
|
57 } |
1536
|
58 return *this; |
|
59 } |
3
|
60 |
1861
|
61 ~ODEFunc (void) { } |
|
62 |
1536
|
63 ODERHSFunc function (void) const { return fun; } |
|
64 |
|
65 ODEFunc& set_function (ODERHSFunc f) |
|
66 { |
|
67 fun = f; |
4049
|
68 reset = true; |
1536
|
69 return *this; |
|
70 } |
3
|
71 |
1536
|
72 ODEJacFunc jacobian_function (void) const { return jac; } |
3
|
73 |
1536
|
74 ODEFunc& set_jacobian_function (ODEJacFunc j) |
|
75 { |
|
76 jac = j; |
4049
|
77 reset = true; |
1536
|
78 return *this; |
|
79 } |
3
|
80 |
|
81 protected: |
|
82 |
|
83 ODERHSFunc fun; |
|
84 ODEJacFunc jac; |
4049
|
85 |
|
86 // This variable is TRUE when this object is constructed, and also |
|
87 // after any internal data has changed. Derived classes may use |
|
88 // this information (and change it) to know when to (re)initialize |
|
89 // their own internal data related to this object. |
|
90 |
|
91 bool reset; |
382
|
92 }; |
3
|
93 |
|
94 #endif |
|
95 |
|
96 /* |
|
97 ;;; Local Variables: *** |
|
98 ;;; mode: C++ *** |
|
99 ;;; End: *** |
|
100 */ |