mbsim 4.0.0 MBSim Kernel

frame_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 _FRAME_LINK_H_
21 #define _FRAME_LINK_H_
22
23 #include "mbsim/links/mechanical_link.h"
24
25 namespace MBSim {
26
31 class FrameLink : public MechanicalLink {
32 public:
37 FrameLink(const std::string &name);
38
39 void init(InitStage stage, const InitConfigSet &config) override;
40 void initializeUsingXML(xercesc::DOMElement *element) override;
41
42 void connect(Frame *frame0, Frame *frame1);
43
44 Frame* getFrame(int i) { return frame[i]; }
45
46 void resetUpToDate() override;
47
48 const fmatvec::Mat3xV& evalGlobalForceDirection() { if(updDF) updateForceDirections(); return DF; }
49 const fmatvec::Mat3xV& evalGlobalMomentDirection() { if(updDF) updateForceDirections(); return DM; }
50
51 fmatvec::Mat3xV& getGlobalForceDirection(bool check=true) { assert((not check) or (not updDF)); return DF; }
52 fmatvec::Mat3xV& getGlobalMomentDirection(bool check=true) { assert((not check) or (not updDF)); return DM; }
53
54 void updatePositions() override;
55 void updateForce() override;
56 void updateMoment() override;
57 void updateR() override;
58
59 const fmatvec::Vec3& evalGlobalRelativePosition() { if(updPos) updatePositions(); return WrP0P1; }
60 const fmatvec::SqrMat3& evalGlobalRelativeOrientation() { if(updPos) updatePositions(); return AK0K1; }
61 const fmatvec::Vec3& evalGlobalRelativeVelocity() { if(updVel) updateVelocities(); return WvP0P1; }
62 const fmatvec::Vec3& evalGlobalRelativeAngularVelocity() { if(updVel) updateVelocities(); return WomK0K1; }
63
64 fmatvec::Vec3& getGlobalRelativePosition(bool check=true) { assert((not check) or (not updPos)); return WrP0P1; }
65 fmatvec::SqrMat3& getGlobalRelativeOrientation(bool check=true) { assert((not check) or (not updPos)); return AK0K1; }
66 fmatvec::Vec3& getGlobalRelativeVelocity(bool check=true) { assert((not check) or (not updVel)); return WvP0P1; }
67 fmatvec::Vec3& getGlobalRelativeAngularVelocity(bool check=true) { assert((not check) or (not updVel)); return WomK0K1; }
68
69 /* INHERITED INTERFACE OF LINK */
70 void updateWRef(fmatvec::Mat& ref, int i=0) override;
71 void updateVRef(fmatvec::Mat& ref, int i=0) override;
72 void updatehRef(fmatvec::Vec &hRef, int i=0) override;
73 virtual void updatedhdqRef(fmatvec::Mat& ref, int i=0);
74 virtual void updatedhduRef(fmatvec::SqrMat& ref, int i=0);
75 virtual void updatedhdtRef(fmatvec::Vec& ref, int i=0);
76 void updaterRef(fmatvec::Vec &ref, int i=0) override;
77 /***************************************************/
78
79 protected:
83 std::vector<Frame*> frame;
84
88 fmatvec::Vec3 WrP0P1, WvP0P1, WomK0K1;
89
90 fmatvec::SqrMat3 AK0K1;
91
92 // int nF, nM;
93
94 fmatvec::Mat3xV DF, DM;
95
96 bool updPos, updVel, updDF;
97
98 private:
99 std::string saved_ref1, saved_ref2;
100 };
101 }
102
103 #endif
MBSim::FrameLink::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: frame_link.cc:53
MBSim::FrameLink::frame
std::vector< Frame * > frame
array in which all frames are listed, connecting bodies via a link
Definition: frame_link.h:83
MBSim::FrameLink::FrameLink
FrameLink(const std::string &name)
constructor
Definition: frame_link.cc:32
MBSim::FrameLink::WrP0P1
fmatvec::Vec3 WrP0P1
difference vector of position, velocity and angular velocity
Definition: frame_link.h:88
MBSim::FrameLink::updaterRef
void updaterRef(fmatvec::Vec &ref, int i=0) override
references to nonsmooth force vector of dynamic system parent
Definition: frame_link.cc:116
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::FrameLink::updateVRef
void updateVRef(fmatvec::Mat &ref, int i=0) override
references to condensed contact force direction matrix of dynamic system parent
Definition: frame_link.cc:86
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::Frame
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
MBSim::FrameLink
frame link
Definition: frame_link.h:31
MBSim::MechanicalLink
mechanical link
Definition: mechanical_link.h:33
MBSim::FrameLink::updateWRef
void updateWRef(fmatvec::Mat &ref, int i=0) override
references to contact force direction matrix of dynamic system parent
Definition: frame_link.cc:78
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30
MBSim::FrameLink::updatehRef
void updatehRef(fmatvec::Vec &hRef, int i=0) override
references to complete and link smooth force vector of dynamic system parent
Definition: frame_link.cc:94