mbsimflexiblebody  3.0.0
contour1s_flexible.h
1 /* Copyright (C) 2004-2011 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: thorsten.schindler@mytum.de
18  */
19 
20 #ifndef _CONTOUR1S_FLEXIBLE_H_
21 #define _CONTOUR1S_FLEXIBLE_H_
22 
23 #include "mbsim/contours/contour1s.h"
24 #include "mbsimFlexibleBody/utils/contact_utils.h"
25 #include "mbsimFlexibleBody/flexible_body.h"
26 
27 namespace MBSim {
28  class ContactKinematics;
29 }
30 
31 namespace MBSimFlexibleBody {
32 
41  class Contour1sFlexible : public MBSim::Contour1s {
42  public:
47  Contour1sFlexible(const std::string &name) : Contour1s(name) {}
48 
49  /* INHERITED INTERFACE OF ELEMENT */
50  virtual std::string getType() const { return "Contour1sFlexible"; }
51  /***************************************************/
52 
53  /* INHERITED INTERFACE OF CONTOUR */
54  virtual void updateKinematicsForFrame(MBSim::ContourPointData &cp, MBSim::FrameFeature ff) { static_cast<FlexibleBody*>(parent)->updateKinematicsForFrame(cp,ff); }
55  virtual void updateJacobiansForFrame(MBSim::ContourPointData &cp, int j=0) { static_cast<FlexibleBody*>(parent)->updateJacobiansForFrame(cp); }
56  /***************************************************/
57 
58  /* INHERITED INTERFACE OF CONTOURCONTINUUM */
59  virtual void computeRootFunctionPosition(MBSim::ContourPointData &cp) { updateKinematicsForFrame(cp, MBSim::position); }
60  virtual void computeRootFunctionFirstTangent(MBSim::ContourPointData &cp) { updateKinematicsForFrame(cp, MBSim::firstTangent); }
61  virtual void computeRootFunctionNormal(MBSim::ContourPointData &cp) { updateKinematicsForFrame(cp, MBSim::normal); }
62  virtual void computeRootFunctionSecondTangent(MBSim::ContourPointData &cp) { updateKinematicsForFrame(cp, MBSim::secondTangent); }
63  /***************************************************/
64 
65  MBSim::ContactKinematics * findContactPairingWith(std::string type0, std::string type1) {
66  return findContactPairingFlexible(type0.c_str(), type1.c_str());
67  }
68 
69  };
70 
71 }
72 
73 #endif /* _CONTOUR1S_FLEXIBLE_H_ */
74