| 3 | 
  | 
#include "SimInfo.hpp" | 
| 4 | 
  | 
#include "ConstraintManager.hpp" | 
| 5 | 
  | 
#include "simError.h" | 
| 6 | 
+ | 
#include "Vector3d.hpp" | 
| 7 | 
  | 
 | 
| 8 | 
  | 
//////////////////////////////////////////////////////////////////////////////// | 
| 9 | 
  | 
//Implementation of ConstraintAlgorithm | 
| 10 | 
  | 
//////////////////////////////////////////////////////////////////////////////// | 
| 11 | 
  | 
ConstraintAlgorithm::ConstraintAlgorithm(SimInfo* rhs){ | 
| 12 | 
  | 
  info = rhs; | 
| 13 | 
< | 
  cpIter = info->consMan->creatPairIterator(); | 
| 14 | 
< | 
  ceIter = info->consMan->creatElementIterator();   | 
| 13 | 
> | 
  cpIter = info->consMan->createPairIterator(); | 
| 14 | 
> | 
  ceIter = info->consMan->createElementIterator();   | 
| 15 | 
  | 
} | 
| 16 | 
  | 
 | 
| 17 | 
  | 
ConstraintAlgorithm::~ConstraintAlgorithm(){ | 
| 29 | 
  | 
} | 
| 30 | 
  | 
 | 
| 31 | 
  | 
void ConstraintAlgorithm::doConstrain(){ | 
| 32 | 
< | 
  const int maxConsIteration = 300; | 
| 32 | 
> | 
  const int maxConsIteration = 20; | 
| 33 | 
  | 
  bool done; | 
| 34 | 
  | 
  int iteration; | 
| 35 | 
  | 
  int maxIteration; | 
| 38 | 
  | 
  ConstraintPair* consPair; | 
| 39 | 
  | 
  int exeStatus; | 
| 40 | 
  | 
 | 
| 40 | 
– | 
 | 
| 41 | 
  | 
  error = false; | 
| 42 | 
  | 
   | 
| 43 | 
  | 
  for(ceIter->first(); !ceIter->isEnd(); ceIter->next()){ | 
| 64 | 
  | 
 | 
| 65 | 
  | 
      switch(exeStatus){ | 
| 66 | 
  | 
        case consExceedMaxIter: | 
| 67 | 
< | 
          cerr << "ConstraintAlgorithm::doConstrain() Error: can not constrain the bond within maximum iteration" << endl;          | 
| 67 | 
> | 
          //cerr << "ConstraintAlgorithm::doConstrain() Error: can not constrain the bond within maximum iteration" << endl;          | 
| 68 | 
  | 
          error = true; | 
| 69 | 
  | 
           | 
| 70 | 
  | 
        case consFail: | 
| 71 | 
< | 
          cerr << "ConstraintAlgorithm::doConstrain() Error: Constraint Fail" << endl;          | 
| 71 | 
> | 
          //cerr << "ConstraintAlgorithm::doConstrain() Error: Constraint Fail" << endl;          | 
| 72 | 
  | 
          error = true; | 
| 73 | 
  | 
          break; | 
| 74 | 
  | 
        case consSuccess: | 
| 160 | 
  | 
//Implementation of ConsAlgoFramework | 
| 161 | 
  | 
//////////////////////////////////////////////////////////////////////////////// | 
| 162 | 
  | 
ConsAlgoFramework::ConsAlgoFramework(SimInfo* rhs){ | 
| 163 | 
< | 
  ceIter = rhs->consMan->creatElementIterator();   | 
| 163 | 
> | 
  ceIter = rhs->consMan->createElementIterator();   | 
| 164 | 
  | 
} | 
| 165 | 
  | 
 | 
| 166 | 
  | 
ConsAlgoFramework::~ConsAlgoFramework(){ | 
| 169 | 
  | 
 | 
| 170 | 
  | 
void ConsAlgoFramework::doPreConstraint(){ | 
| 171 | 
  | 
  ConstraintElement* consElem; | 
| 172 | 
+ | 
  Vector3d zeroVector(0.0, 0.0, 0.0); | 
| 173 | 
  | 
   | 
| 174 | 
  | 
  for(ceIter->first(); !ceIter->isEnd(); ceIter->next()){ | 
| 175 | 
  | 
    consElem =  ceIter->currentItem(); | 
| 176 | 
  | 
    consElem->saveOldState(); | 
| 177 | 
+ | 
    consElem->setConsForce(zeroVector); | 
| 178 | 
+ | 
    consElem->setConsTorque(zeroVector); | 
| 179 | 
  | 
  } | 
| 180 | 
  | 
}   |