mbsim 4.0.0 MBSim Kernel

regularized_friction.h
1 /* Copyright (C) 2004-2018 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 _REGULARIZED_FRICTION_H_
21 #define _REGULARIZED_FRICTION_H_
22
23 #include <mbsim/constitutive_laws/friction_force_law.h>
24
25 namespace MBSim {
26
31 class RegularizedFriction : public FrictionForceLaw {
32 public:
33 RegularizedFriction(Function<fmatvec::Vec(fmatvec::Vec,double)> *frictionForceFunc_=nullptr) : frictionForceFunc(frictionForceFunc_) {
34 if(frictionForceFunc)
35 frictionForceFunc->setParent(this);
36 }
37 ~RegularizedFriction() override { delete frictionForceFunc; }
38 void init(Element::InitStage stage, const InitConfigSet &config) override;
39 bool isSetValued() const override { return false; }
40 void initializeUsingXML(xercesc::DOMElement *element) override;
41
42 fmatvec::Vec operator()(const fmatvec::Vec &gd, double laN) override { return (*frictionForceFunc)(gd,laN); }
43 fmatvec::Vec dlaTdlaN(const fmatvec::Vec& gd) override { return frictionForceFunc->parDer2(gd,1); }
44
50 void setFrictionForceFunction(Function<fmatvec::Vec(fmatvec::Vec,double)> *frictionForceFunc_) {
51 frictionForceFunc=frictionForceFunc_;
52 frictionForceFunc->setParent(this);
53 }
54
55 protected:
56 Function<fmatvec::Vec(fmatvec::Vec,double)> *frictionForceFunc{nullptr};
57 };
58
59 }
60
61 #endif
MBSim::RegularizedFriction::init
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: regularized_friction.cc:31
MBSim::RegularizedFriction
basic regularized friction force law on acceleration level for constraint description
Definition: regularized_friction.h:31
MBSim::RegularizedFriction::setFrictionForceFunction
void setFrictionForceFunction(Function< fmatvec::Vec(fmatvec::Vec, double)> *frictionForceFunc_)
Set the friction force function for use in regularisized constitutive friction laws The first input p...
Definition: regularized_friction.h:50
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::FrictionForceLaw
basic friction force law on acceleration level for constraint description
Definition: friction_force_law.h:34
MBSim::Function
Definition: contact_kinematics.h:32
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30