mbsimflexiblebody  4.0.0
flexible_band.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  */
00019 
00020 #ifndef _FLEXIBLE_BAND_H_
00021 #define _FLEXIBLE_BAND_H_
00022 
00023 #include "mbsimFlexibleBody/contours/contour1s_flexible.h"
00024 #include "mbsim/contour.h"
00025 
00026 #include "mbsimFlexibleBody/contours/contour_1s_neutral_factory.h"
00027 
00028 namespace MBSimFlexibleBody {
00029 
00037   class FlexibleBand : public Contour1sFlexible {
00038     public:
00043       FlexibleBand(const std::string& name);
00044 
00045       /* INHERITED INTERFACE OF ELEMENT */
00046       virtual std::string getType() const {
00047         return "FlexibleBand";
00048       }
00049       /***************************************************/
00050 
00051       /* INHERITED INTERFACE OF CONTOUR */
00052       virtual void updateKinematicsForFrame(MBSim::ContourPointData& cp, MBSim::Frame::Frame::Feature ff);   
00053       virtual void updateJacobiansForFrame(MBSim::ContourPointData &cp, int j = 0);
00054       virtual fmatvec::Vec3 computePosition(MBSim::ContourPointData &cp) {
00055         updateKinematicsForFrame(cp, MBSim::Frame::position_cosy);
00056         return cp.getFrameOfReference().getPosition();
00057       }
00058       virtual fmatvec::Vec3 computeVelocity(MBSim::ContourPointData &cp) {
00059         updateKinematicsForFrame(cp, MBSim::Frame::velocity_cosy);
00060         return cp.getFrameOfReference().getVelocity();
00061       }
00062       /***************************************************/
00063 
00064       /* INHERITED INTERFACE OF CONTOURCONTINUUM */
00065       virtual void computeRootFunctionPosition(MBSim::ContourPointData &cp) { Contour1sFlexible::updateKinematicsForFrame(cp, MBSim::Frame::position); }
00066       virtual void computeRootFunctionFirstTangent(MBSim::ContourPointData &cp) { Contour1sFlexible::updateKinematicsForFrame(cp, MBSim::Frame::firstTangent); }
00067       /***************************************************/
00068 
00069       /* GETTER / SETTER */
00070       void setCn(const fmatvec::Vec& Cn_);
00071       void setWidth(double width_);
00072 
00077       void setNormalDistance(double nDist_);
00078 
00083       double getNormalDistance() {
00084         return nDist;
00085       }
00086       double getWidth() const;
00087       /***************************************************/
00088 
00089     protected:
00093       fmatvec::Vec Cn;
00094 
00098       double width;
00099 
00103       double nDist;
00104 
00105   };
00106 
00107   inline void FlexibleBand::setWidth(double width_) {
00108     width = width_;
00109   }
00110   inline void FlexibleBand::setNormalDistance(double nDist_) {
00111     nDist = nDist_;
00112   }
00113   inline double FlexibleBand::getWidth() const {
00114     return width;
00115   }
00116 
00117 }
00118 
00119 #endif /* _FLEXIBLE_BAND_H_ */
00120