GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ODE.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2025 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 ODE : public base_diff_eqn, public ODEFunc
36{
37public:
38
39 ODE ()
40 : base_diff_eqn (), ODEFunc () { }
41
42 ODE (const ColumnVector& s, double tm, const ODEFunc& f)
43 : base_diff_eqn (s, tm), ODEFunc (f) { }
44
45 ODE (const ODE& a)
46 : base_diff_eqn (a), ODEFunc (a) { }
47
48 ODE& operator = (const ODE& a)
49 {
50 if (this != &a)
51 {
54 }
55 return *this;
56 }
57
58 virtual ~ODE () = default;
59
60 // Derived classes must provide functions to actually do the
61 // integration.
62
63 // Return the vector of states at output time t.
64 virtual ColumnVector do_integrate (double tt) = 0;
65
66 // Return a matrix of states at each output time specified by t.
67 // The rows of the result matrix should each correspond to a new
68 // output time.
69 virtual Matrix do_integrate (const ColumnVector& tt) = 0;
70
71 virtual Matrix do_integrate (const ColumnVector& tt,
72 const ColumnVector& ttcrit) = 0;
73
74 // Lots of ways to call the single function and optionally set and
75 // get additional information.
76
77 // Integrate to t from current point.
78 virtual ColumnVector integrate (double tt)
79 { return do_integrate (tt); }
80
81 // Set new x0, t0 and integrate to t.
82 virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt)
83 {
84 initialize (x0, t0);
85 return do_integrate (tt);
86 }
87
88 // Integrate from current point and return output at all points
89 // specified by t.
90 virtual Matrix integrate (const ColumnVector& tt)
91 { return do_integrate (tt); }
92
93 // Set new x0, t0 and integrate to return output at all points
94 // specified by t.
95 virtual Matrix integrate (const ColumnVector& x0, double t0,
96 const ColumnVector& tt)
97 {
98 initialize (x0, t0);
99 return do_integrate (tt);
100 }
101
102 // Integrate from current point and return output at all points
103 // specified by t.
104 virtual Matrix integrate (const ColumnVector& tt,
105 const ColumnVector& ttcrit)
106 { return do_integrate (tt, ttcrit); }
107
108 // Set new x0, t0 and integrate to return output at all points
109 // specified by t.
110 virtual Matrix integrate (const ColumnVector& x0, double t0,
111 const ColumnVector& tt,
112 const ColumnVector& ttcrit)
113 {
114 initialize (x0, t0);
115 return do_integrate (tt, ttcrit);
116 }
117};
118
119#endif
ODEFunc & operator=(const ODEFunc &a)
Definition ODEFunc.h:52
Definition ODE.h:36
virtual Matrix do_integrate(const ColumnVector &tt, const ColumnVector &ttcrit)=0
ODE & operator=(const ODE &a)
Definition ODE.h:48
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt, const ColumnVector &ttcrit)
Definition ODE.h:110
virtual ColumnVector integrate(double tt)
Definition ODE.h:78
ODE()
Definition ODE.h:39
ODE(const ODE &a)
Definition ODE.h:45
virtual Matrix integrate(const ColumnVector &x0, double t0, const ColumnVector &tt)
Definition ODE.h:95
virtual Matrix integrate(const ColumnVector &tt)
Definition ODE.h:90
ODE(const ColumnVector &s, double tm, const ODEFunc &f)
Definition ODE.h:42
virtual ColumnVector do_integrate(double tt)=0
virtual ColumnVector integrate(const ColumnVector &x0, double t0, double tt)
Definition ODE.h:82
virtual Matrix integrate(const ColumnVector &tt, const ColumnVector &ttcrit)
Definition ODE.h:104
virtual ~ODE()=default
virtual Matrix do_integrate(const ColumnVector &tt)=0
void initialize(const ColumnVector &x0, double t0)
Definition base-de.h:69
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition base-de.h:53
F77_RET_T const F77_DBLE const F77_DBLE * f