GNU Octave  3.8.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
DAERTFunc.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2002-2013 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_DAERTFunc_h)
24 #define octave_DAERTFunc_h 1
25 
26 #include "dMatrix.h"
27 
28 class
29 DAERTFunc : public DAEFunc
30 {
31 public:
32 
33  typedef ColumnVector (*DAERTConstrFunc) (const ColumnVector& x, double t);
34 
35  DAERTFunc (void)
36  : DAEFunc (), constr (0), reset (true) { }
37 
38  DAERTFunc (DAERHSFunc f)
39  : DAEFunc (f), constr (0), reset (true) { }
40 
41  DAERTFunc (DAERHSFunc f, DAEJacFunc j)
42  : DAEFunc (f, j), constr (0), reset (true) { }
43 
44  DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf)
45  : DAEFunc (f), constr (cf), reset (true) { }
46 
47  DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf, DAEJacFunc j)
48  : DAEFunc (f, j), constr (cf), reset (true) { }
49 
50  DAERTFunc (const DAERTFunc& a)
51  : DAEFunc (a), constr (a.constr), reset (a.reset) { }
52 
54  {
55  if (this != &a)
56  {
58  constr = a.constr;
59  reset = a.reset;
60  }
61  return *this;
62  }
63 
64  virtual ~DAERTFunc (void) { }
65 
66  DAERTConstrFunc constraint_function (void) const { return constr; }
67 
68  DAERTFunc& set_constraint_function (DAERTConstrFunc cf)
69  {
70  constr = cf;
71  reset = true;
72  return *this;
73  }
74 
75 protected:
76 
77  DAERTConstrFunc constr;
78 
79  // This variable is TRUE when this object is constructed, and also
80  // after any internal data has changed. Derived classes may use
81  // this information (and change it) to know when to (re)initialize
82  // their own internal data related to this object.
83 
84  bool reset;
85 };
86 
87 #endif