All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
lcp_reformulation_functions.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 NUMERICSLCPREFORMULATEDFUNCTION_H_
21 #define NUMERICSLCPREFORMULATEDFUNCTION_H_
22 
23 #include <mbsim/functions/function.h>
24 
25 #include <mbsim/numerics/functions/newton_method_jacobian_functions.h>
26 
27 namespace MBSim {
28 
29  class LCPReformulationFunction : public Function<fmatvec::Vec(fmatvec::Vec)> {
30  public:
34  LCPReformulationFunction(const double &r_ = 10) :
35  r(r_), DEBUGLEVEL(0) {
36  }
37 
41  LCPReformulationFunction(const fmatvec::Vec &q_, const fmatvec::SqrMat &M_, const double &r_ = 10, const unsigned int & DEBUGLEVEL_ = 0);
42 
43  /*
44  * \brief destructor
45  */
46  virtual ~LCPReformulationFunction();
47 
48  /* INHERITED INTERFACE */
53  virtual fmatvec::Vec operator()(const fmatvec::Vec &q) = 0;
54  /***************************************************/
55 
58  return q;
59  }
60  void setSystem(const fmatvec::SqrMat & M_, const fmatvec::Vec & q_) {
61  M.resize() = M_;
62  q.resize() = q_;
63  assert(M.rows() == q.rows());
64  NumberOfContacts = q.rows();
65  }
66  fmatvec::SqrMat getM(void) {
67  return M;
68  }
69  double getr(void) {
70  return r;
71  }
72  void setr(const double & r_) {
73  r = r_;
74  }
75  /*****************/
76 
77  protected:
82 
87 
92 
96  double r;
97 
101  unsigned int DEBUGLEVEL;
102  };
103 
105  public:
111  }
112 
120  LCPNewtonReformulationFunction(const fmatvec::Vec &q_, const fmatvec::SqrMat &M_, const double &r_ = 10, const unsigned int & DEBUGLEVEL_ = 0);
121 
126 
127  /* INHERITED INTERFACE */
129  /***************************************************/
130 
131  protected:
132 
133  };
134 
136  public:
142  }
143 
151  LCPFixpointReformulationFunction(const fmatvec::Vec &q_, const fmatvec::SqrMat &M_, const double &r_ = 10, const unsigned int & DEBUGLEVEL_ = 0);
152 
157 
158  /* INHERITED INTERFACE */
160  /***************************************************/
161  };
162 
164  public:
169 
170  /*
171  * \brief destructor
172  */
174 
175  virtual fmatvec::SqrMat operator ()(const fmatvec::Vec & x);
176 
177  virtual void setFunction(Function<fmatvec::Vec(fmatvec::Vec)> *function_);
178 
179  void updateJacobian(const fmatvec::Vec & x);
180 
181  protected:
186 
187  };
188 }
189 #endif //NUMERICSLCPREFORMULATEDFUNCTION_H_
Definition: lcp_reformulation_functions.h:135
int NumberOfContacts
Number of possible contact points (= dimension of the LCP)
Definition: lcp_reformulation_functions.h:81
fmatvec::Vec getq(void)
Definition: lcp_reformulation_functions.h:57
Definition: lcp_reformulation_functions.h:163
unsigned int DEBUGLEVEL
parameter to print information
Definition: lcp_reformulation_functions.h:101
fmatvec::Vec q
vector of all rigid body gaps
Definition: lcp_reformulation_functions.h:86
base class for square Jacobians used for the newton method
Definition: newton_method_jacobian_functions.h:31
fmatvec::Vec operator()(const fmatvec::Vec &q)
Definition: lcp_reformulation_functions.cc:51
fmatvec::Vec operator()(const fmatvec::Vec &q)
Definition: lcp_reformulation_functions.cc:101
double r
parameter for the prox-function (r&gt;0)
Definition: lcp_reformulation_functions.h:96
LCPNewtonReformulationFunction()
standard constructor
Definition: lcp_reformulation_functions.h:109
virtual fmatvec::Vec operator()(const fmatvec::Vec &q)=0
Definition: lcp_reformulation_functions.h:104
virtual ~LCPFixpointReformulationFunction()
destructor
Definition: lcp_reformulation_functions.cc:98
Definition: planar_contour.h:31
LinearComplementarityJacobianFunction()
constructor
Definition: lcp_reformulation_functions.cc:139
LCPReformulationFunction(const double &r_=10)
standard constructor
Definition: lcp_reformulation_functions.h:34
virtual ~LCPNewtonReformulationFunction()
destructor
Definition: lcp_reformulation_functions.cc:48
fmatvec::SqrMat M
Influence matrix for the contacts.
Definition: lcp_reformulation_functions.h:91
Definition: lcp_reformulation_functions.h:29
LCPFixpointReformulationFunction()
standard constructor
Definition: lcp_reformulation_functions.h:140
fmatvec::SqrMat J
Jacobian function (stays saved to save computation time, as some parts stay constant) ...
Definition: lcp_reformulation_functions.h:185

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML