mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
flexible_ffr_body.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_FFR_BODY_H_
21 #define _FLEXIBLE_FFR_BODY_H_
22 
23 #include "mbsimFlexibleBody/flexible_body/generic_flexible_ffr_body.h"
24 #include <openmbvcppinterface/flexiblebody.h>
25 #include <openmbvcppinterface/objectfactory.h>
26 #include <openmbvcppinterface/group.h>
27 
28 namespace OpenMBV {
29  class FlexibleBody;
30 }
31 
32 namespace MBSimFlexibleBody {
33 
39 
40  public:
41  FlexibleFfrBody(const std::string &name="") : GenericFlexibleFfrBody(name) { }
42 
43  // Interface for basic data
49  void setMass(double m_) { m = m_; }
50  void setPositionIntegral(const fmatvec::Vec3 &rdm_) { rdm = rdm_; }
51  void setPositionPositionIntegral(const fmatvec::SymMat3& rrdm_) { rrdm = rrdm_; }
52  void setShapeFunctionIntegral(const fmatvec::Mat3xV &Pdm_) { Pdm <<= Pdm_; }
53 
54  void setPositionShapeFunctionIntegral(const std::vector<fmatvec::Mat3xV> &rPdm) { setPositionShapeFunctionIntegralArray(rPdm); }
55  void setPositionShapeFunctionIntegralArray(const std::vector<fmatvec::Mat3xV> &rPdm_) { rPdm = rPdm_; }
56  void setPositionShapeFunctionIntegral(const fmatvec::MatV &rPdm_) { rPdm = getCellArray1D<fmatvec::Mat3xV>(3,rPdm_); }
57 
58  void setShapeFunctionShapeFunctionIntegral(const std::vector<std::vector<fmatvec::SqrMatV>> &PPdm) { setShapeFunctionShapeFunctionIntegralArray(PPdm); }
59  void setShapeFunctionShapeFunctionIntegralArray(const std::vector<std::vector<fmatvec::SqrMatV>> &PPdm_) { PPdm = PPdm_; }
60  void setShapeFunctionShapeFunctionIntegral(const fmatvec::MatV &PPdm_) { PPdm = getCellArray2D<fmatvec::SqrMatV>(PPdm_.cols(),3,PPdm_); }
61 
62  void setStiffnessMatrix(const fmatvec::SymMatV &Ke0_) { Ke0 <<= Ke0_; }
63  void setDampingMatrix(const fmatvec::SymMatV &De0_) { De0 <<= De0_; }
64  void setModalDamping(const fmatvec::VecV &mDamping_) { mDamping <<= mDamping_; }
65  void setProportionalDamping(const fmatvec::Vec2 &beta_) { beta = beta_; }
66  // End of interface
67 
68  // Interface for nonlinear stiffness matrices
69  void setNonlinearStiffnessMatrixOfFirstOrder(const std::vector<fmatvec::SqrMatV> &Knl1) { setNonlinearStiffnessMatrixOfFirstOrderArray(Knl1); }
70  void setNonlinearStiffnessMatrixOfFirstOrderArray(const std::vector<fmatvec::SqrMatV> &Knl1_) { Knl1 = Knl1_; }
71  void setNonlinearStiffnessMatrixOfFirstOrder(const fmatvec::MatV &Knl1_) { Knl1 = getCellArray1D<fmatvec::SqrMatV>(Knl1_.cols(),Knl1_); }
72 
73  void setNonlinearStiffnessMatrixOfSecondOrder(const std::vector<std::vector<fmatvec::SqrMatV>> &Knl2) { setNonlinearStiffnessMatrixOfSecondOrderArray(Knl2); }
74  void setNonlinearStiffnessMatrixOfSecondOrderArray(const std::vector<std::vector<fmatvec::SqrMatV>> &Knl2_) { Knl2 = Knl2_; }
75  void setNonlinearStiffnessMatrixOfSecondOrder(const fmatvec::MatV &Knl2_) { Knl2 = getCellArray2D<fmatvec::SqrMatV>(Knl2_.cols(),Knl2_.cols(),Knl2_); }
76  // End of interface
77 
78  // Interface for reference stresses
79  void setInitialStressIntegral(const fmatvec::VecV &ksigma0_) { ksigma0 <<= ksigma0_; }
80  void setNonlinearInitialStressIntegral(const fmatvec::SqrMatV &ksigma1_) { ksigma1 <<= ksigma1_; }
81  // End of interface
82 
83  // Interface for geometric stiffness matrices
84  void setGeometricStiffnessMatrixDueToAcceleration(const std::vector<fmatvec::SqrMatV> &K0t) { setGeometricStiffnessMatrixDueToAccelerationArray(K0t); }
85  void setGeometricStiffnessMatrixDueToAccelerationArray(const std::vector<fmatvec::SqrMatV> &K0t_) { K0t = K0t_; }
86  void setGeometricStiffnessMatrixDueToAcceleration(const fmatvec::MatV &K0t_) { K0t = getCellArray1D<fmatvec::SqrMatV>(K0t_.cols(),K0t_); }
87 
88  void setGeometricStiffnessMatrixDueToAngularAcceleration(const std::vector<fmatvec::SqrMatV> &K0r) { setGeometricStiffnessMatrixDueToAngularAccelerationArray(K0r); }
89  void setGeometricStiffnessMatrixDueToAngularAccelerationArray(const std::vector<fmatvec::SqrMatV> &K0r_) { K0r = K0r_; }
90  void setGeometricStiffnessMatrixDueToAngularAcceleration(const fmatvec::MatV &K0r_) { K0r = getCellArray1D<fmatvec::SqrMatV>(K0r_.cols(),K0r_); }
91 
92  void setGeometricStiffnessMatrixDueToAngularVelocity(const std::vector<fmatvec::SqrMatV> &K0om) { setGeometricStiffnessMatrixDueToAngularVelocityArray(K0om); }
93  void setGeometricStiffnessMatrixDueToAngularVelocityArray(const std::vector<fmatvec::SqrMatV> &K0om_) { K0om = K0om_; }
94  void setGeometricStiffnessMatrixDueToAngularVelocity(const fmatvec::MatV &K0om_) { K0om = getCellArray1D<fmatvec::SqrMatV>(K0om_.cols(),K0om_); }
95  // End of interface
96 
97  void setNodeNumbers(const std::vector<int> &nodeNumbers_) { nodeNumbers = nodeNumbers_; }
98 
99  void setNodalRelativePosition(const std::vector<fmatvec::Vec3> &r) { setNodalRelativePositionArray(r); }
100  void setNodalRelativePositionArray(const std::vector<fmatvec::Vec3> &r) { KrKP = r; }
101  void setNodalRelativePosition(const fmatvec::VecV &r) { KrKP = getCellArray1D<fmatvec::Vec3>(3,r); }
102 
103  void setNodalRelativeOrientation(const std::vector<fmatvec::SqrMat3> &A) { setNodalRelativeOrientationArray(A); }
104  void setNodalRelativeOrientationArray(const std::vector<fmatvec::SqrMat3> &A) { ARP = A; }
105  void setNodalRelativeOrientation(const fmatvec::MatVx3 &A) { ARP = getCellArray1D<fmatvec::SqrMat3>(3,A); }
106 
107  void setNodalShapeMatrixOfTranslation(const std::vector<fmatvec::Mat3xV> &Phi) { setNodalShapeMatrixOfTranslationArray(Phi); }
108  void setNodalShapeMatrixOfTranslationArray(const std::vector<fmatvec::Mat3xV> &Phi_) { Phi = Phi_; }
109  void setNodalShapeMatrixOfTranslation(const fmatvec::MatV &Phi_) { Phi = getCellArray1D<fmatvec::Mat3xV>(3,Phi_); }
110 
111  void setNodalShapeMatrixOfRotation(const std::vector<fmatvec::Mat3xV> &Psi) { setNodalShapeMatrixOfRotationArray(Psi); }
112  void setNodalShapeMatrixOfRotationArray(const std::vector<fmatvec::Mat3xV> &Psi_) { Psi = Psi_; }
113  void setNodalShapeMatrixOfRotation(const fmatvec::MatV &Psi_) { Psi = getCellArray1D<fmatvec::Mat3xV>(3,Psi_); }
114 
115  void setNodalStressMatrix(const std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>> &sigmahel) { setNodalStressMatrixArray(sigmahel); }
116  void setNodalStressMatrixArray(const std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>> &sigmahel_) { sigmahel = sigmahel_; }
117  void setNodalStressMatrix(const fmatvec::MatV &sigmahel_) { sigmahel = getCellArray1D<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>>(6,sigmahel_); }
118 
119  void setNodalNonlinearStressMatrix(const std::vector<std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>> > &sigmahen) { setNodalNonlinearStressMatrixArray(sigmahen); }
120  void setNodalNonlinearStressMatrixArray(const std::vector<std::vector<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>> > &sigmahen_) { sigmahen = sigmahen_; }
121  void setNodalNonlinearStressMatrix(const fmatvec::MatV &sigmahen_) { sigmahen = getCellArray2D<fmatvec::Matrix<fmatvec::General, fmatvec::Fixed<6>, fmatvec::Var, double>>(6,sigmahen_.cols(),sigmahen_); }
122 
123  void setNodalInitialStress(const std::vector<fmatvec::Vector<fmatvec::Fixed<6>, double>> &sigma0) { setNodalInitialStressArray(sigma0); }
124  void setNodalInitialStressArray(const std::vector<fmatvec::Vector<fmatvec::Fixed<6>, double>> &sigma0_) { sigma0 = sigma0_; }
125  void setNodalInitialStress(const fmatvec::VecV &sigma0_) { sigma0 = getCellArray1D<fmatvec::Vector<fmatvec::Fixed<6>, double>>(6,sigma0_); }
126 
127  void setNodalGeometricStiffnessMatrixDueToForce(const std::vector<std::vector<fmatvec::SqrMatV>> &K0F) { setNodalGeometricStiffnessMatrixDueToForceArray(K0F); }
128  void setNodalGeometricStiffnessMatrixDueToForceArray(const std::vector<std::vector<fmatvec::SqrMatV>> &K0F_) { K0F = K0F_; }
129  void setNodalGeometricStiffnessMatrixDueToForce(const fmatvec::MatV &K0F_) { K0F = getCellArray2D<fmatvec::SqrMatV>(K0F_.cols(),K0F_.cols(),K0F_); }
130 
131  void setNodalGeometricStiffnessMatrixDueToMoment(const std::vector<std::vector<fmatvec::SqrMatV>> &K0M) { setNodalGeometricStiffnessMatrixDueToMomentArray(K0M); }
132  void setNodalGeometricStiffnessMatrixDueToMomentArray(const std::vector<std::vector<fmatvec::SqrMatV>> &K0M_) { K0M = K0M_; }
133  void setNodalGeometricStiffnessMatrixDueToMoment(const fmatvec::MatV &K0M_) { K0M = getCellArray2D<fmatvec::SqrMatV>(K0M_.cols(),K0M_.cols(),K0M_); }
134 
135  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
136  void initializeUsingXML(xercesc::DOMElement *element) override;
137 
138  void setOpenMBVFlexibleBody(const std::shared_ptr<OpenMBV::FlexibleBody> &body);
139  void setOpenMBVNodeNumbers(const std::vector<int> &visuNodes_) { visuNodes = visuNodes_; }
140  void setOpenMBVColorRepresentation(OpenMBVFlexibleBody::ColorRepresentation ombvColorRepresentation_) { ombvColorRepresentation = ombvColorRepresentation_; }
141  void setPlotNodeNumbers(const std::vector<int> &plotNodes_) { plotNodes = plotNodes_; }
142 
143  private:
144  fmatvec::Vec2 beta;
145  fmatvec::VecV mDamping;
146  };
147 
148 }
149 
150 #endif
Flexible body using a floating frame of reference formulation.
Definition: flexible_ffr_body.h:38
void setMass(double m_)
Set mass.
Definition: flexible_ffr_body.h:49
Generic flexible body using a floating frame of reference formulation.
Definition: generic_flexible_ffr_body.h:62