GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ODEFunc.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-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_ODEFunc_h)
24 #define octave_ODEFunc_h 1
25 
26 #include "octave-config.h"
27 
28 class Matrix;
29 class ColumnVector;
30 
31 class
32 ODEFunc
33 {
34 public:
35 
36  typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double);
37  typedef Matrix (*ODEJacFunc) (const ColumnVector&, double);
38 
39  ODEFunc (void)
40  : fun (nullptr), jac (nullptr), reset (true) { }
41 
42  ODEFunc (ODERHSFunc f)
43  : fun (f), jac (nullptr), reset (true) { }
44 
45  ODEFunc (ODERHSFunc f, ODEJacFunc j)
46  : fun (f), jac (j), reset (true) { }
47 
48  ODEFunc (const ODEFunc& a)
49  : fun (a.fun), jac (a.jac), reset (true) { }
50 
52  {
53  if (this != &a)
54  {
55  fun = a.fun;
56  jac = a.jac;
57  reset = a.reset;
58  }
59  return *this;
60  }
61 
62  virtual ~ODEFunc (void) = default;
63 
64  ODERHSFunc function (void) const { return fun; }
65 
66  ODEFunc& set_function (ODERHSFunc f)
67  {
68  fun = f;
69  reset = true;
70  return *this;
71  }
72 
73  ODEJacFunc jacobian_function (void) const { return jac; }
74 
76  {
77  jac = j;
78  reset = true;
79  return *this;
80  }
81 
82 protected:
83 
84  ODERHSFunc fun;
85  ODEJacFunc jac;
86 
87  // This variable is TRUE when this object is constructed, and also
88  // after any internal data has changed. Derived classes may use
89  // this information (and change it) to know when to (re)initialize
90  // their own internal data related to this object.
91 
92  bool reset;
93 };
94 
95 #endif
ODEFunc(const ODEFunc &a)
Definition: ODEFunc.h:48
ODEJacFunc jacobian_function(void) const
Definition: ODEFunc.h:73
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
ODEFunc(void)
Definition: ODEFunc.h:39
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
ODEFunc & set_jacobian_function(ODEJacFunc j)
Definition: ODEFunc.h:75
ODERHSFunc fun
Definition: ODEFunc.h:84
ColumnVector & operator=(const ColumnVector &a)
Definition: dColVector.h:54
ODEFunc(ODERHSFunc f, ODEJacFunc j)
Definition: ODEFunc.h:45
Definition: dMatrix.h:36
ODEJacFunc jac
Definition: ODEFunc.h:85
ColumnVector(void)
Definition: dColVector.h:38
bool reset
Definition: ODEFunc.h:92
ODEFunc & set_function(ODERHSFunc f)
Definition: ODEFunc.h:66
ODEFunc(ODERHSFunc f)
Definition: ODEFunc.h:42