ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ConstraintElement.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/ConstraintElement.hpp (file contents):
Revision 1451 by tim, Mon Jun 21 18:52:21 2004 UTC vs.
Revision 1452 by tim, Mon Aug 23 15:11:36 2004 UTC

# Line 3 | Line 3
3  
4   #include "RigidBody.hpp"
5   #include "Atom.hpp"
6 + #include "Vector3d.hpp"
7  
8  
9 + class Vector3dData : public GenericData{
10 +  public:
11 +    Vector3d getData() {return vec;}
12 +    void setData(const Vector3d& rhs) { vec = rhs;}
13 +  private:
14 +    Vector3d vec;
15 +
16 + };
17 +
18   //class ConstraintElement is designed to not only provide the interface of StuntDouble, but also
19   //neccessary functionality to retrieve old position, old velocity and etc.
20   //First of all, those old data should be stored inside StuntDouble. We decide to store it on StuntDouble's
# Line 76 | Line 86 | class ConstraintElement{
86      bool getMoving() {return movingData->getData();}
87      void setMoving(bool status) {movingData->setData(status);}
88  
89 +    //constraint force
90 +    void addConsForce(const Vector3d& frc){
91 +      Vector3d tempFrc;
92 +      tempFrc = consForceData->getData();
93 +      tempFrc += frc;
94 +      consForceData->setData(tempFrc);
95 +    }    
96 +    Vector3d getConsForce() { return consForceData->getData();}
97 +    void setConsTorque(const Vector3d& frc) {consForceData->setData(frc);}
98 +
99 +    
100 +    //constraint torque
101 +    void addConsTorque(const Vector3d& trq){
102 +      Vector3d tempTrq;
103 +      tempTrq = consTorqueData->getData();
104 +      tempTrq += trq;
105 +      consTorqueData->setData(tempTrq);
106 +    }    
107 +    Vector3d getConsTorque() { return consTorqueData->getData();}
108 +    void setConsForce(const Vector3d& trq) {consTorqueData->setData(trq);}
109 +    
110 +
111      virtual void saveOldState() = 0;
112      
113    protected:
# Line 86 | Line 118 | class ConstraintElement{
118    private:
119      BoolData* movedData;
120      BoolData* movingData;
121 <
121 >    Vector3dData* consForceData;
122 >    Vector3dData* consTorqueData;
123   };
124  
125  
# Line 99 | Line 132 | struct ConsAtomInfo{
132    double a[3][3];
133    double j[3];
134    double q[4];
135 +  double frc[3];
136 +  double trq[3];
137   };
138  
139   class ConsAtomData : public GenericData{
# Line 189 | Line 224 | class ConstraintRigidBody : public ConstraintElement{
224      RigidBody* getRigidBody() { return dynamic_cast<RigidBody*>(refSd);}
225  
226      virtual void saveOldState();
227 +
228 +    void restoreUnconsStatus();
229 +  
230      
231    private:
232      int consAtomIndex;
233      RigidBody* oldRb;
234 +
235   };
236   #endif // endif _CONSTRAINTELEMENT_H_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines