3
|
1 // DAE.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993 John W. Eaton |
|
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 |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (_DAE_h) |
|
25 #define _DAE_h 1 |
|
26 |
|
27 #include "ODE.h" |
|
28 #include "DAEFunc.h" |
|
29 #include "Matrix.h" |
|
30 |
|
31 #ifndef Vector |
|
32 #define Vector ColumnVector |
|
33 #endif |
|
34 |
|
35 class DAE : public ODE, public DAEFunc |
|
36 { |
|
37 public: |
|
38 |
|
39 DAE (void); |
|
40 |
|
41 DAE (int); |
|
42 |
|
43 DAE (Vector& x, double time, DAEFunc& f); |
|
44 |
|
45 DAE (Vector& x, Vector& xdot, double time, DAEFunc& f); |
|
46 |
|
47 ~DAE (void); |
|
48 |
|
49 Vector deriv (void); |
|
50 |
|
51 virtual void initialize (Vector& x, double t); |
|
52 virtual void initialize (Vector& x, Vector& xdot, double t); |
|
53 |
|
54 Vector integrate (double t); |
|
55 |
|
56 Matrix integrate (const Vector& tout, Matrix& xdot_out); |
|
57 Matrix integrate (const Vector& tout, Matrix& xdot_out, |
|
58 const Vector& tcrit); |
|
59 |
|
60 protected: |
|
61 |
|
62 /* |
|
63 * Some of this is probably too closely related to DASSL, but hey, |
|
64 * this is just a first attempt... |
|
65 */ |
|
66 |
|
67 Vector xdot; |
|
68 |
|
69 private: |
|
70 |
257
|
71 int integration_error; |
3
|
72 int restart; |
|
73 int liw; |
|
74 int lrw; |
|
75 int idid; |
|
76 int *info; |
|
77 int *iwork; |
|
78 double *rwork; |
|
79 |
|
80 friend int ddassl_j (double *time, double *state, double *deriv, |
|
81 double *pd, double *cj, double *rpar, int *ipar); |
|
82 |
|
83 friend int ddassl_f (double *time, double *state, double *deriv, |
|
84 double *delta, int *ires, double *rpar, int *ipar); |
|
85 |
|
86 }; |
|
87 |
|
88 #endif |