Mercurial > hg > octave-nkf
annotate liboctave/numeric/DAEFunc.h @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
3 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 1993-2015 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3 | 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/>. | |
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 | |
1528 | 34 typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
35 const ColumnVector& xdot, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
36 double t, octave_idx_type& ires); |
1528 | 37 |
3991 | 38 // This is really the form used by DASSL: |
39 // | |
40 // PD = DG/DY + CJ * DG/DYPRIME | |
41 | |
42 typedef Matrix (*DAEJacFunc) (const ColumnVector& x, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
43 const ColumnVector& xdot, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
44 double t, double cj); |
1528 | 45 |
46 DAEFunc (void) | |
4049 | 47 : fun (0), jac (0), reset (true) { } |
532 | 48 |
1528 | 49 DAEFunc (DAERHSFunc f) |
4049 | 50 : fun (f), jac (0), reset (true) { } |
532 | 51 |
1528 | 52 DAEFunc (DAERHSFunc f, DAEJacFunc j) |
4049 | 53 : fun (f), jac (j), reset (true) { } |
3 | 54 |
1528 | 55 DAEFunc (const DAEFunc& a) |
4049 | 56 : fun (a.fun), jac (a.jac), reset (a.reset) { } |
3 | 57 |
1528 | 58 DAEFunc& operator = (const DAEFunc& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 fun = a.fun; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 jac = a.jac; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 reset = a.reset; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 } |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 } |
3 | 68 |
11504
81ff63e43f54
really make destuctors virtual in ODE/DAE base classes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
69 virtual ~DAEFunc (void) { } |
1868 | 70 |
1528 | 71 DAERHSFunc function (void) const { return fun; } |
72 | |
73 DAEFunc& set_function (DAERHSFunc f) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 fun = f; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 reset = true; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 } |
3 | 79 |
1528 | 80 DAEJacFunc jacobian_function (void) const { return jac; } |
3 | 81 |
1528 | 82 DAEFunc& set_jacobian_function (DAEJacFunc j) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 jac = j; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 reset = true; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 } |
3 | 88 |
89 protected: | |
90 | |
91 DAERHSFunc fun; | |
92 DAEJacFunc jac; | |
4049 | 93 |
94 // This variable is TRUE when this object is constructed, and also | |
95 // after any internal data has changed. Derived classes may use | |
96 // this information (and change it) to know when to (re)initialize | |
97 // their own internal data related to this object. | |
98 | |
99 bool reset; | |
3 | 100 }; |
101 | |
102 #endif |