本文整理汇总了C++中ConfigurationPtr::setForces方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationPtr::setForces方法的具体用法?C++ ConfigurationPtr::setForces怎么用?C++ ConfigurationPtr::setForces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigurationPtr
的用法示例。
在下文中一共展示了ConfigurationPtr::setForces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gather
//.........这里部分代码省略.........
if (nVals != nIds) {
LOG4ESPP_ERROR(logger, "serious error collecting data, got " <<
nIds << " ids, but " << nVals << " coordinates");
}
}
if (gatherVel) {
req = system.comm->irecv<Real3D>(iproc, DEFAULT_TAG, velocities, maxN);
system.comm->send(iproc, DEFAULT_TAG, 0);
stat = req.wait();
nVals = *stat.count<Real3D>();
if (nVals != nIds) {
LOG4ESPP_ERROR(logger, "serious error collecting data, got " <<
nIds << " ids, but " << nVals << " velocities");
}
}
if (gatherForce) {
req = system.comm->irecv<Real3D>(iproc, DEFAULT_TAG, forces, maxN);
system.comm->send(iproc, DEFAULT_TAG, 0);
stat = req.wait();
nVals = *stat.count<Real3D>();
if (nVals != nIds) {
LOG4ESPP_ERROR(logger, "serious error collecting data, got " <<
nIds << " ids, but " << nVals << " forces");
}
}
if (gatherRadius) {
req = system.comm->irecv<real>(iproc, DEFAULT_TAG, radii, maxN);
system.comm->send(iproc, DEFAULT_TAG, 0);
stat = req.wait();
nVals = *stat.count<real>();
if (nVals != nIds) {
LOG4ESPP_ERROR(logger, "serious error collecting data, got " <<
nIds << " ids, but " << nVals << " radii");
}
}
nother = nIds;
} else {
nother = myN;
}
LOG4ESPP_INFO(logger, "add " << nother << " coordinates of proc " << iproc);
for (int i = 0; i < nother; i++) {
//LOG4ESPP_DEBUG(logger, "set coordinates of particle with id = " << index <<
// ": " << coordinates[3*i] << " " << coordinates[3*i+1] << " " << coordinates[3*i+2]);
int index = ids[i];
if (gatherPos) config->setCoordinates(index, coordinates[i]);
if (gatherVel) config->setVelocities(index, velocities[i]);
if (gatherForce) config->setForces(index, forces[i]);
if (gatherRadius) config->setRadius(index, radii[i]);
}
}
LOG4ESPP_INFO(logger, "save the latest configuration");
pushConfig(config);
} else {
LOG4ESPP_INFO(logger, "proc " << system.comm->rank() << " sends data "
<< " of " << myN << " particles");
// not master process, send data to master process
int tmp;
boost::mpi::status stat;
// wait for a signal (empty message) before sending
system.comm->irecv<int>(0, DEFAULT_TAG, tmp);
system.comm->send<int>(0, DEFAULT_TAG, ids, myN);
if (gatherPos) {
system.comm->irecv<int>(0, DEFAULT_TAG, tmp);
system.comm->send<Real3D>(0, DEFAULT_TAG, coordinates, myN);
}
if (gatherVel) {
system.comm->irecv<int>(0, DEFAULT_TAG, tmp);
system.comm->send<Real3D>(0, DEFAULT_TAG, velocities, myN);
}
if (gatherForce) {
system.comm->irecv<int>(0, DEFAULT_TAG, tmp);
system.comm->send<Real3D>(0, DEFAULT_TAG, forces, myN);
}
if (gatherRadius) {
system.comm->irecv<int>(0, DEFAULT_TAG, tmp);
system.comm->send<real>(0, DEFAULT_TAG, radii, myN);
}
}
// ToDo: remove first configuration if capacity is exhausted
// master process saves the configuration
if (gatherRadius) delete [] radii;
if (gatherForce) delete [] forces;
if (gatherVel) delete [] velocities;
if (gatherPos) delete [] coordinates;
delete [] ids;
}