All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
extern_generalized_io.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 _EXTERNGENERALIZEDIO_H_
20 #define _EXTERNGENERALIZEDIO_H_
21 
22 #include "mbsim/link.h"
23 
24 namespace MBSim {
25 
26  class ExternGeneralizedIO : public Link {
27  protected:
28  Object *connectedObject;
29  int qInd, uInd;
30  double m, a, t0;
32  std::string saved_ref;
33  Object *ref;
34  double factor;
35  int index;
36  };
37  std::vector<ApplyForceAlsoTo> applyForceAlsoTo;
38  public:
39  enum Type {
40  constant, linear
41  };
42  ExternGeneralizedIO(const std::string &name="");
43  void updateh(double, int i=0);
44  void updateg(double);
45  void updategd(double);
46 
47  void calcxSize();
48  void updatedx(double t, double dt);
49  void updatexd(double t);
50 
51  bool isSingleValued() const { return true; }
52 
53  bool isActive() const { return true; }
54  bool gActiveChanged() { return false; }
55  std::string getType() const { return "ExternGeneralizedIO"; }
56  void init(InitStage stage);
57 
58  void connect(Object *obj, int qInd_, int uInd_) { connectedObject=obj; qInd=qInd_; uInd=uInd_; }
59  void setGeneralizedForce(double h) { la(0)=h; }
60  void setGeneralizedLinearForceParameters(double m_, double a_, double t0_) { m=m_; a=a_; t0=t0_; }
61  const double& getGeneralizedPosition() { return g(0); }
62  const double& getGeneralizedVelocity() { return gd(0); }
63 
64  void plot(double t, double dt=1);
65  void initializeUsingXML(xercesc::DOMElement *element);
66  Type getType() { return type; }
67 
68  virtual void updateWRef(const fmatvec::Mat&, int) {}
69  virtual void updateVRef(const fmatvec::Mat&, int) {}
70  virtual void updatehRef(const fmatvec::Vec&, int) {}
71  virtual void updatedhdqRef(const fmatvec::Mat&, int) {}
72  virtual void updatedhduRef(const fmatvec::SqrMat&, int) {}
73  virtual void updatedhdtRef(const fmatvec::Vec&, int) {}
74  virtual void updaterRef(const fmatvec::Vec&, int) {}
75 
76  void addApplyForceAlsoTo(Object *ref, double factor, int index);
77 
78  private:
79  std::string saved_connectedObject;
80  protected:
81  Type type;
82  };
83 
84 }
85 
86 #endif /* _SPRINGDAMPER_H_ */
std::string getType() const
Definition: extern_generalized_io.h:55
bool isSingleValued() const
asks the link if it contains single valued force laws that contribute to the right-hand side vector h...
Definition: extern_generalized_io.h:51
virtual void updatehRef(const fmatvec::Vec &, int)
references to complete and link smooth force vector of dynamic system parent
Definition: extern_generalized_io.h:70
void plot(double t, double dt=1)
plots time dependent data
Definition: extern_generalized_io.cc:116
Definition: extern_generalized_io.h:26
void init(InitStage stage)
plots time series header
Definition: extern_generalized_io.cc:76
virtual void updaterRef(const fmatvec::Vec &, int)
references to nonsmooth force vector of dynamic system parent
Definition: extern_generalized_io.h:74
InitStage
The stages of the initialization.
Definition: element.h:97
bool gActiveChanged()
Definition: extern_generalized_io.h:54
std::string name
name of element
Definition: element.h:290
virtual void updateWRef(const fmatvec::Mat &, int)
references to contact force direction matrix of dynamic system parent
Definition: extern_generalized_io.h:68
virtual void updateVRef(const fmatvec::Mat &, int)
references to condensed contact force direction matrix of dynamic system parent
Definition: extern_generalized_io.h:69
bool isActive() const
Definition: extern_generalized_io.h:53
Definition: extern_generalized_io.h:31
class for all objects having own dynamics and mass
Definition: object.h:42

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML