GNU Octave  4.4.1
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-2018 John W. Eaton
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_base_dae_h)
24 #define octave_base_dae_h 1
25 
26 #include "octave-config.h"
27 
28 #include "base-de.h"
29 
30 class
32 {
33 public:
34 
36  : base_diff_eqn (), xdot () { }
37 
38  base_diff_alg_eqn (const ColumnVector& xx, double tt)
39  : base_diff_eqn (xx, tt), xdot (xx.numel (), 0.0) { }
40 
41  base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot,
42  double tt)
43  : base_diff_eqn (xx, tt), xdot (xxdot) { }
44 
46  : base_diff_eqn (a), xdot (a.xdot) { }
47 
48  virtual ~base_diff_alg_eqn (void) = default;
49 
50  base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a)
51  {
52  if (this != &a)
53  {
55  xdot = a.xdot;
56  }
57  return *this;
58  }
59 
60  void initialize (const ColumnVector& x0, double t0)
61  {
63  xdot = ColumnVector (x0.numel (), 0.0);
64  }
65 
66  void initialize (const ColumnVector& x0, const ColumnVector& xdot0,
67  double t0)
68  {
70  xdot = xdot0;
71  }
72 
73  ColumnVector state_derivative (void) { return xdot; }
74 
75 protected:
76 
78 };
79 
80 #endif
void initialize(const ColumnVector &x0, const ColumnVector &xdot0, double t0)
Definition: base-dae.h:66
base_diff_alg_eqn(const base_diff_alg_eqn &a)
Definition: base-dae.h:45
ColumnVector xdot
Definition: base-dae.h:77
void initialize(const ColumnVector &x0, double t0)
Definition: base-dae.h:60
ColumnVector state_derivative(void)
Definition: base-dae.h:73
void initialize(const ColumnVector &x0, double t0)
Definition: base-de.h:67
base_diff_alg_eqn(const ColumnVector &xx, double tt)
Definition: base-dae.h:38
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
base_diff_alg_eqn(const ColumnVector &xx, const ColumnVector &xxdot, double tt)
Definition: base-dae.h:41
base_diff_eqn & operator=(const base_diff_eqn &a)
Definition: base-de.h:51
T::size_type numel(const T &str)
Definition: oct-string.cc:61
base_diff_alg_eqn(void)
Definition: base-dae.h:35
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:366