All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
fixed_nodal_frame.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 _FIXED_NODAL_FRAME_H__
21 #define _FIXED_NODAL_FRAME_H__
22 
23 #include "mbsim/frame.h"
24 #include "mbsimFlexibleBody/utils/taylor.h"
25 
26 namespace MBSimFlexibleBody {
27 
32  class FixedNodalFrame : public MBSim::Frame {
33 
34  public:
35  FixedNodalFrame(const std::string &name = "dummy") : Frame(name), R(0), ARP(fmatvec::SqrMat3(fmatvec::EYE)), E(fmatvec::Eye()), nq(0) { }
36 
37  FixedNodalFrame(const std::string &name, const fmatvec::Vec3 &r, const fmatvec::Mat3xV &Phi_, const fmatvec::Mat3xV &Psi_, const fmatvec::SqrMat3 &A=fmatvec::SqrMat3(fmatvec::EYE), const FixedNodalFrame *refFrame=0) : Frame(name), R(refFrame), RrRP(r), ARP(A), E(fmatvec::Eye()), Phi(Phi_), Psi(Psi_), nq(0) { }
38 
39  std::string getType() const { return "FixedNodalFrame"; }
40 
41  virtual void init(InitStage stage);
42 
43  int getNumberOfModeShapes() const { return nq; }
44  void setNumberOfModeShapes(int nq_) { nq = nq_; }
45 
46  void updateqRef(const fmatvec::Vec& ref) { q>>ref; }
47  void updateqdRef(const fmatvec::Vec& ref) { qd>>ref; }
48 
49  void setRelativePosition(const fmatvec::Vec3 &r) { RrRP = r; }
50  void setRelativeOrientation(const fmatvec::SqrMat3 &A) { ARP = A; }
51  void setPhi(const fmatvec::Mat3xV &Phi_) { Phi = Phi_; }
52  void setPsi(const fmatvec::Mat3xV &Psi_) { Psi = Psi_; }
53  void setK0F(const std::vector<fmatvec::SqrMatV> &K0F_) { K0F = K0F_; }
54  void setK0M(const std::vector<fmatvec::SqrMatV> &K0M_) { K0M = K0M_; }
55  void setsigma0(const fmatvec::Vector<fmatvec::Fixed<6>, double > &sigma0_) { sigma0 = sigma0_; }
56  void setsigmahel(const fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double> &sigmahel_) { sigmahel = sigmahel_; }
57  void setsigmahen(const std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double> > &sigmahen_) { sigmahen = sigmahen_; }
58  void setFrameOfReference(const FixedNodalFrame *frame) { R = frame; }
59  void setFrameOfReference(const std::string &frame) { saved_frameOfReference = frame; }
60 
61  void setPhi(const Taylor<fmatvec::Mat3xV,std::vector<fmatvec::SqrMatV> > &Phi_) { Phi = Phi_.getM0(); K0F = Phi_.getM1(); }
62  void setPsi(const Taylor<fmatvec::Mat3xV,std::vector<fmatvec::SqrMatV> > &Psi_) { Psi = Psi_.getM0(); K0M = Psi_.getM1(); }
63  void setsigma(const Taylor<fmatvec::Vector<fmatvec::Fixed<6>, double >,fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>,std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double> > > &sigma_) { sigma0 = sigma_.getM0(); sigmahel = sigma_.getM1(); sigmahen = sigma_.getM2(); }
64 
65  void setJacobianOfDeformation(const fmatvec::MatV &J, int j=0) { WJD[j] = J; }
66  fmatvec::MatV& getJacobianOfDeformation(int j=0) { return WJD[j]; }
67  const fmatvec::MatV& getJacobianOfDeformation(int j=0) const { return WJD[j]; }
68  const fmatvec::Vec3& getRelativePosition() const { return RrRP; }
69  const fmatvec::SqrMat3& getRelativeOrientation() const { return ARP; }
70  const Frame* getFrameOfReference() const { return R; }
71  const fmatvec::Vec3& getWrRP() const { return WrRP; }
72 
73  void updateRelativePosition();
74  void updateRelativeOrientation();
75  void updatePosition();
76  void updateOrientation();
77  void updateVelocity();
78  void updateAngularVelocity();
79  void updateStateDependentVariables();
80  void updateJacobians(int j=0);
81  void updateStateDerivativeDependentVariables(const fmatvec::Vec &ud);
82 
83  virtual void plot(double t, double dt = 1);
84 
85  virtual void initializeUsingXML(xercesc::DOMElement *element);
86  virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
87 
88  protected:
89  const FixedNodalFrame *R;
90  fmatvec::Vec3 RrRP, WrRP;
91  fmatvec::SqrMat3 ARP, APK, E;
92  fmatvec::Mat3xV WPhi, WPsi, Phi, Psi;
93  std::vector<fmatvec::SqrMatV> K0F, K0M;
94  fmatvec::Vector<fmatvec::Fixed<6>, double > sigma0;
96  std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double> > sigmahen;
97  fmatvec::MatV WJD[2];
98  fmatvec::Vec q, qd;
99  int nq;
100  std::string saved_frameOfReference;
101  };
102 
103 }
104 
105 #endif /* _FIXED_NODAL_FRAME_H_ */
106 
fixed nodal frame on flexible bodies
Definition: fixed_nodal_frame.h:32
Frame(const std::string &name="dummy")

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML