GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ODE.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_ODE_h)
27#define octave_ODE_h 1
28
29#include "octave-config.h"
30
31#include "ODEFunc.h"
32#include "base-de.h"
33#include "dMatrix.h"
34
35class
36ODE : public base_diff_eqn, public ODEFunc
37{
38public:
39
40 ODE (void)
41 : base_diff_eqn (), ODEFunc () { }
42
43 ODE (const ColumnVector& s, double tm, const ODEFunc& f)
44 : base_diff_eqn (s, tm), ODEFunc (f) { }
45
46 ODE (const ODE& a)
47 : base_diff_eqn (a), ODEFunc (a) { }
48
49 ODE& operator = (const ODE& a)
50 {
51 if (this != &a)
52 {
55 }
56 return *this;
57 }
58
59 virtual ~ODE (void) = default;
60
61 // Derived classes must provide functions to actually do the
62 // integration.
63
64 // Return the vector of states at output time t.
65 virtual ColumnVector do_integrate (double tt) = 0;
66
67 // Return a matrix of states at each output time specified by t.
68 // The rows of the result matrix should each correspond to a new
69 // output time.
70 virtual Matrix do_integrate (const ColumnVector& tt) = 0;
71
72 virtual Matrix do_integrate (const ColumnVector& tt,
73 const ColumnVector& ttcrit) = 0;
74
75 // Lots of ways to call the single function and optionally set and
76 // get additional information.
77
78 // Integrate to t from current point.
79 virtual ColumnVector integrate (double tt)
80 { return do_integrate (tt); }
81
82 // Set new x0, t0 and integrate to t.
83 virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt)
84 {
85 initialize (x0, t0);
86 return do_integrate (tt);
87 }
88
89 // Integrate from current point and return output at all points
90 // specified by t.
91 virtual Matrix integrate (const ColumnVector& tt)
92 { return do_integrate (tt); }
93
94 // Set new x0, t0 and integrate to return output at all points
95 // specified by t.
96 virtual Matrix integrate (const ColumnVector& x0, double t0,
97 const ColumnVector& tt)
98 {
99 initialize (x0, t0);
100 return do_integrate (tt);
101 }
102
103 // Integrate from current point and return output at all points
104 // specified by t.
105 virtual Matrix integrate (const ColumnVector& tt,
106 const ColumnVector& ttcrit)
107 { return do_integrate (tt, ttcrit); }
108
109 // Set new x0, t0 and integrate to return output at all points
110 // specified by t.
111 virtual Matrix integrate (const ColumnVector& x0, double t0,
112 const ColumnVector& tt,
113 const ColumnVector& ttcrit)
114 {
115 initialize (x0, t0);
116 return do_integrate (tt, ttcrit);
117 }
118};
119
120#endif
Definition: dMatrix.h:42
ODEFunc & operator=(const ODEFunc &a)
Definition: ODEFunc.h:53
Definition: ODE.h:37
virtual Matrix do_integrate(const ColumnVector &tt, const ColumnVector &ttcrit)=0
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt, const ColumnVector &ttcrit)
Definition: ODE.h:111
ODE(void)
Definition: ODE.h:40
virtual ColumnVector integrate(double tt)
Definition: ODE.h:79
ODE(const ODE &a)
Definition: ODE.h:46
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt)
Definition: ODE.h:96
virtual Matrix integrate(const ColumnVector &tt)
Definition: ODE.h:91
ODE(const ColumnVector &s, double tm, const ODEFunc &f)
Definition: ODE.h:43
virtual ColumnVector do_integrate(double tt)=0
virtual ColumnVector integrate(const ColumnVector &x0, double t0, double tt)
Definition: ODE.h:83
virtual Matrix integrate(const ColumnVector &tt, const ColumnVector &ttcrit)
Definition: ODE.h:105
virtual ~ODE(void)=default
virtual Matrix do_integrate(const ColumnVector &tt)=0
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition: base-de.h:54
F77_RET_T const F77_DBLE const F77_DBLE * f
static void initialize(void)