annotate liboctave/DAEFunc.h @ 12312:b10ea6efdc58 release-3-4-x ss-3-3-91

version is now 3.3.91
author John W. Eaton <jwe@octave.org>
date Mon, 31 Jan 2011 08:36:58 -0500
parents fd0a3ac60b0e
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
1 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11504
diff changeset
3 Copyright (C) 1993-2011 John W. Eaton
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
4
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
6
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
10 option) any later version.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
11
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
15 for more details.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
16
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
19 <http://www.gnu.org/licenses/>.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
20
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
21 */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
22
382
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
23 #if !defined (octave_DAEFunc_h)
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
24 #define octave_DAEFunc_h 1
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 238
diff changeset
25
465
4caf8fbeb778 [project @ 1994-06-06 01:05:09 by jwe]
jwe
parents: 384
diff changeset
26 class Matrix;
4caf8fbeb778 [project @ 1994-06-06 01:05:09 by jwe]
jwe
parents: 384
diff changeset
27 class ColumnVector;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
28
1868
6822f1ccec47 [project @ 1996-02-04 11:31:58 by jwe]
jwe
parents: 1528
diff changeset
29 class
6822f1ccec47 [project @ 1996-02-04 11:31:58 by jwe]
jwe
parents: 1528
diff changeset
30 DAEFunc
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
31 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
32 public:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
33
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
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
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
37
3991
48d2bc4a3729 [project @ 2002-07-16 17:46:50 by jwe]
jwe
parents: 3990
diff changeset
38 // This is really the form used by DASSL:
48d2bc4a3729 [project @ 2002-07-16 17:46:50 by jwe]
jwe
parents: 3990
diff changeset
39 //
48d2bc4a3729 [project @ 2002-07-16 17:46:50 by jwe]
jwe
parents: 3990
diff changeset
40 // PD = DG/DY + CJ * DG/DYPRIME
48d2bc4a3729 [project @ 2002-07-16 17:46:50 by jwe]
jwe
parents: 3990
diff changeset
41
48d2bc4a3729 [project @ 2002-07-16 17:46:50 by jwe]
jwe
parents: 3990
diff changeset
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
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
45
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
46 DAEFunc (void)
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
47 : fun (0), jac (0), reset (true) { }
532
2ca256b77602 [project @ 1994-07-20 19:56:55 by jwe]
jwe
parents: 465
diff changeset
48
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
49 DAEFunc (DAERHSFunc f)
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
50 : fun (f), jac (0), reset (true) { }
532
2ca256b77602 [project @ 1994-07-20 19:56:55 by jwe]
jwe
parents: 465
diff changeset
51
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
52 DAEFunc (DAERHSFunc f, DAEJacFunc j)
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
53 : fun (f), jac (j), reset (true) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
54
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
55 DAEFunc (const DAEFunc& a)
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
56 : fun (a.fun), jac (a.jac), reset (a.reset) { }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
57
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
58 DAEFunc& operator = (const DAEFunc& a)
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
59 {
1868
6822f1ccec47 [project @ 1996-02-04 11:31:58 by jwe]
jwe
parents: 1528
diff changeset
60 if (this != &a)
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
61 {
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
62 fun = a.fun;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
63 jac = a.jac;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
64 reset = a.reset;
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
65 }
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
66 return *this;
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
67 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
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
6822f1ccec47 [project @ 1996-02-04 11:31:58 by jwe]
jwe
parents: 1528
diff changeset
70
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
71 DAERHSFunc function (void) const { return fun; }
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
72
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
73 DAEFunc& set_function (DAERHSFunc f)
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
74 {
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
75 fun = f;
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
76 reset = true;
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
77 return *this;
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
78 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
79
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
80 DAEJacFunc jacobian_function (void) const { return jac; }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
81
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
82 DAEFunc& set_jacobian_function (DAEJacFunc j)
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
83 {
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
84 jac = j;
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
85 reset = true;
1528
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
86 return *this;
dc527156c38c [project @ 1995-10-05 01:44:18 by jwe]
jwe
parents: 1315
diff changeset
87 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
88
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
89 protected:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
90
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
91 DAERHSFunc fun;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
92 DAEJacFunc jac;
4049
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
93
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
94 // This variable is TRUE when this object is constructed, and also
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
95 // after any internal data has changed. Derived classes may use
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
96 // this information (and change it) to know when to (re)initialize
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
97 // their own internal data related to this object.
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
98
a35a3c5d4740 [project @ 2002-08-16 08:54:31 by jwe]
jwe
parents: 3991
diff changeset
99 bool reset;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
100 };
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
101
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
102 #endif