3
|
1 // DAEFunc.h -*- C++ -*- |
|
2 /* |
|
3 |
1868
|
4 Copyright (C) 1996 John W. Eaton |
3
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_DAEFunc_h) |
|
25 #define octave_DAEFunc_h 1 |
|
26 |
1296
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
465
|
31 class Matrix; |
|
32 class ColumnVector; |
3
|
33 |
384
|
34 #if !defined (octave_DAEFunc_typedefs) |
|
35 #define octave_DAEFunc_typedefs 1 |
3
|
36 |
|
37 #endif |
|
38 |
1868
|
39 class |
|
40 DAEFunc |
3
|
41 { |
|
42 public: |
|
43 |
532
|
44 struct DAEJac |
|
45 { |
|
46 Matrix *dfdxdot; |
|
47 Matrix *dfdx; |
|
48 }; |
|
49 |
1528
|
50 typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x, |
|
51 const ColumnVector& xdot, double); |
|
52 |
|
53 typedef DAEJac (*DAEJacFunc) (const ColumnVector& x, |
|
54 const ColumnVector& xdot, double); |
|
55 |
|
56 DAEFunc (void) |
1868
|
57 : fun (0), jac (0) { } |
532
|
58 |
1528
|
59 DAEFunc (DAERHSFunc f) |
1868
|
60 : fun (f), jac (0) { } |
532
|
61 |
1528
|
62 DAEFunc (DAERHSFunc f, DAEJacFunc j) |
1868
|
63 : fun (f), jac (j) { } |
3
|
64 |
1528
|
65 DAEFunc (const DAEFunc& a) |
1868
|
66 : fun (a.fun), jac (a.jac) { } |
3
|
67 |
1528
|
68 DAEFunc& operator = (const DAEFunc& a) |
|
69 { |
1868
|
70 if (this != &a) |
|
71 { |
|
72 fun = a.fun; |
|
73 jac = a.jac; |
|
74 } |
1528
|
75 return *this; |
|
76 } |
3
|
77 |
1868
|
78 ~DAEFunc (void) { } |
|
79 |
1528
|
80 DAERHSFunc function (void) const { return fun; } |
|
81 |
|
82 DAEFunc& set_function (DAERHSFunc f) |
|
83 { |
|
84 fun = f; |
|
85 return *this; |
|
86 } |
3
|
87 |
1528
|
88 DAEJacFunc jacobian_function (void) const { return jac; } |
3
|
89 |
1528
|
90 DAEFunc& set_jacobian_function (DAEJacFunc j) |
|
91 { |
|
92 jac = j; |
|
93 return *this; |
|
94 } |
3
|
95 |
|
96 protected: |
|
97 |
|
98 DAERHSFunc fun; |
|
99 DAEJacFunc jac; |
|
100 }; |
|
101 |
|
102 #endif |
382
|
103 |
|
104 /* |
|
105 ;;; Local Variables: *** |
|
106 ;;; mode: C++ *** |
|
107 ;;; page-delimiter: "^/\\*" *** |
|
108 ;;; End: *** |
|
109 */ |