MBSim

Project Page
extra_dynamic.h
00001 /* Copyright (C) 2004-2009 MBSim Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact: mbachmayer@gmx.de
00018  */
00019 
00020 #ifndef _EXTRA_DYNAMIC_H_
00021 #define _EXTRA_DYNAMIC_H_
00022 
00023 #include "mbsim/element.h"
00024 
00025 namespace MBSim {
00026 
00027   class DynamicSystem;
00028   class Link;
00029 
00036   class ExtraDynamic : public Element {
00037     public:
00042       ExtraDynamic(const std::string &name);
00043 
00049       virtual void updatedx(double t, double dt) = 0;
00050 
00055       virtual void updatexd(double t) = 0;
00056       virtual void calcxSize() {};
00057       virtual const fmatvec::Vec& getx() const { return x; }
00058       virtual fmatvec::Vec& getx() { return x; }
00059       virtual void setxInd(int xInd_) { xInd = xInd_; };
00060       virtual int getxSize() const { return xSize; }
00061       virtual void updatexRef(const fmatvec::Vec& ref);
00062       virtual void updatexdRef(const fmatvec::Vec& ref);
00063       virtual void init(InitStage stage);
00064       virtual void initz();
00065       virtual void writez(const H5::Group & group);
00066       virtual void readz0(const H5::Group & group);
00067       /***************************************************/
00068 
00069       /* INHERITED INTERFACE OF ELEMENT */
00070       virtual std::string getType() const { return "ExtraDynamic"; }
00071       virtual void closePlot(); 
00072       virtual void plot(double t, double dt = 1); 
00073       /***************************************************/
00074 
00075       /* INTERFACE TO BE DEFINED IN DERIVED CLASSES */
00076       virtual void updateg(double t) = 0;
00077       /***************************************************/
00078 
00079       /* GETTER / SETTER */
00080       void setInitialState(const fmatvec::Vec &x0_) { x0 = x0_; }
00081       virtual Element *getByPathSearch(std::string path);
00082       /***************************************************/
00083       
00084       virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00085 
00086     protected:
00090       fmatvec::Vec x, xd, x0;
00091 
00095       int xSize;
00096 
00100       int xInd;
00101 
00105       fmatvec::Vec y;
00106 
00107   };
00108 
00109 }
00110 
00111 #endif /* _EXTRA_DYNAMIC_H_ */
00112