1841
|
1 // LSODE.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1996 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_LSODE_h) |
|
25 #define octave_LSODE_h 1 |
|
26 |
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #if 0 |
|
32 class ostream; |
|
33 #endif |
|
34 |
|
35 #include "ODE.h" |
|
36 |
|
37 class LSODE_options |
|
38 { |
|
39 public: |
|
40 |
|
41 LSODE_options (void); |
|
42 LSODE_options (const LSODE_options& opt); |
|
43 |
|
44 LSODE_options& operator = (const LSODE_options& opt); |
|
45 |
|
46 ~LSODE_options (void); |
|
47 |
|
48 void init (void); |
|
49 void copy (const LSODE_options& opt); |
|
50 |
|
51 void set_default_options (void); |
|
52 |
|
53 void set_absolute_tolerance (double); |
|
54 void set_initial_step_size (double); |
|
55 void set_maximum_step_size (double); |
|
56 void set_minimum_step_size (double); |
|
57 void set_relative_tolerance (double); |
|
58 |
|
59 double absolute_tolerance (void); |
|
60 double initial_step_size (void); |
|
61 double maximum_step_size (void); |
|
62 double minimum_step_size (void); |
|
63 double relative_tolerance (void); |
|
64 |
|
65 private: |
|
66 |
|
67 double x_absolute_tolerance; |
|
68 double x_initial_step_size; |
|
69 double x_maximum_step_size; |
|
70 double x_minimum_step_size; |
|
71 double x_relative_tolerance; |
|
72 }; |
|
73 |
|
74 class LSODE : public ODE, public LSODE_options |
|
75 { |
|
76 public: |
|
77 |
|
78 LSODE (void); |
|
79 |
|
80 LSODE (int n); |
|
81 |
|
82 LSODE (const ColumnVector& state, double time, const ODEFunc& f); |
|
83 |
|
84 ~LSODE (void); |
|
85 |
|
86 void force_restart (void); |
|
87 |
|
88 void set_stop_time (double t); |
|
89 void clear_stop_time (void); |
|
90 |
|
91 ColumnVector do_integrate (double t); |
|
92 |
|
93 Matrix do_integrate (const ColumnVector& tout); |
|
94 |
|
95 #if 0 |
|
96 void integrate (int nsteps, double tstep, ostream& s); |
|
97 #endif |
|
98 |
|
99 Matrix integrate (const ColumnVector& tout) |
|
100 { return do_integrate (tout); } |
|
101 |
|
102 Matrix integrate (const ColumnVector& tout, const ColumnVector& tcrit); |
|
103 |
|
104 private: |
|
105 |
|
106 double stop_time; |
|
107 int stop_time_set; |
|
108 |
|
109 int n; |
|
110 int integration_error; |
|
111 int restart; |
|
112 int method_flag; |
|
113 int *iwork; |
|
114 double *rwork; |
|
115 int istate; |
|
116 int itol; |
|
117 int itask; |
|
118 int iopt; |
|
119 int liw; |
|
120 int lrw; |
|
121 |
|
122 friend int lsode_f (int *neq, double *t, double *y, double *ydot); |
|
123 |
|
124 friend int lsode_j (int *neq, double *t, double *y, int *ml, int *mu, |
|
125 double *pd, int *nrowpd); |
|
126 }; |
|
127 |
|
128 #endif |
|
129 |
|
130 /* |
|
131 ;;; Local Variables: *** |
|
132 ;;; mode: C++ *** |
|
133 ;;; page-delimiter: "^/\\*" *** |
|
134 ;;; End: *** |
|
135 */ |