|
mbsimflexiblebody
4.0.0
|
00001 /* Copyright (C) 2004-2012 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_COSSERAT_H_ 00021 #define _FLEXIBLE_BODY_1S_33_COSSERAT_H_ 00022 00023 #include "flexible_body_1s_cosserat.h" 00024 #include "mbsimFlexibleBody/flexible_body.h" 00025 #include "mbsimFlexibleBody/pointer.h" 00026 #include "mbsimFlexibleBody/contours/flexible_band.h" 00027 #include "mbsimFlexibleBody/contours/cylinder_flexible.h" 00028 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_cosserat_translation.h" 00029 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_cosserat_rotation.h" 00030 #ifdef HAVE_OPENMBVCPPINTERFACE 00031 #include <openmbvcppinterface/spineextrusion.h> 00032 #endif 00033 00034 namespace MBSimFlexibleBody { 00035 00036 class NurbsCurve1s; 00037 00061 class FlexibleBody1s33Cosserat : public FlexibleBody1sCosserat { 00062 public: 00063 00069 FlexibleBody1s33Cosserat(const std::string &name, bool openStructure); 00070 00074 virtual ~FlexibleBody1s33Cosserat(); 00075 00076 /* INHERITED INTERFACE OF FLEXIBLE BODY */ 00077 virtual void BuildElements(); 00078 virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec); 00079 virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat); 00080 virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat); 00081 virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Frame::Feature ff, MBSim::Frame *frame=0); 00082 virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0); 00083 virtual void exportPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string( ), const int & deg = 3, const bool & writePsFile = false); 00084 virtual void importPositionVelocity(const std::string & filenamePos, const std::string & filenameVel = std::string( )); 00085 /***************************************************/ 00086 00087 /* INHERITED INTERFACE OF OBJECT */ 00088 virtual void init(InitStage stage); 00089 virtual double computePotentialEnergy(); 00090 virtual void facLLM(int i=0); 00091 /***************************************************/ 00092 00093 /* INHERITED INTERFACE OF OBJECTINTERFACE */ 00094 virtual void updateh(double t, int i=0); 00095 virtual void updateStateDependentVariables(double t); 00096 00097 /* INHERITED INTERFACE OF ELEMENT */ 00098 virtual void plot(double t, double dt=1); 00099 virtual std::string getType() const { return "FlexibleBody1s33Cosserat"; } 00100 /***************************************************/ 00101 00102 /* GETTER / SETTER */ 00103 void setNumberElements(int n); 00104 00105 void setMomentsInertia(double I1_, double I2_, double I0_); 00106 00107 void setCurlRadius(double R1_,double R2_); 00108 void setMaterialDamping(double cEps0D_,double cEps1D_,double cEps2D_); 00109 00110 00111 #ifdef HAVE_OPENMBVCPPINTERFACE 00112 void setOpenMBVSpineExtrusion(OpenMBV::SpineExtrusion* body) { openMBVBody=body; } 00113 #endif 00114 00115 int getNumberElements() const { return Elements; } 00116 int getNumberDOFs() const { return qSize; } 00117 double getLength() const { return L; } 00118 bool isOpenStructure() const { return openStructure; } 00119 /***************************************************/ 00120 00125 fmatvec::Vec computeState(double s); 00126 00132 fmatvec::Vec3 computeAngles(double sGlobal, const fmatvec::Vec & vec); 00133 00137 void initInfo(); 00138 00139 protected: 00140 00144 bool JTransInterp; 00145 00152 double I2, I0; 00153 00159 double R2; 00160 00164 double cEps2D; 00165 00166 00167 FlexibleBody1s33Cosserat(); // standard constructor 00168 FlexibleBody1s33Cosserat(const FlexibleBody1s33Cosserat&); // copy constructor 00169 FlexibleBody1s33Cosserat& operator=(const FlexibleBody1s33Cosserat&); // assignment operator 00170 00177 void BuildElementTranslation(const double& sGlobal, double& sLocal, int& currentElementTranslation); 00178 00182 void initM(); 00183 00189 void computeBoundaryCondition(); 00190 00197 void GlobalVectorContributionRotation(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec); 00198 }; 00199 00200 inline void FlexibleBody1s33Cosserat::setMomentsInertia(double I1_, double I2_, double I0_) { I1 = I1_; I2 = I2_; I0 = I0_; } 00201 00202 inline void FlexibleBody1s33Cosserat::setCurlRadius(double R1_,double R2_) { R1 = R1_; R2 = R2_; if(initialised) for(int i=0;i<Elements;i++) static_cast<FiniteElement1s33CosseratRotation*>(rotationDiscretization[i])->setCurlRadius(R1,R2); } 00203 inline void FlexibleBody1s33Cosserat::setMaterialDamping(double cEps0D_,double cEps1D_,double cEps2D_) { cEps0D = cEps0D_; cEps1D = cEps1D_; cEps2D = cEps2D_; if(initialised) for(int i=0;i<Elements;i++) static_cast<FiniteElement1s33CosseratTranslation*>(discretization[i])->setMaterialDamping(Elements*cEps0D,cEps1D,cEps2D); } 00204 00205 } 00206 00207 #endif /* _FLEXIBLE_BODY_1S_33_COSSERAT_H_ */ 00208
1.8.0