mbsim 4.0.0 MBSim Kernel

regularized_constraint.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_CONSTRAINT_H_
21 #define _REGULARIZED_CONSTRAINT_H_
22
23 #include <mbsim/constitutive_laws/generalized_force_law.h>
24
25 namespace MBSim {
26
31 class RegularizedConstraint : public GeneralizedForceLaw {
32 public:
36 RegularizedConstraint(Function<double(double,double)> *forceFunc_=nullptr) : forceFunc(forceFunc_) {
37 if(forceFunc)
38 forceFunc->setParent(this);
39 }
40
44 ~RegularizedConstraint() override { delete forceFunc; };
45
46 void init(Element::InitStage stage, const InitConfigSet &config) override;
47
48 /* INHERITED INTERFACE */
49 bool isSetValued() const override { return false; }
50 /***************************************************/
51
52 void initializeUsingXML(xercesc::DOMElement *element) override;
53
60 double operator()(double g, double gd) override { return (*forceFunc)(g,gd); }
61
67 void setForceFunction(Function<double(double,double)> *forceFunc_) {
68 forceFunc=forceFunc_;
69 forceFunc->setParent(this);
70
71 }
72
73 Function<double(double,double)>* getForceFunction() { return forceFunc; }
74
75 protected:
79 Function<double(double,double)> *forceFunc;
80 };
81
82 }
83
84 #endif
MBSim::GeneralizedForceLaw
basic force law on acceleration level for constraint description
Definition: generalized_force_law.h:34
MBSim::RegularizedConstraint::forceFunc
Function< double(double, double)> * forceFunc
force function for a regularized contact law
Definition: regularized_constraint.h:79
MBSim::RegularizedConstraint::init
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: regularized_constraint.cc:31
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::RegularizedConstraint::~RegularizedConstraint
~RegularizedConstraint() override
destructor
Definition: regularized_constraint.h:44
MBSim::RegularizedConstraint::isSetValued
bool isSetValued() const override
Definition: regularized_constraint.h:49
MBSim::Function
Definition: contact_kinematics.h:32
MBSim::RegularizedConstraint::RegularizedConstraint
RegularizedConstraint(Function< double(double, double)> *forceFunc_=nullptr)
constructor
Definition: regularized_constraint.h:36
MBSim::RegularizedConstraint::operator()
double operator()(double g, double gd) override
Definition: regularized_constraint.h:60
MBSim::RegularizedConstraint::setForceFunction
void setForceFunction(Function< double(double, double)> *forceFunc_)
Set the force function for use in regularisized constitutive laws The first input parameter to the fo...
Definition: regularized_constraint.h:67
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30
MBSim::RegularizedConstraint
basic regularized force law on acceleration level for constraint description
Definition: regularized_constraint.h:31