base-dae.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_base_dae_h)
00024 #define octave_base_dae_h 1
00025 
00026 #include "base-de.h"
00027 
00028 class
00029 base_diff_alg_eqn : public base_diff_eqn
00030 {
00031 public:
00032 
00033   base_diff_alg_eqn (void)
00034     : base_diff_eqn (), xdot () { }
00035 
00036   base_diff_alg_eqn (const ColumnVector& xx, double tt)
00037     : base_diff_eqn (xx, tt), xdot (xx.length (), 0.0) { }
00038 
00039   base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot,
00040                      double tt)
00041     : base_diff_eqn (xx, tt), xdot (xxdot) { }
00042 
00043   base_diff_alg_eqn (const base_diff_alg_eqn& a)
00044     : base_diff_eqn (a), xdot (a.xdot) { }
00045 
00046   virtual ~base_diff_alg_eqn (void) { }
00047 
00048   base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a)
00049     {
00050       if (this != &a)
00051         {
00052           base_diff_eqn::operator = (a);
00053           xdot = a.xdot;
00054         }
00055       return *this;
00056     }
00057 
00058   void initialize (const ColumnVector& x0, double t0)
00059     {
00060       base_diff_eqn::initialize (x0, t0);
00061       xdot = ColumnVector (x0.length (), 0.0);
00062     }
00063 
00064   void initialize (const ColumnVector& x0, const ColumnVector& xdot0,
00065                    double t0)
00066     {
00067       base_diff_eqn::initialize (x0, t0);
00068       xdot = xdot0;
00069     }
00070 
00071   ColumnVector state_derivative (void) { return xdot; }
00072 
00073 protected:
00074 
00075   ColumnVector xdot;
00076 };
00077 
00078 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines