3
|
1 // ODE.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 (_ODE_h) |
|
25 #define _ODE_h 1 |
|
26 |
238
|
27 class ostream; |
3
|
28 |
238
|
29 #include "Matrix.h" |
3
|
30 #include "ODEFunc.h" |
|
31 |
|
32 class ODE : public ODEFunc |
|
33 { |
|
34 public: |
|
35 |
|
36 ODE (void); |
|
37 |
|
38 ODE (int n); |
|
39 |
|
40 ODE (const ColumnVector& state, double time, const ODEFunc& f); |
|
41 |
|
42 virtual ~ODE (void); |
|
43 |
|
44 virtual int size (void) const; |
|
45 virtual ColumnVector state (void) const; |
|
46 virtual double time (void) const; |
|
47 |
|
48 virtual void force_restart (void); |
|
49 virtual void initialize (const ColumnVector& x, double t); |
|
50 virtual void set_stop_time (double t); |
|
51 virtual void clear_stop_time (void); |
|
52 |
|
53 virtual ColumnVector integrate (double t); |
|
54 |
|
55 void integrate (int nsteps, double tstep, ostream& s); |
|
56 |
|
57 Matrix integrate (const ColumnVector& tout); |
|
58 Matrix integrate (const ColumnVector& tout, const ColumnVector& tcrit); |
|
59 |
|
60 protected: |
|
61 |
|
62 /* |
|
63 * Some of this is probably too closely related to LSODE, but hey, |
|
64 * this is just a first attempt... |
|
65 */ |
|
66 |
|
67 int n; |
|
68 double t; |
|
69 ColumnVector x; |
|
70 |
|
71 double absolute_tolerance; |
|
72 double relative_tolerance; |
|
73 |
|
74 double stop_time; |
|
75 int stop_time_set; |
|
76 |
|
77 private: |
|
78 |
258
|
79 int integration_error; |
3
|
80 int restart; |
|
81 int method_flag; |
|
82 int *iwork; |
|
83 double *rwork; |
|
84 int istate; |
|
85 int itol; |
|
86 int itask; |
|
87 int iopt; |
|
88 int liw; |
|
89 int lrw; |
|
90 |
|
91 friend int lsode_f (int *neq, double *t, double *y, double *ydot); |
|
92 |
|
93 friend int lsode_j (int *neq, double *t, double *y, int *ml, int *mu, |
|
94 double *pd, int *nrowpd); |
|
95 |
|
96 }; |
|
97 |
|
98 #endif |
|
99 |
|
100 /* |
|
101 ;;; Local Variables: *** |
|
102 ;;; mode: C++ *** |
|
103 ;;; page-delimiter: "^/\\*" *** |
|
104 ;;; End: *** |
|
105 */ |