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
DAEFunc.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-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_DAEFunc_h)
24 #define octave_DAEFunc_h 1
25 
26 #include "octave-config.h"
27 
28 class Matrix;
29 class ColumnVector;
30 
31 class
32 DAEFunc
33 {
34 public:
35 
36  typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x,
37  const ColumnVector& xdot,
38  double t, octave_idx_type& ires);
39 
40  // This is really the form used by DASSL:
41  //
42  // PD = DG/DY + CJ * DG/DYPRIME
43 
44  typedef Matrix (*DAEJacFunc) (const ColumnVector& x,
45  const ColumnVector& xdot,
46  double t, double cj);
47 
48  DAEFunc (void)
49  : fun (0), jac (0), reset (true) { }
50 
51  DAEFunc (DAERHSFunc f)
52  : fun (f), jac (0), reset (true) { }
53 
54  DAEFunc (DAERHSFunc f, DAEJacFunc j)
55  : fun (f), jac (j), reset (true) { }
56 
57  DAEFunc (const DAEFunc& a)
58  : fun (a.fun), jac (a.jac), reset (a.reset) { }
59 
61  {
62  if (this != &a)
63  {
64  fun = a.fun;
65  jac = a.jac;
66  reset = a.reset;
67  }
68  return *this;
69  }
70 
71  virtual ~DAEFunc (void) { }
72 
73  DAERHSFunc function (void) const { return fun; }
74 
75  DAEFunc& set_function (DAERHSFunc f)
76  {
77  fun = f;
78  reset = true;
79  return *this;
80  }
81 
82  DAEJacFunc jacobian_function (void) const { return jac; }
83 
85  {
86  jac = j;
87  reset = true;
88  return *this;
89  }
90 
91 protected:
92 
93  DAERHSFunc fun;
94  DAEJacFunc jac;
95 
96  // This variable is TRUE when this object is constructed, and also
97  // after any internal data has changed. Derived classes may use
98  // this information (and change it) to know when to (re)initialize
99  // their own internal data related to this object.
100 
101  bool reset;
102 };
103 
104 #endif
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
DAEJacFunc jacobian_function(void) const
Definition: DAEFunc.h:82
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
DAERHSFunc fun
Definition: DAEFunc.h:93
DAEFunc & set_function(DAERHSFunc f)
Definition: DAEFunc.h:75
bool reset
Definition: DAEFunc.h:101
ColumnVector & operator=(const ColumnVector &a)
Definition: dColVector.h:55
DAEFunc(DAERHSFunc f, DAEJacFunc j)
Definition: DAEFunc.h:54
DAEJacFunc jac
Definition: DAEFunc.h:94
Definition: dMatrix.h:37
virtual ~DAEFunc(void)
Definition: DAEFunc.h:71
DAEFunc(void)
Definition: DAEFunc.h:48
ColumnVector(void)
Definition: dColVector.h:39
DAEFunc(const DAEFunc &a)
Definition: DAEFunc.h:57
DAEFunc(DAERHSFunc f)
Definition: DAEFunc.h:51
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
DAEFunc & set_jacobian_function(DAEJacFunc j)
Definition: DAEFunc.h:84