mbsim  4.0.0
MBSim Kernel
contour_link.h
1/* Copyright (C) 2004-2016 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/mechanical_link.h"
24
25namespace MBSim {
26
27 class Contour;
28 class ContourFrame;
29
34 class ContourLink : public MechanicalLink {
35 public:
40 ContourLink(const std::string &name);
41
45 ~ContourLink() override;
46
47 /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
48 void init(InitStage stage, const InitConfigSet &config) override;
49 /***************************************************/
50
51 /* INHERITED INTERFACE OF ELEMENT */
52 /***************************************************/
53
54 /* INHERITED INTERFACE OF LINK */
55 void updateWRef(fmatvec::Mat& ref, int i=0) override;
56 void updateVRef(fmatvec::Mat& ref, int i=0) override;
57 void updatehRef(fmatvec::Vec &hRef, int i=0) override;
58 virtual void updatedhdqRef(fmatvec::Mat& ref, int i=0);
59 virtual void updatedhduRef(fmatvec::SqrMat& ref, int i=0);
60 virtual void updatedhdtRef(fmatvec::Vec& ref, int i=0);
61 void updaterRef(fmatvec::Vec &ref, int i=0) override;
62 /***************************************************/
63
64 void connect(Contour *contour0, Contour* contour1);
65
66 Contour* getContour(int i) { return contour[i]; }
67 ContourFrame* getContourFrame(int i) { return cFrame[i]; }
68
69 void resetUpToDate() override;
70
71 //void updatePositions() override { }
72 //void updateVelocities() override { }
73 void updateForce() override;
74 void updateMoment() override;
75 void updateForceDirections() override;
76 //const fmatvec::Vec3& evalGlobalRelativePosition() { if(updPos) updatePositions(); return WrP0P1; }
77 //const fmatvec::Vec3& evalGlobalRelativeVelocity() { if(updVel) updateVelocities(); return WvP0P1; }
78 //const fmatvec::Vec3& evalGlobalRelativeAngularVelocity() { if(updVel) updateVelocities(); return WomK0K1; }
79 const fmatvec::Mat3xV& evalGlobalForceDirection() { if(updDF) updateForceDirections(); return DF; }
80 const fmatvec::Mat3xV& evalGlobalMomentDirection() { if(updDF) updateForceDirections(); return DM; }
81
82
83 void initializeUsingXML(xercesc::DOMElement *element) override;
84
85 protected:
89 fmatvec::Vec3 WrP0P1, WvP0P1, WomK0K1;
90
91 fmatvec::Mat3xV DF, DM;
92
93 std::vector<Contour*> contour;
94
95 std::vector<ContourFrame*> cFrame;
96
97 bool /*updPos, updVel,*/ updDF;
98
99 private:
100 std::string saved_ref1, saved_ref2;
101 };
102
103}
104
105#endif
Definition: contour_frame.h:27
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:62
std::string name
name of element
Definition: element.h:260
namespace MBSim
Definition: bilateral_constraint.cc:30