GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
base-dae.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2002-2023 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_dae_h)
27 #define octave_base_dae_h 1
28 
29 #include "octave-config.h"
30 
31 #include "base-de.h"
32 
33 class
35 {
36 public:
37 
39  : base_diff_eqn (), m_xdot () { }
40 
41  base_diff_alg_eqn (const ColumnVector& xx, double tt)
42  : base_diff_eqn (xx, tt), m_xdot (xx.numel (), 0.0) { }
43 
44  base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot,
45  double tt)
46  : base_diff_eqn (xx, tt), m_xdot (xxdot) { }
47 
49  : base_diff_eqn (a), m_xdot (a.m_xdot) { }
50 
51  virtual ~base_diff_alg_eqn (void) = default;
52 
53  base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a)
54  {
55  if (this != &a)
56  {
58  m_xdot = a.m_xdot;
59  }
60  return *this;
61  }
62 
63  void initialize (const ColumnVector& x0, double t0)
64  {
66  m_xdot = ColumnVector (x0.numel (), 0.0);
67  }
68 
69  void initialize (const ColumnVector& x0, const ColumnVector& xdot0,
70  double t0)
71  {
73  m_xdot = xdot0;
74  }
75 
76  ColumnVector state_derivative (void) { return m_xdot; }
77 
78 protected:
79 
81 };
82 
83 #endif
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:414
void initialize(const ColumnVector &x0, double t0)
Definition: base-dae.h:63
ColumnVector m_xdot
Definition: base-dae.h:80
void initialize(const ColumnVector &x0, const ColumnVector &xdot0, double t0)
Definition: base-dae.h:69
base_diff_alg_eqn(const ColumnVector &xx, double tt)
Definition: base-dae.h:41
base_diff_alg_eqn(const base_diff_alg_eqn &a)
Definition: base-dae.h:48
base_diff_alg_eqn(const ColumnVector &xx, const ColumnVector &xxdot, double tt)
Definition: base-dae.h:44
virtual ~base_diff_alg_eqn(void)=default
base_diff_alg_eqn(void)
Definition: base-dae.h:38
ColumnVector state_derivative(void)
Definition: base-dae.h:76
void initialize(const ColumnVector &x0, double t0)
Definition: base-de.h:70
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition: base-de.h:54
class OCTAVE_API ColumnVector
Definition: mx-fwd.h:45
T::size_type numel(const T &str)
Definition: oct-string.cc:71