--- trunk/OOPSE/libmdtools/ConstraintAlgorithm.hpp 2004/06/03 21:51:55 1232 +++ trunk/OOPSE/libmdtools/ConstraintAlgorithm.hpp 2004/06/11 17:16:21 1268 @@ -14,7 +14,13 @@ class SimInfo; class DistanceConstraintPair; class SimInfo; -enum ConsAlgoStatus{consFail, consSuccess, consAlready, consPairHandlerFail, consElemHandlerFail}; +enum ConsAlgoStatus{ + consExceedMaxIter = -4, //can not constrain the bond within maximum iteration + consPairHandlerFail = -3, //can not found call back functor for constraint pair + consElemHandlerFail = -2, //can not found callback functor for constraint element + consFail = -1, //Constraint Fail + consSuccess = 0, //constrain the pair by moving two elements + consAlready = 1}; //current pair is already constrained, do not need to move the elements //////////////////////////////////////////////////////////////////////////////// //Declaration of ConstraintAlgorithm @@ -26,14 +32,14 @@ class ConstraintAlgorithm{ class ConstraintAlgorithm{ public: - ~ConstraintAlgorithm(); - virtual void doConstrain(); + virtual ~ConstraintAlgorithm(); + virtual void doConstrain(); //using RTTI (Run Time Type Information) to dispatch int doConstrainPair(ConstraintPair* consPair); void registerCallback(const TypeInfo& ti, CallbackFunctor* functor); void unRegister(TypeInfo& ti); - + bool haveError() { return error;} protected: ConstraintAlgorithm(SimInfo* rhs); @@ -42,6 +48,8 @@ class ConstraintAlgorithm{ ConstraintElementIterator* ceIter; map callbackMap; + + bool error; }; //////////////////////////////////////////////////////////////////////////////// @@ -61,4 +69,13 @@ class ConsAlgoFramework{ }; +//Velocity Verlet constraint algorithm frame work +class VelVerletConsFramework : public ConsAlgoFramework{ + public: + virtual int doConstrainA() = 0; + virtual int doConstrainB() = 0; + protected: + VelVerletConsFramework(SimInfo* rhs) : ConsAlgoFramework(rhs){} +}; + #endif //endif _CONSTRAINTALGORITHM_H_