mbsim  4.0.0
MBSim Kernel
nonlinear_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 _NONLINEAR_SPRING_DAMPER_FORCE_H_
21#define _NONLINEAR_SPRING_DAMPER_FORCE_H_
22
23#include "mbsim/functions/function.h"
24
25namespace MBSim {
26
32 class NonlinearSpringDamperForce : public Function<double(double,double)> {
33 public:
38
43 delete sF;
44 delete sdF;
45 }
46
52 NonlinearSpringDamperForce(Function<double(double)> *sF_, Function<double(double)> *sdF_) : sF(sF_), sdF(sdF_) {
53 sF->setParent(this);
54 sdF->setParent(this);
55 }
56
57 /* INHERITED INTERFACE OF FUNCTION2 */
58 double operator()(const double& s, const double& sd) override { return (*sF)(s) + (*sdF)(sd); }
59 void initializeUsingXML(xercesc::DOMElement *element) override;
60 void init(Element::InitStage stage, const InitConfigSet &config) override {
61 Function<double(double,double)>::init(stage, config);
62 sF->init(stage, config);
63 sdF->init(stage, config);
64 }
65 /***************************************************/
66
67 /* GETTER / SETTER */
68 void setForceDeflectionFunction(Function<double(double)> * sF_) {
69 sF=sF_;
70 sF->setParent(this);
71 sF->setName("ForceDeflection");
72 }
73
74 void setForceVelocityFunction(Function<double(double)> * sdF_) {
75 sdF=sdF_;
76 sdF->setParent(this);
77 sdF->setName("ForceVelocity");
78 }
79 /***************************************************/
80
81 protected:
85 Function<double(double)> * sF{nullptr};
86
90 Function<double(double)> * sdF{nullptr};
91 };
92
93}
94
95#endif
virtual void init(InitStage stage, const InitConfigSet &config=InitConfigSet())
plots time series header
Definition: element.cc:85
InitStage
The stages of the initialization.
Definition: element.h:62
void setName(const std::string &str)
Definition: element.h:115
Definition: function.h:53
Function()
Definition: function.h:57
function describing a nonlinear relationship between the input deflection / relative velocity and the...
Definition: nonlinear_spring_damper_force.h:32
NonlinearSpringDamperForce(Function< double(double)> *sF_, Function< double(double)> *sdF_)
constructor
Definition: nonlinear_spring_damper_force.h:52
NonlinearSpringDamperForce()=default
constructor
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: nonlinear_spring_damper_force.h:60
~NonlinearSpringDamperForce() override
destructor
Definition: nonlinear_spring_damper_force.h:42
Function< double(double)> * sF
deflection depending force function
Definition: nonlinear_spring_damper_force.h:85
Function< double(double)> * sdF
relative velocity depending force function
Definition: nonlinear_spring_damper_force.h:90
namespace MBSim
Definition: bilateral_constraint.cc:30