mbsimflexiblebody  4.0.0
nurbs_curve_1s.h
00001 /* Copyright (C) 2004-2012 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 NurbsCurve1s_H_
00021 #define NurbsCurve1s_H_
00022 
00023 #include "fmatvec/fmatvec.h"
00024 #include "mbsim/mbsim_event.h"
00025 #include "mbsim/contours/contour1s.h"
00026 
00027 #include <mbsim/numerics/nurbs/nurbs_curve.h>
00028 
00029 namespace MBSimFlexibleBody {
00030 
00040   class NurbsCurve1s : public MBSim::Contour1s {
00041     public:
00046       NurbsCurve1s(const std::string &name);
00047 
00051       virtual ~NurbsCurve1s();
00052 
00053       /* INHERITED INTERFACE OF ELEMENT */
00054       virtual std::string getType() const {
00055         return "NurbsCurve1s";
00056       }
00057       /***************************************************/
00058 
00059       /* INHERITED INTERFACE OF CONTOURCONTINUUM */
00060       virtual void computeRootFunctionPosition(MBSim::ContourPointData &cp) {
00061         throw MBSim::MBSimError("ERROR(NurbsCurve1s::computeRootFunctionPosition): Not implemented!");
00062       }
00063       virtual void computeRootFunctionFirstTangent(MBSim::ContourPointData &cp) {
00064         throw MBSim::MBSimError("ERROR(NurbsCurve1s::computeRootFunctionFirstTangent): Not implemented!");
00065       }
00066       virtual void computeRootFunctionNormal(MBSim::ContourPointData &cp) {
00067         throw MBSim::MBSimError("ERROR(NurbsCurve1s::computeRootFunctionNormal): Not implemented!");
00068       }
00069       virtual void computeRootFunctionSecondTangent(MBSim::ContourPointData &cp) {
00070         throw MBSim::MBSimError("ERROR(NurbsCurve1s::computeRootFunctionSecondTangent): Not implemented!");
00071       }
00072       /***************************************************/
00073 
00074       /* INHERITED INTERFACE OF CONTOUR */
00075       virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::Frame::Frame::Feature ff);
00076       virtual void updateJacobiansForFrame(MBSim::ContourPointData &cp, int j = 0);
00077       virtual MBSim::ContactKinematics *findContactPairingWith(std::string type0, std::string type1) {
00078         throw MBSim::MBSimError("ERROR(NurbsCurve1s::findContactPairingWith): Not implemented!");
00079       }
00080       /***************************************************/
00081 
00082       /* GETTER / SETTER */
00083       void setNormalRotationGrid(fmatvec::Vec normal_) {
00084         normalRotationGrid = normal_(0,2);
00085       }
00086       /***************************************************/
00087 
00092       void initContourFromBody(InitStage stage);
00093 
00097       void computeCurveTranslations(bool update = false);
00098 
00102       void computeCurveVelocities(bool update = false);
00103 
00107       void computeCurveAngularVelocities(bool update = false);
00108 
00114       void computeCurveJacobians(bool trans = true, bool rot = true, bool update = false);
00115 
00116     protected:
00120       int Elements;
00121 
00125       int qSize;
00126 
00130       bool openStructure;
00131 
00135       double L;
00136 
00140       int degU;
00141 
00145       MBSim::NurbsCurve curveTranslations;
00146 
00150       MBSim::NurbsCurve curveVelocities;
00151 
00155       MBSim::NurbsCurve curveAngularVelocities;
00156 
00160       fmatvec::Vec3 normalRotationGrid;
00161 
00165       std::vector<MBSim::ContourPointData> jacobiansTrans; // size = number of interpolation points
00166 
00170       std::vector<MBSim::ContourPointData> jacobiansRot; // size = number of interpolation points
00171 
00175       std::vector<MBSim::NurbsCurve> CurveJacobiansOfTranslation; // size = number of generalized coordinates
00176 
00180       std::vector<MBSim::NurbsCurve> CurveJacobiansOfRotation; // size = number of generalized coordinates
00181 
00182   };
00183 
00184 }
00185 
00186 #endif /* NurbsCurve1s_H_ */
00187