DAERTFunc.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2002-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_DAERTFunc_h)
00024 #define octave_DAERTFunc_h 1
00025 
00026 #include "dMatrix.h"
00027 
00028 class
00029 DAERTFunc : public DAEFunc
00030 {
00031 public:
00032 
00033   typedef ColumnVector (*DAERTConstrFunc) (const ColumnVector& x, double t);
00034 
00035   DAERTFunc (void)
00036     : DAEFunc (), constr (0), reset (true) { }
00037 
00038   DAERTFunc (DAERHSFunc f)
00039     : DAEFunc (f), constr (0), reset (true) { }
00040 
00041   DAERTFunc (DAERHSFunc f, DAEJacFunc j)
00042     : DAEFunc (f, j), constr (0), reset (true) { }
00043 
00044   DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf)
00045     : DAEFunc (f), constr (cf), reset (true) { }
00046 
00047   DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf, DAEJacFunc j)
00048     : DAEFunc (f, j), constr (cf), reset (true) { }
00049 
00050   DAERTFunc (const DAERTFunc& a)
00051     : DAEFunc (a), constr (a.constr), reset (a.reset) { }
00052 
00053   DAERTFunc& operator = (const DAERTFunc& a)
00054     {
00055       if (this != &a)
00056         {
00057           DAEFunc::operator = (a);
00058           constr = a.constr;
00059           reset = a.reset;
00060         }
00061       return *this;
00062     }
00063 
00064   virtual ~DAERTFunc (void) { }
00065 
00066   DAERTConstrFunc constraint_function (void) const { return constr; }
00067 
00068   DAERTFunc& set_constraint_function (DAERTConstrFunc cf)
00069     {
00070       constr = cf;
00071       reset = true;
00072       return *this;
00073     }
00074 
00075 protected:
00076 
00077   DAERTConstrFunc constr;
00078 
00079   // This variable is TRUE when this object is constructed, and also
00080   // after any internal data has changed.  Derived classes may use
00081   // this information (and change it) to know when to (re)initialize
00082   // their own internal data related to this object.
00083 
00084   bool reset;
00085 };
00086 
00087 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines