mbsimflexiblebody  3.0.0
flexible_body_1s_21_rcm.h
1 /* Copyright (C) 2004-2011 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: thorsten.schindler@mytum.de
18  * rzander@users.berlios.de
19  */
20 
21 #ifndef _FLEXIBLE_BODY_1S_21_RCM_H_
22 #define _FLEXIBLE_BODY_1S_21_RCM_H_
23 
24 #include "mbsimFlexibleBody/flexible_body.h"
25 #include "mbsimFlexibleBody/contours/contour1s_flexible.h"
26 #ifdef HAVE_OPENMBVCPPINTERFACE
27 #include <openmbvcppinterface/spineextrusion.h>
28 #endif
29 
30 namespace MBSimFlexibleBody {
31 
52  class FlexibleBody1s21RCM : public FlexibleBodyContinuum<double> {
53  public:
59  FlexibleBody1s21RCM(const std::string &name, bool openStructure);
60 
64  virtual ~FlexibleBody1s21RCM() {}
65 
66  /* INHERITED INTERFACE OF FLEXIBLE BODY */
67  virtual void BuildElements();
68  virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec);
69  virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat);
70  virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat);
71  virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::FrameFeature ff, MBSim::Frame *frame=0);
72  virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0);
73  virtual void exportPositionVelocity(const std::string& filenamePos, const std::string& filenameVel = std::string( ), const int & deg = 3, const bool &writePsFile = false);
74  virtual void importPositionVelocity(const std::string& filenamePos, const std::string& filenameVel = std::string( ));
75  /****************************************/
76 
77  /* INHERITED INTERFACE OF OBJECT */
78  virtual void init(MBSim::InitStage stage);
79  /***************************************************/
80 
81  /* INHERITED INTERFACE OF ELEMENT */
82  virtual void plot(double t, double dt=1);
83  virtual std::string getType() const { return "FlexibleBody1s21RCM"; }
84  /***************************************************/
85 
86  /* GETTER / SETTER */
90  void setNumberElements(int n);
91  int getNumberElements(){return Elements;}
92  void setLength(double L_) { L = L_; }
93  double getLength(){return L;}
94  void setEModul(double E_) { E = E_; }
95  void setCrossSectionalArea(double A_) { A = A_; }
96  void setMomentInertia(double I_) { I = I_; }
97  void setDensity(double rho_) { rho = rho_; }
98  void setCurlRadius(double r);
99  void setMaterialDamping(double d);
100  void setLehrDamping(double d);
101  void setElementPlotList(fmatvec::Vector<int> plotElements_) {plotElements = plotElements_;}
102 #ifdef HAVE_OPENMBVCPPINTERFACE
103  void setOpenMBVSpineExtrusion(OpenMBV::SpineExtrusion* body) { openMBVBody=body; }
104 #endif
105  double getLength() const { return L; }
106  /***************************************************/
107 
112  fmatvec::Vec computeState(double x);
113 
118  void initRelaxed(double alpha);
119 
123  void initInfo();
124 
125  protected:
132  void BuildElement(const double& sGlobal, double& sLocal, int& currentElement);
133 
137  int Elements;
138 
142  double L;
143 
147  double l0;
148 
152  double E;
153 
157  double A;
158 
162  double I;
163 
167  double rho;
168 
172  double rc;
173 
177  double dm;
178 
182  double dl;
183 
187  fmatvec::Vector<int> plotElements;
188 
193 
198 
203  };
204 
205 }
206 
207 #endif /* _FLEXIBLE_BODY_1S_21_RCM_H_ */
208