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 #ifdef __GNUG__ |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #include <iostream.h> |
|
32 #include "ODE.h" |
|
33 #include "DAEFunc.h" |
|
34 #include "Matrix.h" |
|
35 #include "f77-uscore.h" |
|
36 |
|
37 #ifndef Vector |
|
38 #define Vector ColumnVector |
|
39 #endif |
|
40 |
|
41 class DAE : public ODE, public DAEFunc |
|
42 { |
|
43 public: |
|
44 |
|
45 DAE (void); |
|
46 |
|
47 DAE (int); |
|
48 |
|
49 DAE (Vector& x, double time, DAEFunc& f); |
|
50 |
|
51 DAE (Vector& x, Vector& xdot, double time, DAEFunc& f); |
|
52 |
|
53 ~DAE (void); |
|
54 |
|
55 Vector deriv (void); |
|
56 |
|
57 virtual void initialize (Vector& x, double t); |
|
58 virtual void initialize (Vector& x, Vector& xdot, double t); |
|
59 |
|
60 Vector integrate (double t); |
|
61 |
|
62 Matrix integrate (const Vector& tout, Matrix& xdot_out); |
|
63 Matrix integrate (const Vector& tout, Matrix& xdot_out, |
|
64 const Vector& tcrit); |
|
65 |
|
66 protected: |
|
67 |
|
68 /* |
|
69 * Some of this is probably too closely related to DASSL, but hey, |
|
70 * this is just a first attempt... |
|
71 */ |
|
72 |
|
73 Vector xdot; |
|
74 |
|
75 private: |
|
76 |
|
77 int restart; |
|
78 int liw; |
|
79 int lrw; |
|
80 int idid; |
|
81 int *info; |
|
82 int *iwork; |
|
83 double *rwork; |
|
84 |
|
85 friend int ddassl_j (double *time, double *state, double *deriv, |
|
86 double *pd, double *cj, double *rpar, int *ipar); |
|
87 |
|
88 friend int ddassl_f (double *time, double *state, double *deriv, |
|
89 double *delta, int *ires, double *rpar, int *ipar); |
|
90 |
|
91 }; |
|
92 |
|
93 #endif |