--- trunk/OOPSE/libmdtools/ConstraintAlgorithm.cpp 2004/06/04 03:15:31 1234 +++ trunk/OOPSE/libmdtools/ConstraintAlgorithm.cpp 2004/06/04 19:30:05 1248 @@ -2,6 +2,7 @@ #include "ConstraintPair.hpp" #include "SimInfo.hpp" #include "ConstraintManager.hpp" +#include "simError.h" //////////////////////////////////////////////////////////////////////////////// //Implementation of ConstraintAlgorithm @@ -27,7 +28,7 @@ void ConstraintAlgorithm::doConstrain(){ } void ConstraintAlgorithm::doConstrain(){ - const int maxConsIteration = 30; + const int maxConsIteration = 300; bool done; int iteration; int maxIteration; @@ -37,6 +38,7 @@ void ConstraintAlgorithm::doConstrain(){ int exeStatus; + error = false; for(ceIter->first(); !ceIter->isEnd(); ceIter->next()){ consElem = ceIter->currentItem(); @@ -62,7 +64,8 @@ void ConstraintAlgorithm::doConstrain(){ switch(exeStatus){ case consFail: - cerr << "ConstraintAlgorithm::doConstrain() Error: Constraint Fail" << endl; + cerr << "ConstraintAlgorithm::doConstrain() Error: Constraint Fail" << endl; + error = true; break; case consSuccess: //constrain the pair by moving two elements @@ -76,13 +79,16 @@ void ConstraintAlgorithm::doConstrain(){ case consPairHandlerFail: //can not found call back functor for constraint pair cerr << "ConstraintAlgorithm::doConstrain() Error: can not found callback functor for constraint pair " << endl; + error = true; break; case consElemHandlerFail: //can not found callback functor for constraint element cerr << "ConstraintAlgorithm::doConstrain() Error: can not found callback functor for constraint element " << endl; + error = true; break; default: cerr << "ConstraintAlgorithm::doConstrain() Error: unrecognized status" << endl; + error = true; break; } }//end for(iter->first()) @@ -95,7 +101,15 @@ void ConstraintAlgorithm::doConstrain(){ iteration++; }//end while - + + //if (!done){ + // error = true; + // sprintf(painCave.errMsg, + // "Constraint failure in constrainB, too many iterations: %d\n", + // iteration); + // painCave.isFatal = 1; + // simError(); + //} }