mbsim  4.0.0
MBSim Kernel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
constraint.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 _CONSTRAINT_H
20 #define _CONSTRAINT_H
21 
22 #include "mbsim/element.h"
23 
24 namespace MBSim {
25 
30  class Constraint : public Element {
31  public:
32  Constraint(const std::string &name);
33  virtual void updateGeneralizedCoordinates() {}
34  virtual void updateGeneralizedJacobians(int j=0) { }
35  virtual void updatedx();
36  virtual void updatexd() { }
37  virtual void calcxSize() { xSize = 0; }
38  const fmatvec::Vec& getx() const { return x; }
39  fmatvec::Vec& getx() { return x; }
40  int getxInd() { return xInd; }
41  virtual void setxInd(int xInd_) { xInd = xInd_; };
42  int getxSize() const { return xSize; }
43  int getisInd() { return isInd; }
44  virtual void setisInd(int isInd_) { isInd = isInd_; }
45  int getisSize() { return isSize; }
46  virtual void updatexRef(fmatvec::Vec& xParent);
47  virtual void updatexdRef(fmatvec::Vec& xdParent);
48  virtual void updatedxRef(fmatvec::Vec& dxParent);
49  virtual void calcisSize() { isSize = 0; }
50 
56  virtual void aboutToUpdateInternalState() {}
57 
58  virtual void postprocessing() {}
59 
60  virtual void initz();
61  virtual void writez(H5::GroupBase *group);
62  virtual void readz0(H5::GroupBase *group);
63  virtual void setUpInverseKinetics() { }
64  std::shared_ptr<OpenMBV::Group> getOpenMBVGrp() override {return std::shared_ptr<OpenMBV::Group>();}
65  bool getUpdateGeneralizedCoordinates() const { return updGC; }
66  bool getUpdateGeneralizedJacobians() const { return updGJ; }
67  virtual void updateInternalStateRef(fmatvec::Vec& cur, fmatvec::Vec& next);
68  void resetUpToDate() override { updGC = true; updGJ = true; }
69 
70  const fmatvec::Vec& evalxd();
71 
72  void createPlotGroup() override;
73 
74  protected:
78  fmatvec::Vec x;
79 
83  fmatvec::Vec xd;
84 
85  fmatvec::Vec dx;
86 
90  fmatvec::Vec x0;
91 
92  fmatvec::Vec curis, nextis;
93 
97  int xSize, xInd;
98  int isSize, isInd;
99  bool updGC, updGJ;
100  };
101 
102 }
103 
104 #endif
int xSize
size and local index of order one parameters
Definition: constraint.h:97
void createPlotGroup() override
creates the plotGroup for H5-output
Definition: constraint.cc:78
basic class of MBSim mainly for plotting
Definition: element.h:56
fmatvec::Vec xd
differentiated order one parameters
Definition: constraint.h:83
fmatvec::Vec x
order one parameters
Definition: constraint.h:78
std::string name
name of element
Definition: element.h:260
Class for constraints between generalized coordinates of objects.
Definition: constraint.h:30
fmatvec::Vec x0
order one initial value
Definition: constraint.h:90
virtual void aboutToUpdateInternalState()
Definition: constraint.h:56