Mercurial > hg > octave-lyh
annotate liboctave/ODESFunc.h @ 11504:81ff63e43f54
really make destuctors virtual in ODE/DAE base classes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 03:28:21 -0500 |
parents | cbc402e64d83 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
3984 | 1 /* |
2 | |
7017 | 3 Copyright (C) 2002, 2005, 2007 John W. Eaton |
3984 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3984 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3984 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_ODESFunc_h) | |
24 #define octave_ODESFunc_h 1 | |
25 | |
26 #include "dMatrix.h" | |
27 | |
28 class | |
29 ODESFunc | |
30 { | |
31 public: | |
32 | |
33 struct DAEJac | |
34 { | |
35 Matrix *dfdxdot; | |
36 Matrix *dfdx; | |
37 }; | |
38 | |
4141 | 39 typedef ColumnVector (*ODES_fsub) (const ColumnVector& x, double, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
40 const ColumnVector& theta); |
3984 | 41 |
4141 | 42 typedef ColumnVector (*ODES_bsub) (const ColumnVector& x, double, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
43 const ColumnVector& theta, int column); |
3984 | 44 |
4141 | 45 typedef Matrix (*ODES_jsub) (const ColumnVector& x, double, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
46 const ColumnVector& theta); |
3984 | 47 |
48 ODESFunc (void) | |
49 : fsub (0), bsub (0), jsub (0) { } | |
50 | |
51 ODESFunc (ODES_fsub f) | |
52 : fsub (f), bsub (0), jsub (0) { } | |
53 | |
54 ODESFunc (ODES_fsub f, ODES_bsub b) | |
55 : fsub (f), bsub (b), jsub (0) { } | |
56 | |
57 ODESFunc (ODES_fsub f, ODES_bsub b, ODES_jsub j) | |
58 : fsub (f), bsub (b), jsub (j) { } | |
59 | |
60 ODESFunc (const ODESFunc& a) | |
61 : fsub (a.fsub), bsub (a.bsub), jsub (a.jsub) { } | |
62 | |
63 ODESFunc& operator = (const ODESFunc& a) | |
64 { | |
65 if (this != &a) | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
66 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
67 fsub = a.fsub; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
68 bsub = a.bsub; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
69 jsub = a.jsub; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
70 } |
3984 | 71 return *this; |
72 } | |
73 | |
11504
81ff63e43f54
really make destuctors virtual in ODE/DAE base classes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
74 virtual ~ODESFunc (void) { } |
3984 | 75 |
76 ODES_fsub fsub_function (void) const { return fsub; } | |
77 | |
78 ODESFunc& set_fsub_function (ODES_fsub f) | |
79 { | |
80 fsub = f; | |
81 return *this; | |
82 } | |
83 | |
84 ODES_bsub bsub_function (void) const { return bsub; } | |
85 | |
86 ODESFunc& set_bsub_function (ODES_bsub b) | |
87 { | |
88 bsub = b; | |
89 return *this; | |
90 } | |
91 | |
92 ODES_jsub jsub_function (void) const { return jsub; } | |
93 | |
94 ODESFunc& set_jsub_function (ODES_jsub j) | |
95 { | |
96 jsub = j; | |
97 return *this; | |
98 } | |
99 | |
100 protected: | |
101 | |
102 ODES_fsub fsub; | |
103 ODES_bsub bsub; | |
104 ODES_jsub jsub; | |
105 }; | |
106 | |
107 #endif |