mbsimflexiblebody  4.0.0
MBSim Flexible Body Module
nurbs_disk_2s.h
1/* Copyright (C) 2004-2015 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: thorsten.schindler@mytum.de
18 */
19
20#ifndef NURBSDISK2S_H_
21#define NURBSDISK2S_H_
22
23#include "mbsimFlexibleBody/contours/contour2s.h"
24#include "mbsimFlexibleBody/frames/node_frame.h"
25#include "mbsimFlexibleBody/utils/contact_utils.h"
26
27#include "openmbvcppinterface/nurbsdisk.h"
28#include "mbsim/utils/boost_parameters.h"
29#include <mbsim/utils/openmbv_utils.h>
30
31#include "nurbs++/nurbs.h"
32#include "nurbs++/nurbsS.h"
33#include "nurbs++/vector.h"
34
35namespace MBSim {
36 class ContourFrame;
37}
38
39namespace MBSimFlexibleBody {
40
54 class NurbsDisk2s : public Contour2s {
55 public:
60 NurbsDisk2s(const std::string &name);
61
65 ~NurbsDisk2s() override;
66
67 /* INHERITED INTERFACE OF ELEMENT */
68 /***************************************************/
69
70 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
71
72 MBSim::ContourFrame* createContourFrame(const std::string &name="P") override;
73
74 fmatvec::Vec3 evalPosition(const fmatvec::Vec2 &zeta) override;
75 fmatvec::Vec3 evalWs(const fmatvec::Vec2 &zeta) override;
76 fmatvec::Vec3 evalWt(const fmatvec::Vec2 &zeta) override;
77 fmatvec::Vec3 evalWu(const fmatvec::Vec2 &zeta) override { return evalWs(zeta); }
78 fmatvec::Vec3 evalWv(const fmatvec::Vec2 &zeta) override { return evalWt(zeta); }
79 fmatvec::Vec3 evalWn(const fmatvec::Vec2 &zeta) override;
80
81 bool isZetaOutside(const fmatvec::Vec2 &zeta) override { return zeta(0) < etaNodes[0] or zeta(0) > etaNodes[etaNodes.size()-1]; }
82
83 void updatePositions(MBSim::Frame *frame) override;
84 void updateVelocities(MBSim::Frame *frame) override;
85 void updateAccelerations(MBSim::Frame *frame) override;
86 void updateJacobians(MBSim::Frame *frame, int j=0) override;
87 void updateGyroscopicAccelerations(MBSim::Frame *frame) override;
88
89 fmatvec::Vec3 evalPosition();
90 fmatvec::SqrMat3 evalOrientation();
91
92 void plot() override;
93
94 MBSim::ContactKinematics * findContactPairingWith(const std::type_info &type0, const std::type_info &type1) override { return findContactPairingFlexible(type0, type1); }
95
96 BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, MBSim::tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
97 openMBVNurbsDisk = OpenMBV::ObjectFactory::create<OpenMBV::NurbsDisk>();
98 }
99
100// /**
101// * \brief initialize NURBS disk
102// * \param stage of initialisation
103// */
104// void initContourFromBody(InitStage stage);
105
111 fmatvec::Vec transformCW(const fmatvec::Vec& WrPoint);
112
119 fmatvec::Mat computeDirectionalDerivatives(const double &radius, const double &phi, const int &deg);
120
126 fmatvec::Mat computeCurvatures(const double &radius, const double &phi);
127
132 void computeUVector(const int NbPts);
133
138 void computeVVector(const int NbPts);
139
143 void computeSurface();
144
149
154
160 fmatvec::Vec getControlPoints(const int u, const int v);
161
165 fmatvec::Vec getUVector();
166
170 fmatvec::Vec getVVector();
171
176 int testInsideBounds(const fmatvec::Vec &s);
177
183 double computeError(const fmatvec::Vec &Vec1, const fmatvec::Vec &Vec2);
184
185 protected:
190
194 int nj, nr;
195
199 int degU, degV;
200
204 double Ri, Ra;
205
206 std::shared_ptr<OpenMBV::NurbsDisk> openMBVNurbsDisk;
207 double drawDegree;
208
212 PlNurbsSurfaced *Surface; // an homogenous surface with accuracy of calculation of double (HSurface<double,3>)
213
217 PlNurbsSurfaced *SurfaceVelocities;
218
222 std::vector<PlNurbsSurfaced> SurfaceJacobiansOfTranslation; // size = number of generalized coordinates
223
227 std::vector<PlNurbsSurfaced> SurfaceJacobiansOfRotation; // size = number of generalized coordinates
228
232 PLib::Vector<double> *uvec; // nurbs++ needs this vector
233 PLib::Vector<double> *uVec; // knot-vector for azimuthal direction
234 PLib::Vector<double> *vvec; // nurbs++ needs this vector
235 PLib::Vector<double> *vVec; // knot-vector for radial direction
236 };
237
238}
239
240#endif /* NURBSDISK2S_H_ */
basic contour described by two contour parameters
Definition: contour2s.h:33
2s flexible
Definition: nurbs_disk_2s.h:54
int RefDofs
number of reference dofs of the flexible body
Definition: nurbs_disk_2s.h:189
int testInsideBounds(const fmatvec::Vec &s)
Definition: nurbs_disk_2s.cc:511
PLib::Vector< double > * uvec
knot vectors, used for the U und V coordinates of the surface
Definition: nurbs_disk_2s.h:232
fmatvec::Vec getControlPoints(const int u, const int v)
Definition: nurbs_disk_2s.cc:483
void computeSurfaceVelocities()
interpolates the velocities of the surface with the node-data from the body
Definition: nurbs_disk_2s.cc:437
PlNurbsSurfaced * SurfaceVelocities
interpolated velocities of the surface-points
Definition: nurbs_disk_2s.h:217
fmatvec::Mat computeCurvatures(const double &radius, const double &phi)
Definition: nurbs_disk_2s.cc:308
std::vector< PlNurbsSurfaced > SurfaceJacobiansOfRotation
interpolated Jacobians of Rotation on the surface
Definition: nurbs_disk_2s.h:227
double computeError(const fmatvec::Vec &Vec1, const fmatvec::Vec &Vec2)
Definition: nurbs_disk_2s.cc:521
void computeVVector(const int NbPts)
computes the V-vector of the surface for an open interpolation
Definition: nurbs_disk_2s.cc:331
fmatvec::Vec transformCW(const fmatvec::Vec &WrPoint)
transformation cartesian to cylinder system
Definition: nurbs_disk_2s.cc:279
std::vector< PlNurbsSurfaced > SurfaceJacobiansOfTranslation
interpolated Jacobians of Translation on the surface
Definition: nurbs_disk_2s.h:222
void computeSurface()
interpolates the surface with node-data from body
Definition: nurbs_disk_2s.cc:354
fmatvec::Mat computeDirectionalDerivatives(const double &radius, const double &phi, const int &deg)
Definition: nurbs_disk_2s.cc:283
fmatvec::Vec getVVector()
Definition: nurbs_disk_2s.cc:502
double Ri
inner and outer radius
Definition: nurbs_disk_2s.h:204
NurbsDisk2s(const std::string &name)
constructor
Definition: nurbs_disk_2s.cc:40
int nj
number of elements in azimuthal and radial direction
Definition: nurbs_disk_2s.h:194
PlNurbsSurfaced * Surface
interpolated surface of the contour
Definition: nurbs_disk_2s.h:212
void computeUVector(const int NbPts)
computes the U vector of the surface for a closed interpolation
Definition: nurbs_disk_2s.cc:312
~NurbsDisk2s() override
destructor
Definition: nurbs_disk_2s.cc:49
fmatvec::Vec getUVector()
Definition: nurbs_disk_2s.cc:493
void computeSurfaceJacobians()
interpolates the Jacobians of translation of the surface with the node-data from the body
Definition: nurbs_disk_2s.cc:454
int degU
interpolation degree azimuthal and radial
Definition: nurbs_disk_2s.h:199
std::string name