GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
base-dae.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2002-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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) { }
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
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
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:68
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:398
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:52
T::size_type numel(const T &str)
Definition: oct-string.cc:61
virtual ~base_diff_alg_eqn(void)
Definition: base-dae.h:48
base_diff_alg_eqn(void)
Definition: base-dae.h:35