mbsim 4.0.0 MBSim Kernel

generalized_spring_damper.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Contact: martin.o.foerg@googlemail.com
17 */
18
19 #ifndef _GENERALIZED_SPRING_DAMPER_H_
20 #define _GENERALIZED_SPRING_DAMPER_H_
21
22 #include "mbsim/links/dual_rigid_body_link.h"
23 #include "mbsim/functions/function.h"
24
25 namespace MBSim {
26
27 class GeneralizedSpringDamper : public DualRigidBodyLink {
28 protected:
29 Function<double(double,double)> *func;
30 double l0{0};
31 public:
32 GeneralizedSpringDamper(const std::string &name="") : DualRigidBodyLink(name), func(nullptr) { }
33 ~GeneralizedSpringDamper() override;
34
35 void updateGeneralizedForces() override;
36
37 bool isActive() const override { return true; }
38 bool gActiveChanged() override { return false; }
39 bool isSingleValued() const override { return true; }
40 void init(InitStage stage, const InitConfigSet &config) override;
41
43 void setGeneralizedForceFunction(Function<double(double,double)> *func_) {
44 func=func_;
45 func->setParent(this);
46 func->setName("GeneralizedFoce");
47 }
48
50 void setGeneralizedUnloadedLength(double l0_) { l0 = l0_; }
51
52 void initializeUsingXML(xercesc::DOMElement *element) override;
53 };
54
55 }
56
57 #endif
MBSim::GeneralizedSpringDamper::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: generalized_spring_damper.cc:42
MBSim::GeneralizedSpringDamper::setGeneralizedForceFunction
void setGeneralizedForceFunction(Function< double(double, double)> *func_)
Set the function for the generalized force.
Definition: generalized_spring_damper.h:43
MBSim::GeneralizedSpringDamper::isSingleValued
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: generalized_spring_damper.h:39
MBSim::DualRigidBodyLink
Definition: dual_rigid_body_link.h:27
MBSim::GeneralizedSpringDamper
Definition: generalized_spring_damper.h:27
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::GeneralizedSpringDamper::gActiveChanged
bool gActiveChanged() override
Definition: generalized_spring_damper.h:38
MBSim::Function
Definition: contact_kinematics.h:32
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::GeneralizedSpringDamper::setGeneralizedUnloadedLength
void setGeneralizedUnloadedLength(double l0_)
Set unloaded generalized length.
Definition: generalized_spring_damper.h:50
MBSim::Element::setName
void setName(const std::string &str)
Definition: element.h:115
MBSim::GeneralizedSpringDamper::isActive
bool isActive() const override
Definition: generalized_spring_damper.h:37
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30