mbsim  4.0.0
MBSim Kernel
planar_contact_search.h
1 /* Copyright (C) 2004-2010 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 _PLANAR_CONTACT_SEARCH_H_
21 #define _PLANAR_CONTACT_SEARCH_H_
22 
23 #include <mbsim/functions/function.h>
24 
25 namespace MBSim {
26 
27  template <typename Sig> class DistanceFunction;
28 
40  public:
44  PlanarContactSearch() = default;
45 
52  PlanarContactSearch(DistanceFunction<double(double)> *func_) : func(func_), jac(nullptr) { }
53 
60  PlanarContactSearch(DistanceFunction<double(double)> *func_, Function<double(double)> *jac_) : func(func_), jac(jac_) { }
61 
62  /* GETTER / SETTER */
63  void setFunction(DistanceFunction<double(double)> *func_) { func = func_; }
64 
65  void setJacobianFunction(Function<double(double)> *jac_) { jac = jac_; }
66 
67  void setInitialValue(const double &s0_) { s0 = s0_; }
68  void setNodes(const fmatvec::Vec &nodes_) { nodes <<= nodes_; }
69  void setSearchAll(bool searchAll_) { searchAll = searchAll_; }
70  /*************************************************/
71 
78  void setEqualSpacing(const int &n, const double &x0, const double &dx);
79 
84  double slv();
90 
94  void setTolerance(double tol_) { tol = tol_; }
95 
96  private:
100  DistanceFunction<double(double)> *func{nullptr};
101 
105  Function<double(double)> *jac{nullptr};
106 
110  double s0{0.};
111 
116 
120  bool searchAll{false};
121 
125  double tol{1e-10};
126  };
127 
128 }
129 
130 #endif
double s0
initial value for Newton method
Definition: planar_contact_search.h:110
Definition: distance_function.h:27
PlanarContactSearch(DistanceFunction< double(double)> *func_, Function< double(double)> *jac_)
constructor
Definition: planar_contact_search.h:60
PlanarContactSearch(DistanceFunction< double(double)> *func_)
constructor
Definition: planar_contact_search.h:52
double slv()
solve for the one potential contact point with minimal distance (might be negative)
Definition: planar_contact_search.cc:37
double tol
tolerance for root-finding
Definition: planar_contact_search.h:125
PlanarContactSearch()=default
standard constructor
DistanceFunction< double(double)> * func
distance-function holding all information for contact-search
Definition: planar_contact_search.h:100
Function< double(double)> * jac
Jacobian of root function part of distance function.
Definition: planar_contact_search.h:105
Definition: planar_contour.h:30
void setEqualSpacing(const int &n, const double &x0, const double &dx)
set equally distanced nodes
Definition: planar_contact_search.cc:30
fmatvec::Vec nodes
Definition: planar_contact_search.h:115
void setTolerance(double tol_)
set tolerance for root-finding
Definition: planar_contact_search.h:94
general class for contact search with respect to one contour-parameter
Definition: planar_contact_search.h:39
bool searchAll
all area searching by Regular-Falsi or known initial value for Newton-Method?
Definition: planar_contact_search.h:120
fmatvec::Mat slvAll()
solve for all potential contact points
Definition: planar_contact_search.cc:94
namespace MBSim
Definition: eigenanalyzer.cc:47