All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 
35 namespace MBSim {
36  class ContourFrame;
37 }
38 
39 namespace MBSimFlexibleBody {
40 
54  class NurbsDisk2s : public Contour2s {
55  public:
60  NurbsDisk2s(const std::string &name);
61 
65  virtual ~NurbsDisk2s();
66 
67  /* INHERITED INTERFACE OF ELEMENT */
68  virtual std::string getType() const { return "NurbsDisk2s"; }
69  /***************************************************/
70 
71  void init(InitStage stage);
72 
73  virtual MBSim::ContourFrame* createContourFrame(const std::string &name="P");
74 
75  virtual fmatvec::Vec3 evalPosition(const fmatvec::Vec2 &zeta);
76  virtual fmatvec::Vec3 evalWs(const fmatvec::Vec2 &zeta);
77  virtual fmatvec::Vec3 evalWt(const fmatvec::Vec2 &zeta);
78  virtual fmatvec::Vec3 evalWu(const fmatvec::Vec2 &zeta) { return evalWs(zeta); }
79  virtual fmatvec::Vec3 evalWv(const fmatvec::Vec2 &zeta) { return evalWt(zeta); }
80  virtual fmatvec::Vec3 evalWn(const fmatvec::Vec2 &zeta);
81 
82  virtual bool isZetaOutside(const fmatvec::Vec2 &zeta) { return zeta(0) < etaNodes[0] or zeta(0) > etaNodes[etaNodes.size()-1]; }
83 
84  void updatePositions(MBSim::ContourFrame *frame);
85  void updateVelocities(MBSim::ContourFrame *frame);
86  void updateAccelerations(MBSim::ContourFrame *frame);
87  void updateJacobians(MBSim::ContourFrame *frame, int j=0);
88  void updateGyroscopicAccelerations(MBSim::ContourFrame *frame);
89 
90  fmatvec::Vec3 evalPosition();
91  fmatvec::SqrMat3 evalOrientation();
92 
93  virtual void plot();
94 
95  virtual MBSim::ContactKinematics * findContactPairingWith(std::string type0, std::string type1) { return findContactPairingFlexible(type0.c_str(), type1.c_str()); }
96 
97  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, MBSim::tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
98  openMBVNurbsDisk = OpenMBV::ObjectFactory::create<OpenMBV::NurbsDisk>();
99  }
100 
101 // /**
102 // * \brief initialize NURBS disk
103 // * \param stage of initialisation
104 // */
105 // void initContourFromBody(InitStage stage);
106 
112  fmatvec::Vec transformCW(const fmatvec::Vec& WrPoint);
113 
120  fmatvec::Mat computeDirectionalDerivatives(const double &radius, const double &phi, const int &deg);
121 
127  fmatvec::Mat computeCurvatures(const double &radius, const double &phi);
128 
133  void computeUVector(const int NbPts);
134 
139  void computeVVector(const int NbPts);
140 
144  void computeSurface();
145 
150 
155 
161  fmatvec::Vec getControlPoints(const int u, const int v);
162 
167 
172 
177  int testInsideBounds(const fmatvec::Vec &s);
178 
184  double computeError(const fmatvec::Vec &Vec1, const fmatvec::Vec &Vec2);
185 
186  protected:
190  int RefDofs;
191 
195  int nj, nr;
196 
200  int degU, degV;
201 
205  double Ri, Ra;
206 
207  std::shared_ptr<OpenMBV::NurbsDisk> openMBVNurbsDisk;
208  double drawDegree;
209 
213  PlNurbsSurfaced *Surface; // an homogenous surface with accuracy of calculation of double (HSurface<double,3>)
214 
218  PlNurbsSurfaced *SurfaceVelocities;
219 
223  std::vector<PlNurbsSurfaced> SurfaceJacobiansOfTranslation; // size = number of generalized coordinates
224 
228  std::vector<PlNurbsSurfaced> SurfaceJacobiansOfRotation; // size = number of generalized coordinates
229 
233  PLib::Vector<double> *uvec; // nurbs++ needs this vector
234  PLib::Vector<double> *uVec; // knot-vector for azimuthal direction
235  PLib::Vector<double> *vvec; // nurbs++ needs this vector
236  PLib::Vector<double> *vVec; // knot-vector for radial direction
237  };
238 
239 }
240 
241 #endif /* NURBSDISK2S_H_ */
double Ri
inner and outer radius
Definition: nurbs_disk_2s.h:205
PlNurbsSurfaced * SurfaceVelocities
interpolated velocities of the surface-points
Definition: nurbs_disk_2s.h:218
void computeSurface()
interpolates the surface with node-data from body
Definition: nurbs_disk_2s.cc:360
int degU
interpolation degree azimuthal and radial
Definition: nurbs_disk_2s.h:200
std::vector< PlNurbsSurfaced > SurfaceJacobiansOfRotation
interpolated Jacobians of Rotation on the surface
Definition: nurbs_disk_2s.h:228
NurbsDisk2s(const std::string &name)
constructor
Definition: nurbs_disk_2s.cc:40
PLib::Vector< double > * uvec
knot vectors, used for the U und V coordinates of the surface
Definition: nurbs_disk_2s.h:233
int nj
number of elements in azimuthal and radial direction
Definition: nurbs_disk_2s.h:195
2s flexible
Definition: nurbs_disk_2s.h:54
void computeSurfaceJacobians()
interpolates the Jacobians of translation of the surface with the node-data from the body ...
Definition: nurbs_disk_2s.cc:462
fmatvec::Vec transformCW(const fmatvec::Vec &WrPoint)
initialize NURBS disk
Definition: nurbs_disk_2s.cc:285
std::vector< PlNurbsSurfaced > SurfaceJacobiansOfTranslation
interpolated Jacobians of Translation on the surface
Definition: nurbs_disk_2s.h:223
double computeError(const fmatvec::Vec &Vec1, const fmatvec::Vec &Vec2)
Definition: nurbs_disk_2s.cc:539
fmatvec::Vec getVVector()
Definition: nurbs_disk_2s.cc:520
PlNurbsSurfaced * Surface
interpolated surface of the contour
Definition: nurbs_disk_2s.h:213
void computeUVector(const int NbPts)
computes the U vector of the surface for a closed interpolation
Definition: nurbs_disk_2s.cc:318
void computeVVector(const int NbPts)
computes the V-vector of the surface for an open interpolation
Definition: nurbs_disk_2s.cc:337
fmatvec::Mat computeCurvatures(const double &radius, const double &phi)
Definition: nurbs_disk_2s.cc:314
basic contour described by two contour parameters
Definition: contour2s.h:33
int RefDofs
number of reference dofs of the flexible body
Definition: nurbs_disk_2s.h:190
fmatvec::Mat computeDirectionalDerivatives(const double &radius, const double &phi, const int &deg)
Definition: nurbs_disk_2s.cc:289
int testInsideBounds(const fmatvec::Vec &s)
Definition: nurbs_disk_2s.cc:529
virtual ~NurbsDisk2s()
destructor
Definition: nurbs_disk_2s.cc:49
fmatvec::Vec getUVector()
Definition: nurbs_disk_2s.cc:511
void computeSurfaceVelocities()
interpolates the velocities of the surface with the node-data from the body
Definition: nurbs_disk_2s.cc:444
fmatvec::Vec getControlPoints(const int u, const int v)
Definition: nurbs_disk_2s.cc:501

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML