Mercurial > hg > octave-nkf
annotate liboctave/ODEFunc.h @ 11521:00fe5069b70e
update bootstrap scripts from gnulib sources
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jan 2011 02:58:24 -0500 |
parents | 81ff63e43f54 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
3 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002, 2005, 2007 |
4 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3 | 21 |
22 */ | |
23 | |
382 | 24 #if !defined (octave_ODEFunc_h) |
25 #define octave_ODEFunc_h 1 | |
26 | |
465 | 27 class Matrix; |
28 class ColumnVector; | |
3 | 29 |
1861 | 30 class |
31 ODEFunc | |
3 | 32 { |
33 public: | |
34 | |
1536 | 35 typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double); |
36 typedef Matrix (*ODEJacFunc) (const ColumnVector&, double); | |
37 | |
38 ODEFunc (void) | |
4049 | 39 : fun (0), jac (0), reset (true) { } |
532 | 40 |
1536 | 41 ODEFunc (ODERHSFunc f) |
4049 | 42 : fun (f), jac (0), reset (true) { } |
3 | 43 |
1536 | 44 ODEFunc (ODERHSFunc f, ODEJacFunc j) |
4049 | 45 : fun (f), jac (j), reset (true) { } |
3 | 46 |
1536 | 47 ODEFunc (const ODEFunc& a) |
4049 | 48 : fun (a.fun), jac (a.jac), reset (true) { } |
3 | 49 |
1536 | 50 ODEFunc& operator = (const ODEFunc& a) |
51 { | |
1844 | 52 if (this != &a) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
53 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
54 fun = a.fun; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
55 jac = a.jac; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
56 reset = a.reset; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
57 } |
1536 | 58 return *this; |
59 } | |
3 | 60 |
11504
81ff63e43f54
really make destuctors virtual in ODE/DAE base classes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
61 virtual ~ODEFunc (void) { } |
1861 | 62 |
1536 | 63 ODERHSFunc function (void) const { return fun; } |
64 | |
65 ODEFunc& set_function (ODERHSFunc f) | |
66 { | |
67 fun = f; | |
4049 | 68 reset = true; |
1536 | 69 return *this; |
70 } | |
3 | 71 |
1536 | 72 ODEJacFunc jacobian_function (void) const { return jac; } |
3 | 73 |
1536 | 74 ODEFunc& set_jacobian_function (ODEJacFunc j) |
75 { | |
76 jac = j; | |
4049 | 77 reset = true; |
1536 | 78 return *this; |
79 } | |
3 | 80 |
81 protected: | |
82 | |
83 ODERHSFunc fun; | |
84 ODEJacFunc jac; | |
4049 | 85 |
86 // This variable is TRUE when this object is constructed, and also | |
87 // after any internal data has changed. Derived classes may use | |
88 // this information (and change it) to know when to (re)initialize | |
89 // their own internal data related to this object. | |
90 | |
91 bool reset; | |
382 | 92 }; |
3 | 93 |
94 #endif |