1 |
tim |
1232 |
#ifndef _SHAKE_H_ |
2 |
|
|
#define _SHAKE_H_ |
3 |
|
|
#include "ConstraintAlgorithm.hpp" |
4 |
|
|
#include "ConstraintPair.hpp" |
5 |
|
|
|
6 |
|
|
class DCShakeFunctor : public CallbackFunctor{ |
7 |
|
|
public: |
8 |
|
|
DCShakeFunctor(SimInfo* rhs) : CallbackFunctor(rhs){} |
9 |
|
|
protected: |
10 |
|
|
virtual int operator()(ConstraintAtom* consAtom1, ConstraintAtom* consAtom2); |
11 |
|
|
virtual int operator()(ConstraintAtom* consAtom,ConstraintRigidBody* consRB); |
12 |
|
|
virtual int operator()(ConstraintRigidBody* consRB1, ConstraintRigidBody* consRB2); |
13 |
|
|
}; |
14 |
|
|
|
15 |
|
|
class JCShakeFunctor : public CallbackFunctor{ |
16 |
|
|
public: |
17 |
|
|
JCShakeFunctor(SimInfo* rhs) : CallbackFunctor(rhs){} |
18 |
|
|
protected: |
19 |
|
|
virtual int operator()(ConstraintAtom* consAtom1, ConstraintAtom* consAtom2); |
20 |
|
|
virtual int operator()(ConstraintAtom* consAtom,ConstraintRigidBody* consRB); |
21 |
|
|
virtual int operator()(ConstraintRigidBody* consRB1, ConstraintRigidBody* consRB2); |
22 |
|
|
}; |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
//SHAKE constraint algorithm |
26 |
|
|
//Reference: |
27 |
|
|
//[1] J.P. Ryckaert, G.Ciccotti and H.J.C. Berendsen, J. Comput. Phys., 23, 327 (1977) |
28 |
|
|
//[2] |
29 |
|
|
//[3] |
30 |
|
|
class Shake : public ConstraintAlgorithm{ |
31 |
|
|
public: |
32 |
|
|
Shake(SimInfo* rhs) : ConstraintAlgorithm(rhs){ |
33 |
|
|
registerCallback(typeid(DistanceConstraintPair), new DCShakeFunctor(rhs)); |
34 |
|
|
registerCallback(typeid(JointConstraintPair), new JCShakeFunctor(rhs)); |
35 |
|
|
} |
36 |
|
|
}; |
37 |
|
|
|
38 |
|
|
//////////////////////////////////////////////////////////////////////////////// |
39 |
|
|
//Declaration of ShakeMinAlgorithm |
40 |
|
|
//////////////////////////////////////////////////////////////////////////////// |
41 |
|
|
//class ShakeMinAlgorithm will encapsulate preConstraint, ShakeMinR and ShakeMinF |
42 |
|
|
class ShakeFrameWork : public ConsAlgoFramework{ |
43 |
|
|
public: |
44 |
|
|
ShakeFrameWork(SimInfo* rhs) : ConsAlgoFramework(rhs){ |
45 |
|
|
shakeAlgo = new Shake(rhs); |
46 |
|
|
|
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
~ShakeFrameWork(){ |
50 |
|
|
delete shakeAlgo; |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
void doShake(){ |
54 |
|
|
shakeAlgo->doConstrain(); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
private: |
58 |
|
|
Shake* shakeAlgo; |
59 |
|
|
|
60 |
|
|
}; |
61 |
|
|
#endif //end ifndef _SHAKE_H_ |