All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
flexible_band.h
1 /* Copyright (C) 2004-2015 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 _FLEXIBLE_BAND_H_
21 #define _FLEXIBLE_BAND_H_
22 
23 #include "mbsimFlexibleBody/contours/contour1s.h"
24 #include "mbsimFlexibleBody/utils/contact_utils.h"
25 #include "mbsim/utils/eps.h"
26 
27 #include <openmbvcppinterface/spineextrusion.h>
28 #include "mbsim/utils/boost_parameters.h"
29 #include <mbsim/utils/openmbv_utils.h>
30 
31 #include <list>
32 
33 namespace MBSim {
34 
35  BOOST_PARAMETER_NAME(numberOfSpinePoints)
36 
37 }
38 
39 namespace MBSimFlexibleBody {
40 
41  class FlexibleBand : public Contour1s {
42  public:
47  FlexibleBand(const std::string& name) : Contour1s(name), width(0), ARK(fmatvec::EYE), sOld(-1e12) { }
48 
49  /* INHERITED INTERFACE OF ELEMENT */
50  virtual std::string getType() const { return "FlexibleBand"; }
51  void init(InitStage stage);
52  /***************************************************/
53 
54  virtual MBSim::ContourFrame* createContourFrame(const std::string &name="P");
55 
56  /* GETTER / SETTER */
57  void setWidth(double width_) { width = width_; }
58  double getWidth() const { return width; }
59 
60  void setRelativePosition(const fmatvec::Vec2 &r);
61  void setRelativeOrientation(double al);
62 
63  const fmatvec::Vec3& getRelativePosition() const { return RrRP; }
64  const fmatvec::SqrMat3& getRelativeOrientation() const { return ARK; }
65 
66  virtual fmatvec::Vec3 evalPosition(const fmatvec::Vec2 &zeta) { return evalPosition(zeta(0)); }
67  virtual fmatvec::Vec3 evalWs(const fmatvec::Vec2 &zeta) { return evalWs(zeta(0)); }
68  virtual fmatvec::Vec3 evalWt(const fmatvec::Vec2 &zeta) { return evalWt(zeta(0)); }
69  virtual fmatvec::Vec3 evalWu(const fmatvec::Vec2 &zeta) { return evalWs(zeta); }
70  virtual fmatvec::Vec3 evalWv(const fmatvec::Vec2 &zeta) { return evalWt(zeta); }
71 
72  virtual bool isZetaOutside(const fmatvec::Vec2 &zeta);
73 
74  void updatePositions(double s);
75 
76  fmatvec::Vec3 evalPosition(double s) { if(fabs(s-sOld)>MBSim::macheps()) updatePositions(s); return WrOP; }
77  fmatvec::Vec3 evalWs(double s) { if(fabs(s-sOld)>MBSim::macheps()) updatePositions(s); return Ws; }
78  fmatvec::Vec3 evalWt(double s) { if(fabs(s-sOld)>MBSim::macheps()) updatePositions(s); return Wt; }
79 
80  virtual void plot();
81 
82  void setContourOfReference(Contour1s *contour_) { contour = contour_; }
83 
84  MBSim::ContactKinematics * findContactPairingWith(std::string type0, std::string type1) { return findContactPairingFlexible(type0.c_str(), type1.c_str()); }
85 
86  void setNodes(const std::vector<double> &nodes_) { etaNodes = nodes_; }
87 
88  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, MBSim::tag, (optional (numberOfSpinePoints,(int),10)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
89  openMBVSpineExtrusion = OpenMBV::ObjectFactory::create<OpenMBV::SpineExtrusion>();
90  openMBVSpineExtrusion->setNumberOfSpinePoints(numberOfSpinePoints);
91  }
92 
93  void resetUpToDate();
94 
95  protected:
99  double width;
100 
101  fmatvec::Vec3 RrRP, WrOP, Ws, Wt;
102  fmatvec::SqrMat3 ARK;
103 
104  Contour1s* contour;
105 
106  double sOld;
107 
108  std::shared_ptr<OpenMBV::SpineExtrusion> openMBVSpineExtrusion;
109  };
110 
111 }
112 
113 #endif /* _FLEXIBLE_BAND_H_ */
double width
width of flexible band
Definition: flexible_band.h:99
FlexibleBand(const std::string &name)
constructor
Definition: flexible_band.h:47
basic class for contours described by one contour parameter
Definition: contour1s.h:35
Contour1s(const std::string &name)
constructor
Definition: contour1s.h:41
Definition: flexible_band.h:41

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML