All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
friction.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 _FRICTION_H_
20 #define _FRICTION_H_
21 
22 #include "mbsim/link_mechanics.h"
23 #include <mbsim/frame.h>
24 #include "mbsim/functions/function.h"
25 
26 #ifdef HAVE_OPENMBVCPPINTERFACE
27 #include "mbsim/utils/boost_parameters.h"
28 #include "mbsim/utils/openmbv_utils.h"
29 #endif
30 
31 namespace MBSim {
32 
33  class RigidBody;
34  class FrictionForceLaw;
35 
37  protected:
38  //Function<double(double,double)> *func;
39  FrictionForceLaw *func;
40  Function<double(double)> *laN;
41  std::vector<RigidBody*> body;
42  public:
43  GeneralizedFriction(const std::string &name="");
45  void updateh(double, int i=0);
46  void updateg(double) { }
47  void updategd(double);
48 
49  bool isActive() const { return true; }
50  bool gActiveChanged() { return false; }
51  virtual bool isSingleValued() const { return true; }
52  std::string getType() const { return "GeneralizedFriction"; }
53  void init(InitStage stage);
54 
56  //void setGeneralizedForceFunction(Function<double(double,double)> *func_) { func=func_; }
58  void setGeneralizedNormalForceFunction(Function<double(double)> *laN_) {
59  laN = laN_;
60  laN->setParent(this);
61  }
62 
63  void setRigidBodyFirstSide(RigidBody* body_) { body[0] = body_; }
64  void setRigidBodySecondSide(RigidBody* body_) { body[1] = body_; }
65 
66  void plot(double t, double dt=1);
67  void initializeUsingXML(xercesc::DOMElement *element);
68 
69  void updatehRef(const fmatvec::Vec &hParent, int j=0);
70 
71 #ifdef HAVE_OPENMBVCPPINTERFACE
72 
73  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVForce, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
74  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
75  std::vector<bool> which; which.resize(2, true);
76  LinkMechanics::setOpenMBVForceArrow(ombv.createOpenMBV(), which);
77  }
78 
80  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVMoment, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
81  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
82  std::vector<bool> which; which.resize(2, true);
83  LinkMechanics::setOpenMBVMomentArrow(ombv.createOpenMBV(), which);
84  }
85 #endif
86  private:
87  std::string saved_body1, saved_body2;
88  };
89 
90 }
91 
92 #endif
93 
Definition: friction.h:36
virtual bool isSingleValued() const
asks the link if it contains single valued force laws that contribute to the right-hand side vector h...
Definition: friction.h:51
InitStage
The stages of the initialization.
Definition: element.h:97
basic friction force law on acceleration level for constraint description
Definition: constitutive_laws.h:308
bool gActiveChanged()
Definition: friction.h:50
std::string name
name of element
Definition: element.h:290
void setGeneralizedFrictionForceLaw(FrictionForceLaw *func_)
Set the function for the torque calculation.
Definition: friction.cc:134
general link to one or more objects
Definition: link_mechanics.h:48
void updatehRef(const fmatvec::Vec &hParent, int j=0)
references to complete and link smooth force vector of dynamic system parent
Definition: friction.cc:58
bool isActive() const
Definition: friction.h:49
void plot(double t, double dt=1)
plots time dependent data
Definition: friction.cc:139
void init(InitStage stage)
plots time series header
Definition: friction.cc:97
std::string getType() const
Definition: friction.h:52

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML