52 |
|
if (info_->getNGlobalConstraints() > 0) |
53 |
|
doRattle_ = true; |
54 |
|
|
55 |
+ |
if (!doRattle_) return; |
56 |
+ |
|
57 |
|
Globals* simParams = info_->getSimParams(); |
58 |
|
|
59 |
|
if (simParams->haveDt()) { |
75 |
|
constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + |
76 |
|
".constraintForces"; |
77 |
|
|
78 |
+ |
|
79 |
|
// create ConstraintWriter |
80 |
|
constraintWriter_ = new ConstraintWriter(info_, |
81 |
< |
constraintOutputFile_.c_str()); |
81 |
> |
constraintOutputFile_.c_str()); |
82 |
|
|
83 |
|
if (!constraintWriter_){ |
84 |
|
sprintf(painCave.errMsg, "Failed to create ConstraintWriter\n"); |
223 |
|
RealType rabsq = consPair->getConsDistSquare(); |
224 |
|
RealType diffsq = rabsq - pabsq; |
225 |
|
|
226 |
+ |
|
227 |
|
// the original rattle code from alan tidesley |
228 |
|
if (fabs(diffsq) > (consTolerance_ * rabsq * 2)){ |
229 |
|
|
230 |
|
Vector3d oldPosA = consElem1->getPrevPos(); |
231 |
|
Vector3d oldPosB = consElem2->getPrevPos(); |
232 |
|
|
233 |
< |
Vector3d rab = oldPosA - oldPosB; |
233 |
> |
Vector3d rab = oldPosA - oldPosB; |
234 |
|
|
235 |
|
currentSnapshot_->wrapVector(rab); |
236 |
|
|