ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ConstraintPair.hpp
Revision: 1452
Committed: Mon Aug 23 15:11:36 2004 UTC (19 years, 10 months ago) by tim
File size: 1294 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 tim 1232 #ifndef _CONSTRAINT_PAIR_H_
2     #define _CONSTRAINT_PAIR_H_
3    
4     #include "ConstraintElement.hpp"
5    
6     class ConstraintAlgorithm;
7     class ConstraintPair{
8     public:
9 gezelter 1252 virtual ~ConstraintPair() {}
10 tim 1232 ConstraintElement* firstElem;
11     ConstraintElement* secondElem;
12    
13     bool isMoved() {return firstElem->getMoved() || secondElem->getMoved();}
14     virtual double getBondLength2() = 0;
15 tim 1452
16     double getLamda() {return lamda;}
17     void setLamda(double l) {lamda = l;}
18    
19     //double getDistance();
20 tim 1232
21     protected:
22     ConstraintPair(ConstraintElement* ce1, ConstraintElement* ce2) : firstElem(ce1), secondElem(ce2){}
23 tim 1452
24     private:
25     double lamda;
26 tim 1232 };
27    
28    
29     //Constrain two linked rigid bodies which share the same joint
30     class JointConstraintPair : public ConstraintPair{
31     public:
32     JointConstraintPair(ConstraintElement* ce1, ConstraintElement* ce2) : ConstraintPair(ce1, ce2){}
33     double getBondLength2() {return 0;}
34     };
35    
36     //constraint two
37     class DistanceConstraintPair : public ConstraintPair{
38     public:
39     DistanceConstraintPair(ConstraintElement* ce1, ConstraintElement* ce2, double bondLength2)
40     : ConstraintPair(ce1, ce2), d2(bondLength2){}
41     double getBondLength2() {return d2;}
42     private:
43     double d2;
44     };
45    
46     #endif //ifndef _CONSTRAINT_PAIR_H_

Properties

Name Value
svn:executable *