本文整理汇总了C++中StuntDouble::setFrc方法的典型用法代码示例。如果您正苦于以下问题:C++ StuntDouble::setFrc方法的具体用法?C++ StuntDouble::setFrc怎么用?C++ StuntDouble::setFrc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StuntDouble
的用法示例。
在下文中一共展示了StuntDouble::setFrc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcForces
void ThermoIntegrationForceManager::calcForces(){
Snapshot* curSnapshot;
SimInfo::MoleculeIterator mi;
Molecule* mol;
Molecule::IntegrableObjectIterator ii;
StuntDouble* sd;
Vector3d frc;
Vector3d trq;
Mat3x3d tempTau;
// perform the standard calcForces first
ForceManager::calcForces();
curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
// now scale forces and torques of all the sds
for (mol = info_->beginMolecule(mi); mol != NULL;
mol = info_->nextMolecule(mi)) {
for (sd = mol->beginIntegrableObject(ii); sd != NULL;
sd = mol->nextIntegrableObject(ii)) {
frc = sd->getFrc();
frc *= factor_;
sd->setFrc(frc);
if (sd->isDirectional()){
trq = sd->getTrq();
trq *= factor_;
sd->setTrq(trq);
}
}
}
// set rawPotential to be the unmodulated potential
lrPot_ = curSnapshot->getLongRangePotential();
curSnapshot->setRawPotential(lrPot_);
// modulate the potential and update the snapshot
lrPot_ *= factor_;
curSnapshot->setLongRangePotential(lrPot_);
// scale the pressure tensor
tempTau = curSnapshot->getStressTensor();
tempTau *= factor_;
curSnapshot->setStressTensor(tempTau);
// now, on to the applied restraining potentials (if needed):
RealType restPot_local = 0.0;
RealType vHarm_local = 0.0;
if (simParam->getUseRestraints()) {
// do restraints from RestraintForceManager:
restPot_local = doRestraints(1.0 - factor_);
vHarm_local = getUnscaledPotential();
}
#ifdef IS_MPI
RealType restPot;
MPI::COMM_WORLD.Allreduce(&restPot_local, &restPot, 1,
MPI::REALTYPE, MPI::SUM);
MPI::COMM_WORLD.Allreduce(&vHarm_local, &vHarm_, 1,
MPI::REALTYPE, MPI::SUM);
lrPot_ += restPot;
#else
lrPot_ += restPot_local;
vHarm_ = vHarm_local;
#endif
// give the final values to stats
curSnapshot->setLongRangePotential(lrPot_);
curSnapshot->setRestraintPotential(vHarm_);
}