MBSim

Project Page
link_mechanics.h
00001 /* Copyright (C) 2004-2014 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: martin.o.foerg@googlemail.com
00018  */
00019 
00020 #ifndef _LINK_MECHANICS_H_
00021 #define _LINK_MECHANICS_H_
00022 
00023 #include "link.h"
00024 
00025 #ifdef HAVE_OPENMBVCPPINTERFACE
00026 namespace OpenMBV {
00027   class Group;
00028   class Arrow;
00029 }
00030 #endif
00031 
00032 namespace H5 {
00033   class Group;
00034 }
00035 
00036 namespace MBSim {
00037   class Contour;
00038 
00048   class LinkMechanics : public Link {
00049     public:
00054       LinkMechanics(const std::string &name);
00055 
00059       virtual ~LinkMechanics();
00060 
00061       /* INHERITED INTERFACE OF LINKINTERFACE */
00062       virtual void updatedhdz(double t);
00063       /***************************************************/
00064 
00065       /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
00066       virtual void init(InitStage stage);
00067       /***************************************************/
00068 
00069       /* INHERITED INTERFACE OF ELEMENT */
00070       std::string getType() const { return "Link"; }
00071       virtual void plot(double t, double dt = 1);
00072       virtual void closePlot();
00073       /***************************************************/
00074 
00075       /* INHERITED INTERFACE OF LINK */
00076       virtual void updateWRef(const fmatvec::Mat& ref, int i=0);
00077       virtual void updateVRef(const fmatvec::Mat& ref, int i=0);
00078       virtual void updatehRef(const fmatvec::Vec &hRef, int i=0);
00079       virtual void updatedhdqRef(const fmatvec::Mat& ref, int i=0);
00080       virtual void updatedhduRef(const fmatvec::SqrMat& ref, int i=0);
00081       virtual void updatedhdtRef(const fmatvec::Vec& ref, int i=0);
00082       virtual void updaterRef(const fmatvec::Vec &ref, int i=0);
00083       /***************************************************/
00084 
00085       /*GETTER / SETTER*/
00086       const std::vector<Contour*> & getContour() const { return contour; }
00087       /*****************/
00088 
00089       /* INTERFACE TO BE DEFINED IN DERIVED CLASS */
00093       virtual void connect(Frame *frame_);
00094 
00098       virtual void connect(Contour *contour_);
00099 
00100       const std::vector<Frame*>& getFrame() const {
00101         return frame;
00102       }
00103 
00104     protected:
00105 #ifdef HAVE_OPENMBVCPPINTERFACE
00106       void setOpenMBVForceArrow(OpenMBV::Arrow *arrow, const std::vector<bool>& which);
00107       void setOpenMBVMomentArrow(OpenMBV::Arrow *arrow, const std::vector<bool>& which);
00108 #endif
00109 
00113       std::vector<fmatvec::Vec3> WF, WM;
00114 
00118       std::vector<fmatvec::Mat3xV> fF, fM;
00119 
00123       std::vector<Frame*> frame;
00124 
00128       std::vector<Contour*> contour;
00129 
00130 #ifdef HAVE_OPENMBVCPPINTERFACE
00131       OpenMBV::Group *openMBVForceGrp;
00132       std::vector<OpenMBV::Arrow*> openMBVArrowF;
00133       std::vector<OpenMBV::Arrow*> openMBVArrowM;
00134 #endif
00135   };
00136 }
00137 
00138 #endif /* _LINK_MECHANICS_H_ */
00139