GNU Octave  4.0.0
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-2015 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 class Matrix;
27 class ColumnVector;
28 
29 class
30 DAEFunc
31 {
32 public:
33 
34  typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x,
35  const ColumnVector& xdot,
36  double t, octave_idx_type& ires);
37 
38  // This is really the form used by DASSL:
39  //
40  // PD = DG/DY + CJ * DG/DYPRIME
41 
42  typedef Matrix (*DAEJacFunc) (const ColumnVector& x,
43  const ColumnVector& xdot,
44  double t, double cj);
45 
46  DAEFunc (void)
47  : fun (0), jac (0), reset (true) { }
48 
49  DAEFunc (DAERHSFunc f)
50  : fun (f), jac (0), reset (true) { }
51 
52  DAEFunc (DAERHSFunc f, DAEJacFunc j)
53  : fun (f), jac (j), reset (true) { }
54 
55  DAEFunc (const DAEFunc& a)
56  : fun (a.fun), jac (a.jac), reset (a.reset) { }
57 
59  {
60  if (this != &a)
61  {
62  fun = a.fun;
63  jac = a.jac;
64  reset = a.reset;
65  }
66  return *this;
67  }
68 
69  virtual ~DAEFunc (void) { }
70 
71  DAERHSFunc function (void) const { return fun; }
72 
73  DAEFunc& set_function (DAERHSFunc f)
74  {
75  fun = f;
76  reset = true;
77  return *this;
78  }
79 
80  DAEJacFunc jacobian_function (void) const { return jac; }
81 
83  {
84  jac = j;
85  reset = true;
86  return *this;
87  }
88 
89 protected:
90 
91  DAERHSFunc fun;
92  DAEJacFunc jac;
93 
94  // This variable is TRUE when this object is constructed, and also
95  // after any internal data has changed. Derived classes may use
96  // this information (and change it) to know when to (re)initialize
97  // their own internal data related to this object.
98 
99  bool reset;
100 };
101 
102 #endif
DAEJacFunc jacobian_function(void) const
Definition: DAEFunc.h:80
DAERHSFunc fun
Definition: DAEFunc.h:91
DAEFunc & set_function(DAERHSFunc f)
Definition: DAEFunc.h:73
bool reset
Definition: DAEFunc.h:99
ColumnVector & operator=(const ColumnVector &a)
Definition: dColVector.h:53
F77_RET_T const double const double * f
DAEFunc(DAERHSFunc f, DAEJacFunc j)
Definition: DAEFunc.h:52
DAEJacFunc jac
Definition: DAEFunc.h:92
Definition: dMatrix.h:35
virtual ~DAEFunc(void)
Definition: DAEFunc.h:69
DAEFunc(void)
Definition: DAEFunc.h:46
ColumnVector(void)
Definition: dColVector.h:37
DAEFunc(const DAEFunc &a)
Definition: DAEFunc.h:55
DAEFunc(DAERHSFunc f)
Definition: DAEFunc.h:49
F77_RET_T const double * x
DAEFunc & set_jacobian_function(DAEJacFunc j)
Definition: DAEFunc.h:82