14 |
|
class DistanceConstraintPair; |
15 |
|
class SimInfo; |
16 |
|
|
17 |
< |
enum ConsAlgoStatus{consFail, consSuccess, consAlready, consPairHandlerFail, consElemHandlerFail}; |
17 |
> |
enum ConsAlgoStatus{ |
18 |
> |
consExceedMaxIter = -4, //can not constrain the bond within maximum iteration |
19 |
> |
consPairHandlerFail = -3, //can not found call back functor for constraint pair |
20 |
> |
consElemHandlerFail = -2, //can not found callback functor for constraint element |
21 |
> |
consFail = -1, //Constraint Fail |
22 |
> |
consSuccess = 0, //constrain the pair by moving two elements |
23 |
> |
consAlready = 1}; //current pair is already constrained, do not need to move the elements |
24 |
|
|
25 |
|
//////////////////////////////////////////////////////////////////////////////// |
26 |
|
//Declaration of ConstraintAlgorithm |
32 |
|
class ConstraintAlgorithm{ |
33 |
|
|
34 |
|
public: |
35 |
< |
~ConstraintAlgorithm(); |
36 |
< |
virtual void doConstrain(); |
35 |
> |
virtual ~ConstraintAlgorithm(); |
36 |
> |
virtual void doConstrain(); |
37 |
|
|
38 |
|
//using RTTI (Run Time Type Information) to dispatch |
39 |
|
int doConstrainPair(ConstraintPair* consPair); |
40 |
|
void registerCallback(const TypeInfo& ti, CallbackFunctor* functor); |
41 |
|
void unRegister(TypeInfo& ti); |
42 |
< |
|
42 |
> |
bool haveError() { return error;} |
43 |
|
protected: |
44 |
|
ConstraintAlgorithm(SimInfo* rhs); |
45 |
|
|
48 |
|
ConstraintElementIterator* ceIter; |
49 |
|
|
50 |
|
map<TypeInfo, CallbackFunctor*> callbackMap; |
51 |
+ |
|
52 |
+ |
bool error; |
53 |
|
}; |
54 |
|
|
55 |
|
//////////////////////////////////////////////////////////////////////////////// |
69 |
|
|
70 |
|
}; |
71 |
|
|
72 |
+ |
//Velocity Verlet constraint algorithm frame work |
73 |
+ |
class VelVerletConsFramework : public ConsAlgoFramework{ |
74 |
+ |
public: |
75 |
+ |
virtual int doConstrainA() = 0; |
76 |
+ |
virtual int doConstrainB() = 0; |
77 |
+ |
protected: |
78 |
+ |
VelVerletConsFramework(SimInfo* rhs) : ConsAlgoFramework(rhs){} |
79 |
+ |
}; |
80 |
+ |
|
81 |
|
#endif //endif _CONSTRAINTALGORITHM_H_ |