|
mbsimflexiblebody
4.0.0
|
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_LINEAR_EXTERNAL_FFR_H_ 00021 #define _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_ 00022 00023 #include <iostream> 00024 #include <fstream> 00025 #include <sstream> 00026 #include <string> 00027 #include <stdlib.h> 00028 00029 #include "mbsim/mbsim_event.h" 00030 00031 #include <mbsim/frame.h> 00032 00033 #include "mbsimFlexibleBody/flexible_body.h" 00034 #include "mbsimFlexibleBody/flexible_body/finite_elements/finite_element_linear_external_lumped_node.h" 00035 00036 #include <mbsimFlexibleBody/node_frame.h> 00037 00038 //namespace unitTest{ 00039 // class linearExternalFFRTest; 00040 //} 00041 00042 namespace MBSimFlexibleBody { 00043 00050 class FlexibleBodyLinearExternalFFR : public FlexibleBodyContinuum<fmatvec::Vec> /*, public FlexibleContourBody */{ 00051 public: 00056 FlexibleBodyLinearExternalFFR(const std::string &name, const bool &DEBUG_); 00057 00061 virtual ~FlexibleBodyLinearExternalFFR(); 00062 00063 /* INHERITED INTERFACE OF FLEIBLE BODY CONTOUR */ 00064 virtual int getNumberElements() const; 00065 virtual double getLength() const; 00066 virtual bool isOpenStructure() const; 00067 /***************************************************/ 00068 00069 /* INHERITED INTERFACE OF FLEXIBLE BODY CONTINUUM */ 00070 using FlexibleBodyContinuum<fmatvec::Vec>::addFrame; 00071 /***************************************************/ 00072 00073 /* INHERITED INTERFACE OF OBJECTINTERFACE */ 00074 virtual void updateM(double t, int k = 0); 00075 /***************************************************/ 00076 00077 /* INHERITED INTERFACE OF FLEXIBLE BODY */ 00078 virtual void BuildElements(); 00079 virtual void GlobalVectorContribution(int CurrentElement, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec); 00080 virtual void GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat); 00081 virtual void GlobalMatrixContribution(int CurrentElement, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat); 00082 virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Feature ff, MBSim::Frame *frame = 0); 00083 virtual void updateKinematicsAtNode(NodeFrame *frame, MBSim::Frame::Feature ff); 00084 virtual void updateJacobiansAtNode(NodeFrame * frame); 00085 virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame = 0); 00086 virtual void updateh(double t, int k = 0); 00087 virtual void updateStateDependentVariables(double t); 00088 virtual void updateJacobians(double t, int k); 00089 /***************************************************/ 00090 00091 /* INHERITED INTERFACE OF OBJECT */ 00092 virtual void init(InitStage stage); 00093 virtual void calcqSize(); 00094 virtual void calcuSize(int j); 00095 /***************************************************/ 00096 00097 /* INHERITED INTERFACE OF ELEMENT */ 00098 virtual std::string getType() const { 00099 return "FlexibleBodyLinearExternalFFR"; 00100 } 00101 /***************************************************/ 00102 00103 /* GETTER AND SETTER */ 00104 void setNumberOfModes(int nf_) { 00105 nf = nf_; 00106 } 00107 00108 int getNumberModes() const { 00109 return nf; 00110 } 00111 00112 MBSim::Frame * getFloatingFrameOfReference() { 00113 return FFR; 00114 } 00115 00116 const fmatvec::SqrMat3& getOrientationOfFFR() const { 00117 return A; 00118 } 00119 00120 const fmatvec::SqrMat3& getGBarOfFFR() const { 00121 return G_bar; 00122 } 00123 00124 const fmatvec::Vec3 getModeShapeVector(int node, int column) const; 00125 00129 void readFEMData(std::string inFilePath, const bool millimeterUnits, bool output = false); 00130 00131 #ifdef HAVE_OPENMBVCPPINTERFACE 00132 void enableFramePlot(double size = 1e-3, fmatvec::VecInt numbers = fmatvec::VecInt(0)); 00133 #endif 00134 00135 protected: 00139 void initM(int k = 0); 00140 00144 void initQv(); 00145 00149 void updateQv(); 00150 00154 void computeShapeIntegrals(); 00155 00159 void updateAGbarGbardot(); 00160 00164 void updateFFRFrame(); 00165 00169 int nNodes; 00170 00174 MBSim::Frame * FFR; 00175 00179 fmatvec::Vec3 I_1; 00180 00184 fmatvec::SymMat3 I_kl; 00185 00189 fmatvec::Mat S_bar; 00190 00194 fmatvec::SqrMat S_kl_bar[3][3]; 00195 00199 fmatvec::RowVec I_kl_bar[3][3]; 00200 00204 fmatvec::SymMat3 I_ThetaTheta_bar; 00205 00209 fmatvec::Mat I_ThetaF_bar; 00210 00214 fmatvec::SymMat K; 00215 00219 fmatvec::SymMat KFull; 00220 00224 fmatvec::SqrMat3 G_bar; 00225 00229 fmatvec::SqrMat3 G_bar_Dot; 00230 00234 fmatvec::SqrMat3 A; 00235 00239 fmatvec::SymMat M_FF; 00240 00244 fmatvec::Vec Qv; 00245 00249 fmatvec::Vec mij; 00250 00254 fmatvec::Mat phiFull; 00255 00259 fmatvec::Mat phi; 00260 00264 std::vector<fmatvec::Vec3> u0; 00265 00269 int nf; 00270 00274 bool openStructure; 00275 00279 bool DEBUG; 00280 00284 bool fistIterFlag; 00285 }; 00286 00287 inline void FlexibleBodyLinearExternalFFR::BuildElements() { 00288 // THROW_MBSIMERROR("(FlexibleBodyLinearExternalFFR::BuildElements(): Not implemented"); 00289 } 00290 00291 inline void FlexibleBodyLinearExternalFFR::GlobalVectorContribution(int CurrentElement, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec) { 00292 THROW_MBSIMERROR("(FlexibleBodyLinearExternalFFR::GlobalVectorContribution(): Not implemented!"); 00293 } 00294 00295 inline void FlexibleBodyLinearExternalFFR::GlobalMatrixContribution(int CurrentElement, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat) { 00296 THROW_MBSIMERROR("(FlexibleBodyLinearExternalFFR::GlobalMatrixContribution(): Not implemented!"); 00297 } 00298 00299 inline void FlexibleBodyLinearExternalFFR::GlobalMatrixContribution(int CurrentElement, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat) { 00300 THROW_MBSIMERROR("(FlexibleBodyLinearExternalFFR::GlobalMatrixContribution(): Not implemented!"); 00301 } 00302 00303 inline int FlexibleBodyLinearExternalFFR::getNumberElements() const { 00304 return nNodes; 00305 } 00306 inline double FlexibleBodyLinearExternalFFR::getLength() const { 00307 THROW_MBSIMERROR("(FlexibleBodyLinearExternalFFR::getLength(): Not implemented!"); 00308 } 00309 inline bool FlexibleBodyLinearExternalFFR::isOpenStructure() const { 00310 return openStructure; 00311 } 00312 00313 } 00314 00315 #endif /* _FLEXIBLE_BODY_LINEAR_EXTERNAL_FFR_H_ */ 00316
1.8.0