00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MAXWELL_CONTACT_H_
00022 #define MAXWELL_CONTACT_H_
00023
00024 #include <mbsim/object.h>
00025 #include <mbsim/contour.h>
00026 #include <mbsim/contour_pairing.h>
00027 #include <mbsim/contact_kinematics/contact_kinematics.h>
00028 #include <mbsim/link_mechanics.h>
00029 #include <mbsim/utils/function.h>
00030 #include <mbsim/utils/nonlinear_algebra.h>
00031 #include <mbsim/numerics/linear_complementarity_problem/linear_complementarity_problem.h>
00032
00033 #ifdef HAVE_OPENMBVCPPINTERFACE
00034 #include <openmbvcppinterface/group.h>
00035 #include <openmbvcppinterface/frame.h>
00036 #endif
00037
00038 #include <fmatvec.h>
00039 #include <map>
00040
00041 #ifdef HAVE_OPENMBVCPPINTERFACE
00042 namespace OpenMBV {
00043 class Frame;
00044 class Arrow;
00045 }
00046 #endif
00047
00048 namespace MBSim {
00049
00050 class GeneralizedForceLaw;
00051 class FrictionForceLaw;
00052 class GeneralizedImpactLaw;
00053 class FrictionImpactLaw;
00054 class ContourPointData;
00055
00064 class MaxwellContact : public MBSim::LinkMechanics {
00065 public:
00066
00071 MaxwellContact(const std::string &name);
00072
00076 virtual ~MaxwellContact() {
00077 }
00078
00079
00080 virtual void updateh(double t, int k=0);
00081 virtual void updateg(double t);
00082 virtual void updategd(double t);
00083 virtual void updateJacobians(double t, int j=0);
00084
00085
00086
00087 virtual void updatehRef(const fmatvec::Vec &hRef, int k=0);
00088 virtual void init(InitStage stage);
00089 virtual bool isSetValued() const {
00090 return false;
00091 }
00092 virtual bool isActive() const {
00093 return true;
00094 }
00095 virtual bool gActiveChanged() {
00096 return false;
00097 }
00098 virtual void checkActiveg();
00099
00100
00101
00102 void setParent(DynamicSystem *sys);
00103
00104
00105
00106 virtual std::string getType() const {
00107 return "MaxwellContact";
00108 }
00109 virtual void plot(double t, double dt = 1);
00110 virtual void closePlot();
00111
00112
00113
00114 ContourPairing* getContourPariing(const int & contactNumber) {
00115 return contourPairing[contactNumber];
00116 }
00117 void setLCPSolvingStrategy(LCPSolvingStrategy strategy) {
00118 lcpSolvingStrategy = strategy;
00119 }
00120
00121 LCPSolvingStrategy getLCPSolvingStrategy(void) {
00122 return lcpSolvingStrategy;
00123 }
00124
00128 void setDebuglevel(const int & Debuglevel_) {
00129 DEBUGLEVEL = Debuglevel_;
00130 }
00131
00132
00142 void addContourPairing(ContourPairing* contourPairing_);
00143
00152 void addContourCoupling(Contour *contour1, Contour *contour2, InfluenceFunction *fct);
00153
00154 protected:
00158 virtual void updatePossibleContactPoints();
00159
00163 virtual void updateInfluenceMatrix(const double t);
00164
00168 void updateRigidBodyGap(const double & t);
00169
00174 virtual double computeInfluenceCoefficient(const int ¤tContactNumber);
00175
00181 virtual double computeInfluenceCoefficient(const int ¤tContactNumber, const int &couplingContactNumber);
00182
00183
00184
00185
00186 virtual void computeMaterialConstant(const double & t);
00187
00191 virtual void fitSolution0(const double & t);
00192
00196 std::vector<ContourPairing*> contourPairing;
00197
00201 std::vector<int> possibleContactPoints;
00202
00206 fmatvec::SymMat C;
00207
00208
00209
00210
00211 fmatvec::Vec rigidBodyGap;
00212
00216 std::map<std::pair<Contour*, Contour*>, InfluenceFunction*> influenceFunctions;
00217
00221 LCPSolvingStrategy lcpSolvingStrategy;
00222
00226 fmatvec::Vec solution0;
00227
00231 double matConst;
00232
00236 bool matConstSetted;
00237
00247 int DEBUGLEVEL;
00248 };
00249
00250 }
00251 #endif