3
|
1 /* |
|
2 |
1868
|
3 Copyright (C) 1996 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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_DAEFunc_h) |
|
24 #define octave_DAEFunc_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
465
|
30 class Matrix; |
|
31 class ColumnVector; |
3
|
32 |
384
|
33 #if !defined (octave_DAEFunc_typedefs) |
|
34 #define octave_DAEFunc_typedefs 1 |
3
|
35 |
|
36 #endif |
|
37 |
1868
|
38 class |
|
39 DAEFunc |
3
|
40 { |
|
41 public: |
|
42 |
532
|
43 struct DAEJac |
|
44 { |
|
45 Matrix *dfdxdot; |
|
46 Matrix *dfdx; |
|
47 }; |
|
48 |
1528
|
49 typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x, |
|
50 const ColumnVector& xdot, double); |
|
51 |
|
52 typedef DAEJac (*DAEJacFunc) (const ColumnVector& x, |
|
53 const ColumnVector& xdot, double); |
|
54 |
|
55 DAEFunc (void) |
1868
|
56 : fun (0), jac (0) { } |
532
|
57 |
1528
|
58 DAEFunc (DAERHSFunc f) |
1868
|
59 : fun (f), jac (0) { } |
532
|
60 |
1528
|
61 DAEFunc (DAERHSFunc f, DAEJacFunc j) |
1868
|
62 : fun (f), jac (j) { } |
3
|
63 |
1528
|
64 DAEFunc (const DAEFunc& a) |
1868
|
65 : fun (a.fun), jac (a.jac) { } |
3
|
66 |
1528
|
67 DAEFunc& operator = (const DAEFunc& a) |
|
68 { |
1868
|
69 if (this != &a) |
|
70 { |
|
71 fun = a.fun; |
|
72 jac = a.jac; |
|
73 } |
1528
|
74 return *this; |
|
75 } |
3
|
76 |
1868
|
77 ~DAEFunc (void) { } |
|
78 |
1528
|
79 DAERHSFunc function (void) const { return fun; } |
|
80 |
|
81 DAEFunc& set_function (DAERHSFunc f) |
|
82 { |
|
83 fun = f; |
|
84 return *this; |
|
85 } |
3
|
86 |
1528
|
87 DAEJacFunc jacobian_function (void) const { return jac; } |
3
|
88 |
1528
|
89 DAEFunc& set_jacobian_function (DAEJacFunc j) |
|
90 { |
|
91 jac = j; |
|
92 return *this; |
|
93 } |
3
|
94 |
|
95 protected: |
|
96 |
|
97 DAERHSFunc fun; |
|
98 DAEJacFunc jac; |
|
99 }; |
|
100 |
|
101 #endif |
382
|
102 |
|
103 /* |
|
104 ;;; Local Variables: *** |
|
105 ;;; mode: C++ *** |
|
106 ;;; End: *** |
|
107 */ |