All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
contour_link.h
1 /* Copyright (C) 2004-2014 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 _CONTOUR_LINK_H_
21 #define _CONTOUR_LINK_H_
22 
23 #include "mbsim/links/link.h"
24 
25 #include "mbsim/utils/boost_parameters.h"
26 #include "mbsim/utils/openmbv_utils.h"
27 
28 namespace OpenMBV {
29  class Group;
30  class Arrow;
31 }
32 
33 namespace MBSim {
34 
35  class Contour;
36  class ContourFrame;
37 
42  class ContourLink : public Link {
43  public:
48  ContourLink(const std::string &name);
49 
53  ~ContourLink();
54 
55  /* INHERITED INTERFACE OF LINKINTERFACE */
56  virtual void updateh(int i=0);
57  virtual void updateW(int i=0);
58  virtual void updatedhdz();
59  /***************************************************/
60 
61  /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
62  virtual void init(InitStage stage);
63  /***************************************************/
64 
65  /* INHERITED INTERFACE OF ELEMENT */
66  std::string getType() const { return "Link"; }
67  virtual void plot();
68  virtual void closePlot();
69  /***************************************************/
70 
71  /* INHERITED INTERFACE OF LINK */
72  virtual void updateWRef(const fmatvec::Mat& ref, int i=0);
73  virtual void updateVRef(const fmatvec::Mat& ref, int i=0);
74  virtual void updatehRef(const fmatvec::Vec &hRef, int i=0);
75  virtual void updatedhdqRef(const fmatvec::Mat& ref, int i=0);
76  virtual void updatedhduRef(const fmatvec::SqrMat& ref, int i=0);
77  virtual void updatedhdtRef(const fmatvec::Vec& ref, int i=0);
78  virtual void updaterRef(const fmatvec::Vec &ref, int i=0);
79  /***************************************************/
80 
81  void connect(Contour *contour0, Contour* contour1) {
82  contour[0] = contour0;
83  contour[1] = contour1;
84  }
85 
86  Contour* getContour(int i) { return contour[i]; }
87  ContourFrame* getContourFrame(int i) { return cFrame[i]; }
88 
89  void resetUpToDate();
90  virtual void updatePositions() { }
91  virtual void updateVelocities() { }
92  virtual void updateForceDirections();
93  void updateForce();
94  void updateMoment();
95  const fmatvec::Vec3& evalGlobalRelativePosition() { if(updPos) updatePositions(); return WrP0P1; }
96  const fmatvec::Vec3& evalGlobalRelativeVelocity() { if(updVel) updateVelocities(); return WvP0P1; }
97  const fmatvec::Vec3& evalGlobalRelativeAngularVelocity() { if(updVel) updateVelocities(); return WomP0P1; }
98  const fmatvec::Mat3xV& evalGlobalForceDirection() { if(updFD) updateForceDirections(); return DF; }
99  const fmatvec::Mat3xV& evalGlobalMomentDirection() { if(updFD) updateForceDirections(); return DM; }
100  const fmatvec::Vec3& evalForce() { if(updF) updateForce(); return F; }
101  const fmatvec::Vec3& evalMoment() { if(updM) updateMoment(); return M; }
102 
103  virtual void initializeUsingXML(xercesc::DOMElement *element);
104 
105  void setOpenMBVForce(const std::shared_ptr<OpenMBV::Arrow> &arrow) { openMBVArrowF = arrow; }
106  void setOpenMBVMoment(const std::shared_ptr<OpenMBV::Arrow> &arrow) { openMBVArrowM = arrow; }
107 
108  protected:
112  fmatvec::Vec3 WrP0P1, WvP0P1, WomP0P1;
113 
114  fmatvec::Mat3xV DF, DM;
115 
116  fmatvec::Vec3 F, M;
117 
118  fmatvec::Mat3xV RF, RM;
119 
123  fmatvec::RangeV iF, iM;
124 
125  std::vector<Contour*> contour;
126 
127  std::vector<ContourFrame*> cFrame;
128 
129  std::shared_ptr<OpenMBV::Group> openMBVForceGrp;
130  std::shared_ptr<OpenMBV::Arrow> openMBVArrowF;
131  std::shared_ptr<OpenMBV::Arrow> openMBVArrowM;
132 
133  bool updPos, updVel, updFD, updF, updM, updR;
134 
135  private:
136  std::string saved_ref1, saved_ref2;
137  };
138 
139 }
140 
141 #endif
basic class for contour definition for rigid (which do not know about their shape) and flexible (they...
Definition: contour.h:40
InitStage
The stages of the initialization.
Definition: element.h:97
std::string name
name of element
Definition: element.h:298

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML