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
30 namespace 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:
58 const PolynomialFrustum * frustum;
59
63 fmatvec::Vec A;
64
68 fmatvec::Vec dir;
69 };
70
71 class edgePolyFrustumCriteria : public CriteriaFunction {
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
151 class ContactKinematicsPlatePolynomialFrustum : public MBSim::ContactKinematics {
152 public:
153 ContactKinematicsPlatePolynomialFrustum();
154 ~ContactKinematicsPlatePolynomialFrustum() override;
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
250 PolynomialFrustum *frustum{nullptr};
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
290 MBSim::projectPointAlongNormal * funcProjectAlongNormal{nullptr};
291
295 MBSim::MultiDimensionalNewtonMethod newtonProjectAlongNormal;
296
300 MBSim::projectPointAlongNormalJacobian * jacobianProjectAlongNormal{nullptr};
301
305 GlobalResidualCriteriaFunction criteriaProjectAlongNormal;
306
310 MBSim::StandardDampingFunction dampingProjectAlongNormal;
311
315 edgePolyFrustum * funcEdge{nullptr};
316
320 MBSim::MultiDimensionalNewtonMethod newtonEdge;
321
325 MBSim::NumericalNewtonJacobianFunction jacobianEdge;
326
330 edgePolyFrustumCriteria criteriaEdge;
331
335 MBSim::StandardDampingFunction dampingEdge;
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_ */
MBSim::GlobalResidualCriteriaFunction
This criteria function class applies the infinity norm globally on the complete vector and compares i...
Definition: criteria_functions.h:170
MBSim::MultiDimensionalNewtonMethod
Newton method for multidimensional root finding.
Definition: multi_dimensional_newton_method.h:41
MBSim::edgePolyFrustum::setAdir
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
MBSim::edgePolyFrustumCriteria::criteriaResults
std::vector< double > criteriaResults
saves the results of the criteria
Definition: plate_polynomialfrustum.h:132
MBSim::ContactKinematicsPlatePolynomialFrustum::cornerPoints
fmatvec::Vec3 cornerPoints[4]
array of the four corner points of the plate in the frame of the frustum
Definition: plate_polynomialfrustum.h:280
MBSim::ContactKinematicsPlatePolynomialFrustum::distance2Plate
double distance2Plate(const fmatvec::Vec3 &point)
compute distance between given point and plate
Definition: plate_polynomialfrustum.cc:536
MBSim::NumericalNewtonJacobianFunction
class to compute the Jacobian matrix for the newton method numerically
Definition: newton_method_jacobian_functions.h:60
MBSim::ContactKinematicsPlatePolynomialFrustum::gridContact
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:239
MBSim::edgePolyFrustum::dir
fmatvec::Vec dir
direction of edge
Definition: plate_polynomialfrustum.h:68
MBSim::ContactKinematicsPlatePolynomialFrustum::gridSizeZ
int gridSizeZ
grid size in z-direction for the search with grid points
Definition: plate_polynomialfrustum.h:265
MBSim::ContactKinematicsPlatePolynomialFrustum::updateg
void updateg(SingleContact &contact, int i=0) override
compute contact kinematics for a single contact
Definition: plate_polynomialfrustum.cc:451
MBSim::edgePolyFrustumCriteria::~edgePolyFrustumCriteria
~edgePolyFrustumCriteria() override=default
Destructor.
MBSim::ContactKinematicsPlatePolynomialFrustum::ilast
int ilast
index of last edge contact
Definition: plate_polynomialfrustum.h:340
MBSim::ContactKinematicsPlatePolynomialFrustum::computeContourPointFrustum
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:512
MBSim::edgePolyFrustumCriteria::ax
double ax
xPosition of starting Point
Definition: plate_polynomialfrustum.h:137
MBSim::edgePolyFrustum::~edgePolyFrustum
~edgePolyFrustum() override
standard destructor
MBSim::ContactKinematicsPlatePolynomialFrustum::criteriaProjectAlongNormal
GlobalResidualCriteriaFunction criteriaProjectAlongNormal
criteria for newton method
Definition: plate_polynomialfrustum.h:305
MBSim::ContactKinematicsPlatePolynomialFrustum
class for contact kinematics between convex frustum and an plate
Definition: plate_polynomialfrustum.h:151
MBSim::ContactKinematicsPlatePolynomialFrustum::gridPoints
std::vector< std::vector< fmatvec::Vec3 > > gridPoints
saves the points for the contact point computation
Definition: plate_polynomialfrustum.h:285
MBSim::ContactKinematicsPlatePolynomialFrustum::jacobianProjectAlongNormal
MBSim::projectPointAlongNormalJacobian * jacobianProjectAlongNormal
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:300
MBSim::ContactKinematicsPlatePolynomialFrustum::plate
Plate * plate
pointer to the contour class for the plate
Definition: plate_polynomialfrustum.h:245
MBSim::ContactKinematicsPlatePolynomialFrustum::jacobianEdge
MBSim::NumericalNewtonJacobianFunction jacobianEdge
Jacobian for newton method.
Definition: plate_polynomialfrustum.h:325
MBSim::ContactKinematicsPlatePolynomialFrustum::setFrustumOrienationKinematics
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:152
MBSim::ContactKinematicsPlatePolynomialFrustum::criteriaEdge
edgePolyFrustumCriteria criteriaEdge
criteria for newton method
Definition: plate_polynomialfrustum.h:330
MBSim::edgePolyFrustumCriteria::setStartingXCoordinate
void setStartingXCoordinate(const double &ax_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:93
MBSim::ContactKinematicsPlatePolynomialFrustum::funcProjectAlongNormal
MBSim::projectPointAlongNormal * funcProjectAlongNormal
function for intersection point
Definition: plate_polynomialfrustum.h:290
MBSim::PolynomialFrustum
Frustum contour with a polynomial radius over height course.
Definition: polynomial_frustum.h:38
MBSim::edgePolyFrustumCriteria::dx
double dx
xdirection
Definition: plate_polynomialfrustum.h:142
MBSim::ContactKinematicsPlatePolynomialFrustum::newtonProjectAlongNormal
MBSim::MultiDimensionalNewtonMethod newtonProjectAlongNormal
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:295
MBSim::edgePolyFrustumCriteria::frustumHeight
double frustumHeight
height of frustum
Definition: plate_polynomialfrustum.h:127
MBSim::ContactKinematicsPlatePolynomialFrustum::iplate
int iplate
contour index of plate (in cpData)
Definition: plate_polynomialfrustum.h:235
MBSim::edgePolyFrustumCriteria::tolerance
double tolerance
tolerance value for the criteria results
Definition: plate_polynomialfrustum.h:122
MBSim::ContactKinematicsPlatePolynomialFrustum::cpLocationInPlate
bool cpLocationInPlate(SingleContact &contact)
check if there is a contact point within the plate between the frustum and the plate
Definition: plate_polynomialfrustum.cc:158
MBSim::ContactKinematicsPlatePolynomialFrustum::funcEdge
edgePolyFrustum * funcEdge
function for intersection point
Definition: plate_polynomialfrustum.h:315
MBSim::edgePolyFrustum
Function describing the scalar product between normal of frustum point and difference between frustum...
Definition: plate_polynomialfrustum.h:35
MBSim::Plate
RigidContour Plate.
Definition: plate.h:37
MBSim::edgePolyFrustumCriteria
Definition: plate_polynomialfrustum.h:71
MBSim::edgePolyFrustumCriteria::setFrustumHeight
void setFrustumHeight(const double &frustumHeight_)
set frustum height
Definition: plate_polynomialfrustum.h:86
MBSim::ContactKinematicsPlatePolynomialFrustum::dampingEdge
MBSim::StandardDampingFunction dampingEdge
damping function for newton method
Definition: plate_polynomialfrustum.h:335
MBSim::edgePolyFrustum::edgePolyFrustum
edgePolyFrustum(const PolynomialFrustum *frustum_)
constructor
Definition: plate_polynomialfrustum.cc:35
MBSim::ContactKinematicsPlatePolynomialFrustum::computeContourPoint
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:524
MBSim::edgePolyFrustum::A
fmatvec::Vec A
position of starting point on the line
Definition: plate_polynomialfrustum.h:63
MBSim::ContactKinematicsPlatePolynomialFrustum::signh
double signh
sign of height-direction
Definition: plate_polynomialfrustum.h:255
MBSim::ContactKinematicsPlatePolynomialFrustum::x2
double x2
save last value to use it again as starting value for equation 2
Definition: plate_polynomialfrustum.h:275
MBSim::projectPointAlongNormal
function that is zero for a height-coordinate of the polynomial frustum on which the normal on that p...
Definition: point_polynomialfrustum.h:34
MBSim::CriteriaFunction
Mother class for different criterias that are fulfilled or not.
Definition: criteria_functions.h:33
MBSim::projectPointAlongNormalJacobian
the Jacobian function for the projectAlongNormal Function
Definition: point_polynomialfrustum.h:64
MBSim::ContactKinematicsPlatePolynomialFrustum::newtonEdge
MBSim::MultiDimensionalNewtonMethod newtonEdge
newton method for solving the edge contact
Definition: plate_polynomialfrustum.h:320
MBSim::Function
Definition: contact_kinematics.h:32
MBSim::ContactKinematicsPlatePolynomialFrustum::dampingProjectAlongNormal
MBSim::StandardDampingFunction dampingProjectAlongNormal
damping function for newton method
Definition: plate_polynomialfrustum.h:310
MBSim::ContactKinematicsPlatePolynomialFrustum::ifrustum
int ifrustum
contour index of frustum (in cpData)
Definition: plate_polynomialfrustum.h:240
MBSim::ContactKinematicsPlatePolynomialFrustum::assignContours
void assignContours(const std::vector< Contour * > &contour) override
treats ordering of contours
Definition: plate_polynomialfrustum.cc:109
MBSim::ContactKinematicsPlatePolynomialFrustum::xi
fmatvec::Vec xi
last position of edge contact
Definition: plate_polynomialfrustum.h:345
MBSim::edgePolyFrustumCriteria::inBounds
bool inBounds(const double &t)
checks if current point fullfills the boundary conditions
Definition: plate_polynomialfrustum.cc:93
MBSim::ContactKinematicsPlatePolynomialFrustum::cornerContact
bool cornerContact(SingleContact &contact)
checks if there is a contact point at one of the corner points
Definition: plate_polynomialfrustum.cc:304
MBSim::ContactKinematicsPlatePolynomialFrustum::frustum
PolynomialFrustum * frustum
pointer to the contour class for the polynomial frustum
Definition: plate_polynomialfrustum.h:250
MBSim::ContactKinematicsPlatePolynomialFrustum::updateGrid
void updateGrid()
updates the grid for the discrete contact point approximation
Definition: plate_polynomialfrustum.cc:540
MBSim::StandardDampingFunction
Definition: damping_functions.h:63
MBSim::edgePolyFrustumCriteria::operator()
int operator()(const fmatvec::Vec &xin) override
computes the criteria
Definition: plate_polynomialfrustum.cc:71
MBSim::SingleContact
class for contacts
Definition: single_contact.h:46
MBSim::ContactKinematics
basic class for contact kinematical calculations
Definition: contact_kinematics.h:41
MBSim::ContactKinematicsPlatePolynomialFrustum::gridSizeY
int gridSizeY
grid size in y-direction for the search with grid points
Definition: plate_polynomialfrustum.h:260
MBSim::edgePolyFrustumCriteria::clear
void clear() override
deletes the list of criteria results
Definition: plate_polynomialfrustum.h:107
MBSim::edgePolyFrustum::frustum
const PolynomialFrustum * frustum
polynomials of frustum contour
Definition: plate_polynomialfrustum.h:58
MBSim::ContactKinematicsPlatePolynomialFrustum::checkPossibleContactPoint
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:528
MBSim::edgePolyFrustumCriteria::edgePolyFrustumCriteria
edgePolyFrustumCriteria(const double &tolerance_=1e-10)
Constructor.
Definition: plate_polynomialfrustum.cc:67
MBSim::edgePolyFrustumCriteria::isBetter
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
MBSim::ContactKinematicsPlatePolynomialFrustum::x1
double x1
save last value to use it again as starting value for equation 1
Definition: plate_polynomialfrustum.h:270
MBSim::edgePolyFrustumCriteria::setdirectionXCoordinate
void setdirectionXCoordinate(const double &dx_)
set starting x coordinate
Definition: plate_polynomialfrustum.h:100
MBSim::ContactKinematicsPlatePolynomialFrustum::edgeContact
bool edgeContact(SingleContact &contact)
checks if there is a contact on one edge of the plate
Definition: plate_polynomialfrustum.cc:376
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30