MBSim

Project Page
link_mechanics.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _LINK_MECHANICS_H_
21 #define _LINK_MECHANICS_H_
22 
23 #include "link.h"
24 
25 #ifdef HAVE_OPENMBVCPPINTERFACE
26 namespace OpenMBV {
27  class Group;
28  class Arrow;
29 }
30 #endif
31 
32 namespace H5 {
33  class Group;
34 }
35 
36 namespace MBSim {
37  class Contour;
38 
48  class LinkMechanics : public Link {
49  public:
54  LinkMechanics(const std::string &name);
55 
59  virtual ~LinkMechanics();
60 
61  /* INHERITED INTERFACE OF LINKINTERFACE */
62  virtual void updatedhdz(double t);
63  /***************************************************/
64 
65  /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
66  virtual void init(InitStage stage);
67  /***************************************************/
68 
69  /* INHERITED INTERFACE OF ELEMENT */
70  std::string getType() const { return "Link"; }
71  virtual void plot(double t, double dt = 1);
72  virtual void closePlot();
73  /***************************************************/
74 
75  /* INHERITED INTERFACE OF LINK */
76  virtual void updateWRef(const fmatvec::Mat& ref, int i=0);
77  virtual void updateVRef(const fmatvec::Mat& ref, int i=0);
78  virtual void updatehRef(const fmatvec::Vec &hRef, int i=0);
79  virtual void updatedhdqRef(const fmatvec::Mat& ref, int i=0);
80  virtual void updatedhduRef(const fmatvec::SqrMat& ref, int i=0);
81  virtual void updatedhdtRef(const fmatvec::Vec& ref, int i=0);
82  virtual void updaterRef(const fmatvec::Vec &ref, int i=0);
83  /***************************************************/
84 
85  /* INTERFACE TO BE DEFINED IN DERIVED CLASS */
89  virtual void connect(Frame *frame_);
90 
94  virtual void connect(Contour *contour_);
95 
96  protected:
97 #ifdef HAVE_OPENMBVCPPINTERFACE
98  void setOpenMBVForceArrow(OpenMBV::Arrow *arrow, const std::vector<bool>& which);
99  void setOpenMBVMomentArrow(OpenMBV::Arrow *arrow, const std::vector<bool>& which);
100 #endif
101 
105  std::vector<fmatvec::Vec> WF, WM;
106 
110  std::vector<fmatvec::Mat> fF, fM;
111 
115  std::vector<Frame*> frame;
116 
120  std::vector<Contour*> contour;
121 
122 #ifdef HAVE_OPENMBVCPPINTERFACE
123  OpenMBV::Group *openMBVForceGrp;
124  std::vector<OpenMBV::Arrow*> openMBVArrowF;
125  std::vector<OpenMBV::Arrow*> openMBVArrowM;
126 #endif
127  };
128 }
129 
130 #endif /* _LINK_MECHANICS_H_ */
131