Mercurial > hg > octave-nkf
annotate liboctave/numeric/ODE.h @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
3 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 1993-2015 John W. Eaton |
3 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3 | 20 |
21 */ | |
22 | |
382 | 23 #if !defined (octave_ODE_h) |
24 #define octave_ODE_h 1 | |
25 | |
3 | 26 #include "ODEFunc.h" |
1842 | 27 #include "base-de.h" |
289 | 28 |
1861 | 29 class |
30 ODE : public base_diff_eqn, public ODEFunc | |
3 | 31 { |
32 public: | |
33 | |
1842 | 34 ODE (void) |
35 : base_diff_eqn (), ODEFunc () { } | |
3 | 36 |
4587 | 37 ODE (const ColumnVector& s, double tm, const ODEFunc& f) |
38 : base_diff_eqn (s, tm), ODEFunc (f) { } | |
3 | 39 |
1842 | 40 ODE (const ODE& a) |
41 : base_diff_eqn (a), ODEFunc (a) { } | |
3 | 42 |
1842 | 43 ODE& operator = (const ODE& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
44 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
45 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
46 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
47 base_diff_eqn::operator = (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
48 ODEFunc::operator = (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
49 } |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
51 } |
3 | 52 |
11504
81ff63e43f54
really make destuctors virtual in ODE/DAE base classes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
53 virtual ~ODE (void) { } |
3984 | 54 |
55 // Derived classes must provide functions to actually do the | |
56 // integration. | |
57 | |
58 // Return the vector of states at output time t. | |
59 virtual ColumnVector do_integrate (double tt) = 0; | |
60 | |
61 // Return a matrix of states at each output time specified by t. | |
62 // The rows of the result matrix should each correspond to a new | |
63 // output time. | |
64 virtual Matrix do_integrate (const ColumnVector& tt) = 0; | |
65 | |
66 virtual Matrix do_integrate (const ColumnVector& tt, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
67 const ColumnVector& ttcrit) = 0; |
3984 | 68 |
69 // Lots of ways to call the single function and optionally set and | |
70 // get additional information. | |
71 | |
72 // Integrate to t from current point. | |
73 virtual ColumnVector integrate (double tt) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 { return do_integrate (tt); } |
3984 | 75 |
76 // Set new x0, t0 and integrate to t. | |
77 virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 initialize (x0, t0); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 return do_integrate (tt); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 } |
3984 | 82 |
83 // Integrate from current point and return output at all points | |
84 // specified by t. | |
85 virtual Matrix integrate (const ColumnVector& tt) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 { return do_integrate (tt); } |
3984 | 87 |
88 // Set new x0, t0 and integrate to return output at all points | |
89 // specified by t. | |
90 virtual Matrix integrate (const ColumnVector& x0, double t0, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
91 const ColumnVector& tt) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
92 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 initialize (x0, t0); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
94 return do_integrate (tt); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
95 } |
3984 | 96 |
97 // Integrate from current point and return output at all points | |
98 // specified by t. | |
99 virtual Matrix integrate (const ColumnVector& tt, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
100 const ColumnVector& ttcrit) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
101 { return do_integrate (tt, ttcrit); } |
3984 | 102 |
103 // Set new x0, t0 and integrate to return output at all points | |
104 // specified by t. | |
105 virtual Matrix integrate (const ColumnVector& x0, double t0, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
106 const ColumnVector& tt, |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
107 const ColumnVector& ttcrit) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 initialize (x0, t0); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
110 return do_integrate (tt, ttcrit); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 } |
3 | 112 }; |
113 | |
114 #endif |