GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
base-de.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-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_base_de_h)
27#define octave_base_de_h 1
28
29#include "octave-config.h"
30
31#include <string>
32
33#include "dColVector.h"
34
36{
37public:
38
40 : m_x (), m_t (0.0), m_stop_time (0.0), m_stop_time_set (false),
41 m_restart (true), m_integration_error (false), m_istate (0) { }
42
43 base_diff_eqn (const ColumnVector& xx, double tt)
44 : m_x (xx), m_t (tt), m_stop_time (0.0), m_stop_time_set (false),
45 m_restart (true), m_integration_error (false), m_istate (0) { }
46
48 : m_x (a.m_x), m_t (a.m_t), m_stop_time (0.0), m_stop_time_set (false),
49 m_restart (true), m_integration_error (false), m_istate (0) { }
50
51 virtual ~base_diff_eqn () = default;
52
54 {
55 if (this != &a)
56 {
57 m_x = a.m_x;
58 m_t = a.m_t;
64 }
65
66 return *this;
67 }
68
69 void initialize (const ColumnVector& x0, double t0)
70 {
71 m_x = x0;
72 m_t = t0;
73 m_integration_error = false;
74 m_istate = 0;
76 }
77
78 octave_idx_type size () const { return m_x.numel (); }
79
80 ColumnVector state () const { return m_x; }
81
82 double time () const { return m_t; }
83
84 void set_stop_time (double tt)
85 {
86 m_stop_time_set = true;
87 m_stop_time = tt;
89 }
90
92 {
93 m_stop_time_set = false;
95 }
96
97 virtual void force_restart () { m_restart = true; }
98
99 bool integration_ok () const { return ! m_integration_error; }
100
102
103 virtual std::string error_message () const = 0;
104
105protected:
106
108
109 double m_t;
110
112
114
116
118
120};
121
122#endif
octave_idx_type numel() const
Number of elements in the array.
Definition Array.h:418
base_diff_eqn(const base_diff_eqn &a)
Definition base-de.h:47
virtual std::string error_message() const =0
octave_idx_type integration_state() const
Definition base-de.h:101
ColumnVector state() const
Definition base-de.h:80
double time() const
Definition base-de.h:82
virtual ~base_diff_eqn()=default
double m_stop_time
Definition base-de.h:111
bool integration_ok() const
Definition base-de.h:99
void initialize(const ColumnVector &x0, double t0)
Definition base-de.h:69
bool m_restart
Definition base-de.h:115
double m_t
Definition base-de.h:109
octave_idx_type m_istate
Definition base-de.h:119
virtual void force_restart()
Definition base-de.h:97
void clear_stop_time()
Definition base-de.h:91
bool m_stop_time_set
Definition base-de.h:113
octave_idx_type size() const
Definition base-de.h:78
bool m_integration_error
Definition base-de.h:117
ColumnVector m_x
Definition base-de.h:107
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition base-de.h:53
void set_stop_time(double tt)
Definition base-de.h:84
base_diff_eqn(const ColumnVector &xx, double tt)
Definition base-de.h:43