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