mbsimflexiblebody 4.0.0 MBSim Flexible Body Module

contour1s_flexible.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 _CONTOUR1S_FLEXIBLE_H_
21 #define _CONTOUR1S_FLEXIBLE_H_
22
23 #include "mbsimFlexibleBody/contours/contour1s.h"
24 #include "mbsimFlexibleBody/utils/contact_utils.h"
25 #include "mbsim/utils/eps.h"
26
27 namespace MBSim {
28 class ContactKinematics;
29 }
30
31 namespace MBSimFlexibleBody {
32
45 class Contour1sFlexible : public Contour1s {
46 public:
51 Contour1sFlexible(const std::string & name) : Contour1s(name), sOld(-1e12) { }
52
53 /* INHERITED INTERFACE OF ELEMENT */
54 /***************************************************/
55
56 MBSim::ContourFrame* createContourFrame(const std::string &name="P") override;
57
58 fmatvec::Vec3 evalPosition(const fmatvec::Vec2 &zeta) override { return evalPosition(zeta(0)); }
59 fmatvec::Vec3 evalWs(const fmatvec::Vec2 &zeta) override { return evalWs(zeta(0)); }
60 fmatvec::Vec3 evalWt(const fmatvec::Vec2 &zeta) override { return evalWt(zeta(0)); }
61 fmatvec::Vec3 evalWu(const fmatvec::Vec2 &zeta) override { return evalWs(zeta); }
62 fmatvec::Vec3 evalWv(const fmatvec::Vec2 &zeta) override { return evalWt(zeta); }
63
64 bool isZetaOutside(const fmatvec::Vec2 &zeta) override { return zeta(0) < etaNodes[0] or zeta(0) > etaNodes[etaNodes.size()-1]; }
65
66 MBSim::ContactKinematics * findContactPairingWith(const std::type_info &type0, const std::type_info &type1) override { return findContactPairingFlexible(type0, type1); }
67
68 void setNodes(const std::vector<double> &nodes_) { etaNodes = nodes_; }
69
70 void resetUpToDate() override;
71 virtual void updatePositions(double s);
72
73 fmatvec::Vec3 evalPosition(double s) { if(fabs(s-sOld)>MBSim::macheps) updatePositions(s); return WrOP; }
74 fmatvec::Vec3 evalWs(double s) { if(fabs(s-sOld)>MBSim::macheps) updatePositions(s); return Ws; }
75 fmatvec::Vec3 evalWt(double s) { if(fabs(s-sOld)>MBSim::macheps) updatePositions(s); return Wt; }
76
77 void updatePositions(MBSim::Frame *frame) override;
78 void updateVelocities(MBSim::Frame *frame) override;
79 void updateAccelerations(MBSim::Frame *frame) override;
80 void updateJacobians(MBSim::Frame *frame, int j=0) override;
81 void updateGyroscopicAccelerations(MBSim::Frame *frame) override;
82
83 protected:
84 fmatvec::Vec3 WrOP, Ws, Wt;
85
86 double sOld;
87 };
88
89 }
90
91 #endif /* _CONTOUR1S_FLEXIBLE_H_ */
MBSimFlexibleBody::Contour1s
basic class for contours described by one contour parameter
Definition: contour1s.h:35
MBSimFlexibleBody::Contour1sFlexible
numerical description of contours with one contour parameter
Definition: contour1s_flexible.h:45
MBSim::ContourFrame
MBSim::Element::name
std::string name
MBSimFlexibleBody::Contour1sFlexible::Contour1sFlexible
Contour1sFlexible(const std::string &name)
constructor
Definition: contour1s_flexible.h:51
MBSim::Frame
MBSim::ContactKinematics