mbsimflexiblebody  4.0.0
flexible_body_1s_33_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  */
00019 
00020 #ifndef _FLEXIBLE_BODY_1S_33_RCM_H_
00021 #define _FLEXIBLE_BODY_1S_33_RCM_H_
00022 
00023 #include "mbsimFlexibleBody/flexible_body.h"
00024 #include "mbsimFlexibleBody/pointer.h"
00025 #include "mbsimFlexibleBody/contours/flexible_band.h"
00026 #include "mbsimFlexibleBody/contours/cylinder_flexible.h"
00027 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_rcm.h"
00028 #ifdef HAVE_OPENMBVCPPINTERFACE
00029 #include <openmbvcppinterface/spineextrusion.h>
00030 #endif
00031 
00032 
00033 namespace MBSimFlexibleBody {
00034 
00047   class FlexibleBody1s33RCM : public FlexibleBodyContinuum<double> {
00048     public:
00054       FlexibleBody1s33RCM(const std::string &name="",bool openStructure=false);
00055 
00059       virtual ~FlexibleBody1s33RCM() {}
00060 
00061       /* INHERITED INTERFACE OF FLEXIBLE BODY */
00062       virtual void BuildElements();
00063       virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec);
00064       virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat);
00065       virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat);
00066       virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Frame::Feature ff, MBSim::Frame *frame=0);
00067       virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0);
00068       virtual void exportPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string( ), const int & deg = 3, const bool & writePsFile = false);
00069       virtual void importPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string( ));
00070       /***************************************************/
00071 
00072       /* INHERITED INTERFACE OF OBJECT */
00073       virtual void init(InitStage stage);
00074       /***************************************************/
00075 
00076       /* INHERITED INTERFACE OF ELEMENT */
00077       virtual void plot(double t, double dt=1);
00078       virtual std::string getType() const { return "FlexibleBody1s33RCM"; }
00079       void initializeUsingXML(xercesc::DOMElement * element);
00080       /***************************************************/
00081 
00082       /* GETTER / SETTER */
00083       void setNumberElements(int n);
00084       int getNumberElements(){return Elements;}
00085       void setLength(double L_);
00086       double getLength(){return L;}
00087       void setEGModuls(double E_,double G_);
00088       void setDensity(double rho_);
00089       void setCrossSectionalArea(double A_);
00090       void setMomentsInertia(double I1_,double I2_,double I0_);
00091       void setCylinder(double cylinderRadius_);
00092       void setMaterialDamping(double epstD_,double k0D_);
00093 
00094       void setGauss(int nGauss);
00095       void setCuboid(double cuboidBreadth_,double cuboidHeight_);
00096       void setCurlRadius(double R1_,double R2_);
00097       void setLehrDamping(double epstL_,double k0L_);
00098 #ifdef HAVE_OPENMBVCPPINTERFACE
00099       void setOpenMBVSpineExtrusion(const boost::shared_ptr<OpenMBV::SpineExtrusion> &body) { openMBVBody=body; }
00100 #endif
00101       /***************************************************/
00102 
00107       fmatvec::Vec computeState(double sGlobal);
00108 
00113       double computePhysicalStrain(const double sGlobal);
00114 
00118       void initInfo();
00119 
00120     private:
00124       CylinderFlexible *cylinder;
00125       FlexibleBand *top, *bottom, *left, *right;
00126       Contour1sFlexible *neutralFibre;
00127 
00131       RevCardanPtr angle;
00132 
00136       int Elements;
00137 
00141       double L, l0;
00142 
00146       double E, G;
00147 
00151       double A;
00152 
00156       double I1, I2, I0;
00157 
00161       double rho;
00162 
00166       double R1, R2;
00167 
00171       double epstD, k0D, epstL, k0L;
00172 
00176       bool openStructure;
00177 
00181       bool initialised;
00182 
00186       int nGauss;
00187 
00191       double cylinderRadius, cuboidBreadth, cuboidHeight;
00192 
00199       void BuildElement(const double& sGlobal, double& sLocal, int& currentElement);
00200   };
00201 
00202   inline void FlexibleBody1s33RCM::setGauss(int nGauss_) { nGauss = nGauss_; }
00203   inline void FlexibleBody1s33RCM::setCylinder(double cylinderRadius_) { cylinderRadius = cylinderRadius_; }
00204   inline void FlexibleBody1s33RCM::setCuboid(double cuboidBreadth_,double cuboidHeight_) { cuboidBreadth = cuboidBreadth_; cuboidHeight = cuboidHeight_; }
00205   inline void FlexibleBody1s33RCM::setLength(double L_) { L = L_; }
00206   inline void FlexibleBody1s33RCM::setEGModuls(double E_,double G_) { E = E_; G = G_; }
00207   inline void FlexibleBody1s33RCM::setCrossSectionalArea(double A_) { A = A_; }
00208   inline void FlexibleBody1s33RCM::setMomentsInertia(double I1_,double I2_,double I0_) { I1 = I1_; I2 = I2_; I0 = I0_; }
00209   inline void FlexibleBody1s33RCM::setDensity(double rho_) { rho = rho_;}
00210   inline void FlexibleBody1s33RCM::setCurlRadius(double R1_,double R2_) { R1 = R1_; R2 = R2_; if(initialised) for(int i=0;i<Elements;i++) static_cast<FiniteElement1s33RCM*>(discretization[i])->setCurlRadius(R1,R2); }
00211   inline void FlexibleBody1s33RCM::setMaterialDamping(double epstD_,double k0D_) {epstD = epstD_; k0D = k0D_; if(initialised) for(int i=0;i<Elements;i++) static_cast<FiniteElement1s33RCM*>(discretization[i])->setMaterialDamping(Elements*epstD,Elements*k0D); }
00212   inline void FlexibleBody1s33RCM::setLehrDamping(double epstL_,double k0L_) { epstL = epstL_; k0L = k0L_; if(initialised) for(int i=0;i<Elements;i++) static_cast<FiniteElement1s33RCM*>(discretization[i])->setLehrDamping(Elements*epstL,Elements*k0L); }
00213 
00214 }
00215 
00216 #endif /* _FLEXIBLE_BODY_1S_33_RCM_H_ */
00217