本文整理汇总了C++中Lattice::delta方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::delta方法的具体用法?C++ Lattice::delta怎么用?C++ Lattice::delta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lattice
的用法示例。
在下文中一共展示了Lattice::delta方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doWork
void ComputeDPME::doWork()
{
DebugM(4,"Entering ComputeDPME::doWork().\n");
Pme2Particle *localData;
ResizeArrayIter<PatchElem> ap(patchList);
// Skip computations if nothing to do.
if ( ! patchList[0].p->flags.doFullElectrostatics )
{
for (ap = ap.begin(); ap != ap.end(); ap++) {
CompAtom *x = (*ap).positionBox->open();
Results *r = (*ap).forceBox->open();
(*ap).positionBox->close(&x);
(*ap).forceBox->close(&r);
}
if ( master ) {
master->reduction->submit();
}
return;
}
// allocate storage
numLocalAtoms = 0;
for (ap = ap.begin(); ap != ap.end(); ap++) {
numLocalAtoms += (*ap).p->getNumAtoms();
}
Lattice lattice = patchList[0].p->flags.lattice;
localData = new Pme2Particle[numLocalAtoms]; // given to message
// get positions and charges
Pme2Particle * data_ptr = localData;
const BigReal coulomb_sqrt = sqrt( COULOMB * ComputeNonbondedUtil::scaling
* ComputeNonbondedUtil::dielectric_1 );
for (ap = ap.begin(); ap != ap.end(); ap++) {
CompAtom *x = (*ap).positionBox->open();
if ( patchList[0].p->flags.doMolly ) {
(*ap).positionBox->close(&x);
x = (*ap).avgPositionBox->open();
}
int numAtoms = (*ap).p->getNumAtoms();
for(int i=0; i<numAtoms; ++i)
{
Vector tmp = lattice.delta(x[i].position);
data_ptr->x = tmp.x;
data_ptr->y = tmp.y;
data_ptr->z = tmp.z;
data_ptr->cg = coulomb_sqrt * x[i].charge;
data_ptr->id = x[i].id;
++data_ptr;
}
if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); }
else { (*ap).positionBox->close(&x); }
}
// send data to master
ComputeDPMEDataMsg *msg = new ComputeDPMEDataMsg;
msg->node = CkMyPe();
msg->numParticles = numLocalAtoms;
msg->particles = localData;
comm->sendComputeDPMEData(msg);
}