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