mbsimflexiblebody  4.0.0
flexible_body_1s_21_rcm.h
00001 /* Copyright (C) 2004-2011 MBSim Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Lesser General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2.1 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Lesser General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public
00014  * License along with this library; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact: thorsten.schindler@mytum.de
00018  *          rzander@users.berlios.de
00019  */
00020 
00021 #ifndef _FLEXIBLE_BODY_1S_21_RCM_H_
00022 #define _FLEXIBLE_BODY_1S_21_RCM_H_
00023 
00024 #include "mbsimFlexibleBody/flexible_body.h"
00025 #include "mbsimFlexibleBody/contours/contour1s_flexible.h"
00026 #ifdef HAVE_OPENMBVCPPINTERFACE
00027 #include <openmbvcppinterface/spineextrusion.h>
00028 #endif
00029 
00030 namespace MBSimFlexibleBody {
00031 
00052   class FlexibleBody1s21RCM : public FlexibleBodyContinuum<double> {
00053     public:
00059       FlexibleBody1s21RCM(const std::string &name, bool openStructure);
00060 
00064       virtual ~FlexibleBody1s21RCM() {}
00065 
00066       /* INHERITED INTERFACE OF FLEXIBLE BODY */
00067       virtual void BuildElements();
00068       virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec);
00069       virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat);
00070       virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat);
00071       virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Frame::Feature ff, MBSim::Frame *frame=0);
00072       virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0);
00073       virtual void exportPositionVelocity(const std::string& filenamePos, const std::string& filenameVel = std::string( ), const int & deg = 3, const bool &writePsFile = false);
00074       virtual void importPositionVelocity(const std::string& filenamePos, const std::string& filenameVel = std::string( ));
00075       /****************************************/
00076 
00077       /* INHERITED INTERFACE OF OBJECT */
00078       virtual void init(InitStage stage);
00079       /***************************************************/
00080 
00081       /* INHERITED INTERFACE OF ELEMENT */
00082       virtual void plot(double t, double dt=1);
00083       virtual std::string getType() const { return "FlexibleBody1s21RCM"; }
00084       /***************************************************/
00085 
00086       /* GETTER / SETTER */
00090       void setNumberElements(int n);
00091       int getNumberElements(){return Elements;}
00092       void setLength(double L_) { L = L_; }
00093       double getLength(){return L;}
00094       void setEModul(double E_) { E = E_; }
00095       void setCrossSectionalArea(double A_) { A = A_; }
00096       void setMomentInertia(double I_) { I = I_; }
00097       void setDensity(double rho_) { rho = rho_; }
00098       void setCurlRadius(double r);
00099       void setMaterialDamping(double d);
00100       void setLehrDamping(double d);
00101       void setElementPlotList(fmatvec::VecInt plotElements_) {plotElements = plotElements_;}
00102 #ifdef HAVE_OPENMBVCPPINTERFACE
00103       void setOpenMBVSpineExtrusion(const boost::shared_ptr<OpenMBV::SpineExtrusion> &body) { openMBVBody=body; }
00104 #endif
00105       double getLength() const { return L; }
00106       /***************************************************/
00107 
00112       fmatvec::Vec computeState(double x);
00113 
00117       double computePhysicalStrain(double sGlobal);
00118 
00123       void initRelaxed(double alpha);
00124 
00128       void initInfo();
00129 
00130     protected:
00137       void BuildElement(const double& sGlobal, double& sLocal, int& currentElement);
00138 
00142       int Elements;
00143 
00147       double L;
00148 
00152       double l0;
00153 
00157       double E;
00158 
00162       double A;
00163 
00167       double I;
00168 
00172       double rho;
00173 
00177       double rc;
00178 
00182       double dm;
00183 
00187       double dl;
00188 
00192       fmatvec::VecInt plotElements;
00193 
00197       bool openStructure;
00198 
00202       bool initialized;
00203 
00207       Contour1sFlexible *contour1sFlexible;
00208   };
00209 
00210 }
00211 
00212 #endif /* _FLEXIBLE_BODY_1S_21_RCM_H_ */
00213