mbsimflexiblebody  4.0.0
flexible_body_linear_external.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_LINEAR_EXTERNAL_H_
00022 #define _FLEXIBLE_BODY_LINEAR_EXTERNAL_H_
00023 
00024 #include "mbsimFlexibleBody/flexible_body.h"
00025 #include "mbsim/mbsim_event.h"
00026 #include <fstream>
00027 
00028 namespace MBSimFlexibleBody {
00029 
00030   class ContourInterpolation;
00031 
00043   class FlexibleBodyLinearExternal : public FlexibleBody {
00044     public:
00049       FlexibleBodyLinearExternal(const std::string &name);
00050 
00054       virtual ~FlexibleBodyLinearExternal() {}
00055 
00056       /* INHERITED INTERFACE OF ELEMENT */
00057       virtual std::string getType() const { return "FlexibleBodyLinearExternal"; }
00058       /***************************************************/
00059 
00060       /* INHERITED INTERFACE OF OBJECT */
00061       virtual void init(InitStage stage) { new MBSim::MBSimError("ERROR(FlexibleBodyLinearExternal::init): Not implemented!"); }
00062       virtual void facLLM() {}
00063       /***************************************************/
00064       
00065       /* INHERITED INTERFACE OF FLEXIBLEBODY */
00066       virtual void BuildElements() { new MBSim::MBSimError("ERROR(FlexibleBodyLinearExternal::BuildElements): Not implemented!"); } 
00067       virtual void GlobalVectorContribution(int n, const fmatvec::Vec& locVec, fmatvec::Vec& gloVec);
00068       virtual void GlobalMatrixContribution(int n, const fmatvec::Mat& locMat, fmatvec::Mat& gloMat);
00069       virtual void GlobalMatrixContribution(int n, const fmatvec::SymMat& locMat, fmatvec::SymMat& gloMat);
00076       virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Feature ff, MBSim::Frame *frame=0);
00077       virtual void updateJacobiansForFrame(MBSim::ContourPointData &data, MBSim::Frame *frame=0);
00078       /***************************************************/
00079 
00087       void readMassMatrix(const std::string &massfilename); 
00088 
00093       void setMassMatrix(const fmatvec::SymMat &mat); 
00094 
00099       void readStiffnessMatrix(const std::string &stiffnessfilename); 
00100 
00105       void setStiffnessMatrix(const fmatvec::SqrMat &mat); 
00106 
00113           void setProportionalDamping(const double &a, const double &b);
00114 
00115 //      /*! plot parameters of "BodyFlexibleLinearExternal"
00116 //      */
00117 //      void plotParameters();
00118 
00119       using FlexibleBody::addFrame;
00128 //      void addFrame(const std::string &name, const std::string &jacobifilename);
00129 
00136 //      void addFrame(const std::string &name, const fmatvec::Mat &J_, const fmatvec::Vec &r_);
00137 
00143 //      void addContour(Contour *contour, const std::string &jacobifilename);
00144 
00151 //      void addContour(Contour *contour, const fmatvec::Mat &J_, const fmatvec::Vec &r_);
00152 
00154 //      void addContourInterpolation(ContourInterpolation *contour);
00155 
00158       void setWrON00(const fmatvec::Vec &WrON00_) {WrON00 = WrON00_;}
00159 
00160       /* geerbt */
00161       fmatvec::Mat computeJacobianMatrix(const MBSim::ContourPointData &CP);
00162 
00163     protected:
00165       int nContours;
00166           
00168       std::vector<MBSim::ContourPointData> contourType;
00169 
00171       fmatvec::Vec WrON00;
00172 
00178       void updateStateDependentVariables(double t);
00185       void updateContours(double t);
00186 
00191       MBSim::ContourPointData addInterface(const std::string &jacbifilename);
00197       MBSim::ContourPointData addInterface(const fmatvec::Mat &J, const fmatvec::Vec &r);
00198 
00199       /* empty function since mass, damping and stiffness matrices are constant !!! */
00200       void updateJh_internal(double t);
00201    };
00202 
00203 }
00204 
00205 #endif /* _FLEXIBLE_BODY_LINEAR_EXTERNAL_H_ */
00206