MBSim

Project Page
contour1s_analytical.h
1 /* Copyright (C) 2004-2009 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: thschindler@users.berlios.de
18  */
19 
20 #ifndef _CONTOUR1S_ANALYTICAL_H_
21 #define _CONTOUR1S_ANALYTICAL_H_
22 
23 #include "mbsim/contours/contour1s.h"
24 
25 namespace MBSim {
26 
27  class ContourFunction1s;
28  class ContactKinematics;
29 
36  class Contour1sAnalytical : public Contour1s {
37  public:
42  Contour1sAnalytical(const std::string &name) : Contour1s(name)
43 # ifdef HAVE_OPENMBVCPPINTERFACE
44  , openMBVRigidBody(0)
45 # endif
46  {}
47 
51  virtual ~Contour1sAnalytical();
52 
53  /* INHERITED INTERFACE OF ELEMENT */
54  std::string getType() const { return "Contour1sAnalytical"; }
55  virtual void plot(double t, double dt = 1);
56  /***************************************************/
57 
58  /* INHERITED INTERFACE OF CONTOUR */
60  virtual void updateJacobiansForFrame(ContourPointData &cp, int j=0);
61  virtual void init(InitStage stage);
62  virtual double computeCurvature(ContourPointData &cp);
63  virtual double computeDistance(const double s, const int order=0);
64  /***************************************************/
65 
66  /* INHERITED INTERFACE OF CONTOURCONTINUUM */
68  virtual void computeRootFunctionFirstTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,firstTangent); }
69  virtual void computeRootFunctionNormal(ContourPointData &cp) { updateKinematicsForFrame(cp,normal); }
70  virtual void computeRootFunctionSecondTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,secondTangent); }
71  /***************************************************/
72 
73  /* GETTER / SETTER */
74  void setContourFunction1s(ContourFunction1s* f) { funcCrPC = f; }
75  ContourFunction1s* getContourFunction1s() { return funcCrPC; }
76  /***************************************************/
77 
78 #ifdef HAVE_OPENMBVCPPINTERFACE
79  void enableOpenMBV(bool enable=true);
80 #endif
81 
82  virtual void initializeUsingXML(TiXmlElement *element);
83 
89  ContactKinematics * findContactPairingWith(std::string type0, std::string type1);
90 
91  protected:
92  ContourFunction1s * funcCrPC;
93 #ifdef HAVE_OPENMBVCPPINTERFACE
94  OpenMBV::RigidBody *openMBVRigidBody;
95 #endif
96  };
97 
98 }
99 
100 #endif /* _CONTOUR1S_ANALYTICAL_H_ */
101