mbsim  4.0.0
MBSim Kernel
plate_polynomialfrustum.h
1/* Copyright (C) 2004-2012 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: martin.o.foerg@googlemail.com
18 */
19
20#ifndef AREA_POLYNOMIALFRUSTUM_H_
21#define AREA_POLYNOMIALFRUSTUM_H_
22
23#include "contact_kinematics.h"
24
25#include <mbsim/contours/polynomial_frustum.h>
26#include <mbsim/contours/plate.h>
27#include <mbsim/numerics/nonlinear_algebra/multi_dimensional_newton_method.h>
28#include <mbsim/contact_kinematics/point_polynomialfrustum.h>
29
30namespace MBSim {
31
35 class edgePolyFrustum : public Function<fmatvec::Vec(fmatvec::Vec)> {
36 public:
40 edgePolyFrustum(const PolynomialFrustum * frustum_);
41
45 ~edgePolyFrustum() override;
46
50 void setAdir(const fmatvec::Vec3 & A_, const fmatvec::Vec3 & dir_);
51
52 fmatvec::Vec operator()(const fmatvec::Vec &xin) override;
53
54 protected:
59
63 fmatvec::Vec A;
64
68 fmatvec::Vec dir;
69 };
70
72 public:
76 edgePolyFrustumCriteria(const double & tolerance_ = 1e-10);
77
81 ~edgePolyFrustumCriteria() override= default;;
82
86 void setFrustumHeight(const double & frustumHeight_) {
87 frustumHeight = frustumHeight_;
88 }
89
93 void setStartingXCoordinate(const double & ax_) {
94 ax = ax_;
95 }
96
100 void setdirectionXCoordinate(const double & dx_) {
101 dx = dx_;
102 }
103
104 /* INHERITED INTERFACE */
105 int operator ()(const fmatvec::Vec &xin) override;
106 bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec & fVal = fmatvec::Vec(0,fmatvec::NONINIT)) override;
107 void clear() override{criteriaResults.clear();}
108 /*END - INHERITED INTERFACE*/
109
110 const std::vector<double> & getResults() {
111 return criteriaResults;
112 }
113
114 protected:
118 bool inBounds(const double & t);
122 double tolerance;
123
127 double frustumHeight{-1};
128
132 std::vector<double> criteriaResults;
133
137 double ax{0.};
138
142 double dx{0.};
143 };
144
152 public:
155
156 /* INHERITED INTERFACE OF CONTACTKINEAMTICS */
157 void assignContours(const std::vector<Contour*> &contour) override;
158 void updateg(SingleContact &contact, int i=0) override;
159
160 void setGridSizeY(int gridSizeY_);
161 void setGridSizeZ(int gridSizeZ_);
162
163 protected:
167 void setFrustumOrienationKinematics(const double & x, const double & phi, SingleContact &contact);
168
169 /***************************************************/
176 bool cpLocationInPlate(SingleContact &contact);
177
182 bool gridContact(SingleContact &contact);
183
188 bool cornerContact(SingleContact &contact);
189
196 bool edgeContact(SingleContact &contact);
197
204 fmatvec::Vec3 computeContourPointFrustum(const double & x, const fmatvec::Vec3 & n);
205
212 fmatvec::Vec3 computeContourPoint(const double & x, const fmatvec::Vec3 & n);
213
219 int checkPossibleContactPoint(const double & x, const fmatvec::Vec3 & n);
220
225 double distance2Plate(const fmatvec::Vec3 & point);
226
230 void updateGrid();
231
235 int iplate{-1};
236
240 int ifrustum{-1};
241
245 Plate *plate{nullptr};
246
251
255 double signh{1.};
256
260 int gridSizeY{5};
261
265 int gridSizeZ{5};
266
270 double x1{-1};
271
275 double x2{-1};
276
280 fmatvec::Vec3 cornerPoints[4];
281
285 std::vector<std::vector<fmatvec::Vec3>> gridPoints;
286
291
296
301
306
311
316
321
326
331
336
340 int ilast{-1};
341
345 fmatvec::Vec xi;
346
347 fmatvec::Vec2 zeta;
348 };
349
350} /* namespace MBSim */
351#endif /* AREA_POLYNOMIALFRUSTUM_H_ */
class for contact kinematics between convex frustum and an plate
Definition: plate_polynomialfrustum.h:151
double distance2Plate(const fmatvec::Vec3 &point)
compute distance between given point and plate
Definition: plate_polynomialfrustum.cc:537
bool gridContact(SingleContact &contact)
if the unique contact point cannot be found a grid is walked through and a weighted sum results in th...
Definition: plate_polynomialfrustum.cc:240
void assignContours(const std::vector< Contour * > &contour) override
treats ordering of contours
Definition: plate_polynomialfrustum.cc:109
void updateGrid()
updates the grid for the discrete contact point approximation
Definition: plate_polynomialfrustum.cc:541
MBSim::projectPointAlongNormalJacobian * jacobianProjectAlongNormal
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:300
MBSim::NumericalNewtonJacobianFunction jacobianEdge
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:325
double x2
save last value to use it again as starting value for equation 2
Definition: plate_polynomialfrustum.h:275
fmatvec::Vec3 computeContourPointFrustum(const double &x, const fmatvec::Vec3 &n)
computes the point on the contour of the frustum due to the height-coordinate x and the normal in wor...
Definition: plate_polynomialfrustum.cc:513
fmatvec::Vec3 cornerPoints[4]
array of the four corner points of the plate in the frame of the frustum
Definition: plate_polynomialfrustum.h:280
double signh
sign of height-direction
Definition: plate_polynomialfrustum.h:255
double x1
save last value to use it again as starting value for equation 1
Definition: plate_polynomialfrustum.h:270
fmatvec::Vec3 computeContourPoint(const double &x, const fmatvec::Vec3 &n)
computes the point on the contour of the frustum due to the height-coordinate x and the normal in wor...
Definition: plate_polynomialfrustum.cc:525
int ifrustum
contour index of frustum (in cpData)
Definition: plate_polynomialfrustum.h:240
int iplate
contour index of plate (in cpData)
Definition: plate_polynomialfrustum.h:235
int checkPossibleContactPoint(const double &x, const fmatvec::Vec3 &n)
check if frustum point identified by coordinate x is possible contact point
Definition: plate_polynomialfrustum.cc:529
bool cornerContact(SingleContact &contact)
checks if there is a contact point at one of the corner points
Definition: plate_polynomialfrustum.cc:305
MBSim::StandardDampingFunction dampingProjectAlongNormal
damping function for newton method
Definition: plate_polynomialfrustum.h:310
MBSim::MultiDimensionalNewtonMethod newtonProjectAlongNormal
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:295
std::vector< std::vector< fmatvec::Vec3 > > gridPoints
saves the points for the contact point computation
Definition: plate_polynomialfrustum.h:285
PolynomialFrustum * frustum
pointer to the contour class for the polynomial frustum
Definition: plate_polynomialfrustum.h:250
int gridSizeZ
grid size in z-direction for the search with grid points
Definition: plate_polynomialfrustum.h:265
MBSim::StandardDampingFunction dampingEdge
damping function for newton method
Definition: plate_polynomialfrustum.h:335
edgePolyFrustum * funcEdge
function for intersection point
Definition: plate_polynomialfrustum.h:315
void setFrustumOrienationKinematics(const double &x, const double &phi, SingleContact &contact)
set the values for the contact kinematics for the frustum due to the given x and phi
Definition: plate_polynomialfrustum.cc:153
GlobalResidualCriteriaFunction criteriaProjectAlongNormal
criteria for newton method
Definition: plate_polynomialfrustum.h:305
MBSim::MultiDimensionalNewtonMethod newtonEdge
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:320
void updateg(SingleContact &contact, int i=0) override
compute contact kinematics for a single contact
Definition: plate_polynomialfrustum.cc:452
MBSim::projectPointAlongNormal * funcProjectAlongNormal
function for intersection point
Definition: plate_polynomialfrustum.h:290
int ilast
index of last edge contact
Definition: plate_polynomialfrustum.h:340
fmatvec::Vec xi
last position of edge contact
Definition: plate_polynomialfrustum.h:345
Plate * plate
pointer to the contour class for the plate
Definition: plate_polynomialfrustum.h:245
edgePolyFrustumCriteria criteriaEdge
criteria for newton method
Definition: plate_polynomialfrustum.h:330
int gridSizeY
grid size in y-direction for the search with grid points
Definition: plate_polynomialfrustum.h:260
bool edgeContact(SingleContact &contact)
checks if there is a contact on one edge of the plate
Definition: plate_polynomialfrustum.cc:377
bool cpLocationInPlate(SingleContact &contact)
check if there is a contact point within the plate between the frustum and the plate
Definition: plate_polynomialfrustum.cc:159
basic class for contact kinematical calculations
Definition: contact_kinematics.h:41
Mother class for different criterias that are fulfilled or not.
Definition: criteria_functions.h:33
Definition: function.h:53
This criteria function class applies the infinity norm globally on the complete vector and compares i...
Definition: criteria_functions.h:170
Newton method for multidimensional root finding.
Definition: multi_dimensional_newton_method.h:41
class to compute the Jacobian matrix for the newton method numerically
Definition: newton_method_jacobian_functions.h:60
RigidContour Plate.
Definition: plate.h:37
Frustum contour with a polynomial radius over height course.
Definition: polynomial_frustum.h:38
class for contacts
Definition: single_contact.h:46
Definition: damping_functions.h:63
Definition: plate_polynomialfrustum.h:71
double frustumHeight
height of frustum
Definition: plate_polynomialfrustum.h:127
double ax
xPosition of starting Point
Definition: plate_polynomialfrustum.h:137
~edgePolyFrustumCriteria() override=default
Destructor.
void setFrustumHeight(const double &frustumHeight_)
set frustum height
Definition: plate_polynomialfrustum.h:86
std::vector< double > criteriaResults
saves the results of the criteria
Definition: plate_polynomialfrustum.h:132
int operator()(const fmatvec::Vec &xin) override
computes the criteria
Definition: plate_polynomialfrustum.cc:71
bool isBetter(const fmatvec::Vec &x, const fmatvec::Vec &fVal=fmatvec::Vec(0, fmatvec::NONINIT)) override
compares the result of given vector with the last result and returns if it got better (for damping)
Definition: plate_polynomialfrustum.cc:83
edgePolyFrustumCriteria(const double &tolerance_=1e-10)
Constructor.
Definition: plate_polynomialfrustum.cc:67
double tolerance
tolerance value for the criteria results
Definition: plate_polynomialfrustum.h:122
void setStartingXCoordinate(const double &ax_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:93
double dx
xdirection
Definition: plate_polynomialfrustum.h:142
void setdirectionXCoordinate(const double &dx_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:100
bool inBounds(const double &t)
checks if current point fullfills the boundary conditions
Definition: plate_polynomialfrustum.cc:93
void clear() override
deletes the list of criteria results
Definition: plate_polynomialfrustum.h:107
Function describing the scalar product between normal of frustum point and difference between frustum...
Definition: plate_polynomialfrustum.h:35
edgePolyFrustum(const PolynomialFrustum *frustum_)
constructor
Definition: plate_polynomialfrustum.cc:35
~edgePolyFrustum() override
standard destructor
void setAdir(const fmatvec::Vec3 &A_, const fmatvec::Vec3 &dir_)
set the one corner point A and the direction of the edge with (A + dir) is the other corner point
Definition: plate_polynomialfrustum.cc:41
const PolynomialFrustum * frustum
polynomials of frustum contour
Definition: plate_polynomialfrustum.h:58
fmatvec::Vec dir
direction of edge
Definition: plate_polynomialfrustum.h:68
fmatvec::Vec A
position of starting point on the line
Definition: plate_polynomialfrustum.h:63
the Jacobian function for the projectAlongNormal Function
Definition: point_polynomialfrustum.h:64
function that is zero for a height-coordinate of the polynomial frustum on which the normal on that p...
Definition: point_polynomialfrustum.h:34
namespace MBSim
Definition: bilateral_constraint.cc:30