mbsim  4.0.0
MBSim Kernel
generalized_elastic_structure.h
1 /* Copyright (C) 2004-2017 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@gmail.com
18  */
19 
20 #ifndef _GENERALIZED_ELASTIC_STRUCTURE_H_
21 #define _GENERALIZED_ELASTIC_STRUCTURE_H_
22 
23 #include "mbsim/links/rigid_body_link.h"
24 #include "mbsim/functions/function.h"
25 
26 namespace MBSim {
27 
29  protected:
30  Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *func;
31  std::vector<fmatvec::RangeV> ila;
32  std::vector<std::string> saved_body;
33  public:
34  GeneralizedElasticStructure(const std::string &name="") : RigidBodyLink(name) { }
35  ~GeneralizedElasticStructure() override;
36  void updateGeneralizedForces() override;
37  void updateGeneralizedPositions() override;
38  void updateGeneralizedVelocities() override;
39  void updateForce() override;
40  void updateMoment() override;
41  void updateR() override;
42  void updateh(int i=0) override;
43  void addRigidBody(RigidBody* body_) { body.push_back(body_); }
44 
45  void calcSize() override;
46 
47  bool isActive() const override { return true; }
48  bool gActiveChanged() override { return false; }
49  bool isSingleValued() const override { return true; }
50  void init(InitStage stage, const InitConfigSet &config) override;
51 
52  void setGeneralizedForceFunction(Function<fmatvec::VecV(fmatvec::VecV,fmatvec::VecV)> *func_) {
53  func=func_;
54  func->setParent(this);
55  func->setName("GeneralizedForce");
56  }
57 
58  void initializeUsingXML(xercesc::DOMElement * element) override;
59  };
60 
61 }
62 
63 #endif
bool isActive() const override
Definition: generalized_elastic_structure.h:47
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_elastic_structure.h:49
Definition: generalized_elastic_structure.h:28
bool gActiveChanged() override
Definition: generalized_elastic_structure.h:48
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: generalized_elastic_structure.cc:97
InitStage
The stages of the initialization.
Definition: element.h:64
Definition: contact_kinematics.h:32
std::string name
name of element
Definition: element.h:251
void setName(const std::string &str)
Definition: element.h:117
rigid bodies with arbitrary kinematics
Definition: rigid_body.h:50
namespace MBSim
Definition: bilateral_constraint.cc:29