mbsimflexiblebody  4.0.0
superelement_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 _SUPERELEMENT_LINEAR_EXTERNAL_H_
00022 #define _SUPERELEMENT_LINEAR_EXTERNAL_H_
00023 
00024 #include "fmatvec/fmatvec.h"
00025 #include "mbsim/discretization_interface.h"
00026 #include "mbsim/mbsim_event.h"
00027 #include "mbsim/contour_pdata.h"
00028 
00029 namespace MBSimFlexibleBody {
00030 
00038   class SuperElementLinearExternal : public MBSim::DiscretizationInterface {
00039     public:
00040       SuperElementLinearExternal();
00041           void init(MBSim::Element::InitStage stage);
00042 
00046           void setM(const fmatvec::SymMat &M_);
00047           
00051           void setK(const fmatvec::SqrMat &K_);
00052           
00059           void setProportionalDamping(double alpha_,double beta_) { alpha=alpha_; beta=beta_; }
00060 
00061       const fmatvec::SymMat& getM() const { return M; }
00062       const fmatvec::Vec&    geth() const { return h; }
00063 
00064       const fmatvec::SqrMat& getdhdq() const { return Dhq; }    
00065       const fmatvec::SqrMat& getdhdu() const { return Dhqp; }
00066           int getqSize() const { return K.size(); }
00067           int getuSize() const { return M.size(); }
00068 
00069       void computeM(const fmatvec::Vec& qElement) {}
00073       void computeh(const fmatvec::Vec& qElement,const fmatvec::Vec& uElement) { h = - K * qElement - D * uElement; }
00074       void computedhdz(const fmatvec::Vec& qElement,const fmatvec::Vec& uElement) {}
00075       double computeKineticEnergy(const fmatvec::Vec& q,const fmatvec::Vec& u) { return 0.5*u.T()*M*u;}
00076       double computeGravitationalEnergy(const fmatvec::Vec& q) { return 0.0;}
00077       double computeElasticEnergy(const fmatvec::Vec& q) { return 0.5*q.T()*K*q;}
00078 
00079       fmatvec::Vec computeVelocity(const fmatvec::Vec&q,const fmatvec::Vec&u,const MBSim::ContourPointData& cp) { return computeJacobianOfMotion(q,cp).T()*u;}
00080       fmatvec::Vec computeAngularVelocity(const fmatvec::Vec&q,const fmatvec::Vec&u,const MBSim::ContourPointData& cp) { return computeJacobianOfMotion(q,cp).T()*u;}
00081       fmatvec::Vec computePosition(const fmatvec::Vec&q,const MBSim::ContourPointData& cp);
00082       fmatvec::SqrMat computeOrientation(const fmatvec::Vec&q,const MBSim::ContourPointData& cp) { throw MBSim::MBSimError("(SuperElementLinearExternal::computeOrientation): Not Implemented");}
00083       fmatvec::Mat computeJacobianOfMotion(const fmatvec::Vec&q,const MBSim::ContourPointData& cp);
00084 
00085           MBSim::ContourPointData addInterface(fmatvec::Mat J_, fmatvec::Vec KrP_);
00086     
00087     protected:
00089       fmatvec::SymMat M;
00091       fmatvec::Vec h;
00093       fmatvec::SqrMat K;
00095       fmatvec::SqrMat D; 
00097       double alpha;
00099       double beta;
00101       fmatvec::SqrMat Dhq, Dhqp;
00103       std::vector<fmatvec::Mat> J;
00105       std::vector<fmatvec::Vec> KrP;
00106   };
00107 
00108 }
00109 
00110 #endif /* _SUPERELEMENT_LINEAR_EXTERNAL_H_ */
00111