mbsim 4.0.0 MBSim Kernel

linear_spring_damper_force.h
1 /* Copyright (C) 2004-2009 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: markus.ms.schneider@gmail.com
18 */
19
20 #ifndef _LINEAR_SPRING_DAMPER_FORCE_H_
21 #define _LINEAR_SPRING_DAMPER_FORCE_H_
22
23 #include "mbsim/functions/function.h"
24
25 namespace MBSim {
26
32 class LinearSpringDamperForce : public Function<double(double,double)> {
33 public:
37 LinearSpringDamperForce() = default;
38
44 LinearSpringDamperForce(double c_, double d_) : c(c_), d(d_) {}
45
46 /* INHERITED INTERFACE OF FUNCTION2 */
47 double operator()(const double& s, const double& sd) override { return c*s + d*sd; }
48 void initializeUsingXML(xercesc::DOMElement *element) override;
49 /***************************************************/
50
51 /* GETTER / SETTER */
52 void setStiffnessCoefficient(double c_) { c=c_; }
53 void setDampingCoefficient(double d_) { d=d_; }
54 /***************************************************/
55
56 protected:
60 double c, d;
61 };
62
63 }
64
65 #endif
MBSim::LinearSpringDamperForce::LinearSpringDamperForce
LinearSpringDamperForce()=default
constructor
MBSim::LinearSpringDamperForce::LinearSpringDamperForce
LinearSpringDamperForce(double c_, double d_)
constructor
Definition: linear_spring_damper_force.h:44
MBSim::LinearSpringDamperForce
function describing a linear relationship between the input deflection / relative velocity and the ou...
Definition: linear_spring_damper_force.h:32
MBSim::Function
Definition: contact_kinematics.h:32
MBSim::LinearSpringDamperForce::c
double c
stiffness, damping, undeformed length
Definition: linear_spring_damper_force.h:60
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30