mbsimflexiblebody  4.0.0
flexible_body_1s_33_ancf.h
00001 /* Copyright (C) 2004-2014 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_ANCF_H_
00021 #define _FLEXIBLE_BODY_1S_33_ANCF_H_
00022 
00023 #include "mbsimFlexibleBody/flexible_body.h"
00024 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_1s_33_ancf.h"
00025 
00026 #ifdef HAVE_OPENMBVCPPINTERFACE
00027 #include <openmbvcppinterface/spineextrusion.h>
00028 #endif
00029 
00030 
00031 namespace MBSimFlexibleBody {
00032 
00047   class FlexibleBody1s33ANCF : public FlexibleBodyContinuum<double> {
00048 
00049     public:
00055       FlexibleBody1s33ANCF(const std::string &name, bool openStructure);
00056 
00060       virtual ~FlexibleBody1s33ANCF() {}
00061 
00062       /* INHERITED INTERFACE OF FLEXIBLE BODY */
00063       virtual void updateM(double t, int k) {}
00064       virtual void BuildElements();
00065       virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec);
00066       virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat);
00067       virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat);
00068       virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Feature ff, MBSim::Frame *frame=0);
00069       virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0);
00070       /****************************************/
00071 
00072       /* INHERITED INTERFACE OF OBJECT */
00073       virtual void init(InitStage stage);
00074       virtual void facLLM(int i = 0) {}
00075       /***************************************************/
00076 
00077       /* INHERITED INTERFACE OF ELEMENT */
00078       virtual void plot(double t, double dt=1);
00079       virtual std::string getType() const { return "FlexibleBody1s33ANCF"; }
00080       /***************************************************/
00081 
00082       /* GETTER / SETTER */
00083       void setNumberElements(int n);
00084       void setLength(double L_) { L = L_; }
00085       void setEModul(double E_) { E = E_; }
00086       void setShearModul(double G_) { G = G_; }
00087       void setCrossSectionalArea(double A_) { A = A_; }
00088       void setMomentInertia(double I0_,double I1_,double I2_) { I0 = I0_; I1 = I1_; I2 = I2_; }
00089       void setDensity(double rho_) { rho = rho_; }
00090       void setCurlRadius(double rc1_,double rc2_);
00091 #ifdef HAVE_OPENMBVCPPINTERFACE
00092       void setOpenMBVSpineExtrusion(const boost::shared_ptr<OpenMBV::SpineExtrusion> &body) { openMBVBody=body; }
00093 #endif
00094       int getNumberElements(){ return Elements; }
00095       double getLength(){ return L; }
00096       /***************************************************/
00097 
00102       fmatvec::Vec computeState(double x);
00103 
00107       void initInfo();
00108 
00113       void initRelaxed(double alpha);
00114 
00115     private:
00119       int Elements;
00120 
00124       double L;
00125 
00129       double l0;
00130 
00134       double E;
00135 
00139       double G;
00140 
00144       double A;
00145 
00149       double I0;
00150 
00154       double I1;
00155 
00159       double I2;
00160 
00164       double rho;
00165 
00169       double rc1;
00170 
00174       double rc2;
00175 
00179       bool openStructure;
00180 
00184       bool initialised;
00185 
00189       void initM();
00190 
00197       void BuildElement(const double& sGlobal, double& sLocal, int& currentElement);
00198 
00202       FlexibleBody1s33ANCF(const FlexibleBody1s33ANCF&);
00203 
00207       FlexibleBody1s33ANCF& operator=(const FlexibleBody1s33ANCF&);
00208   };
00209 
00210   inline void FlexibleBody1s33ANCF::setCurlRadius(double rc1_, double rc2_) {
00211     rc1 = rc1_;
00212     rc2 = rc2_;
00213     if(initialised)
00214       for(int i = 0; i < Elements; i++)
00215         static_cast<FiniteElement1s33ANCF*>(discretization[i])->setCurlRadius(rc1,rc2);
00216   }
00217 
00218 }
00219 #endif /* _FLEXIBLE_BODY_1S_33_ANCF_H_ */
00220