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