本文整理汇总了C++中Phase::particles方法的典型用法代码示例。如果您正苦于以下问题:C++ Phase::particles方法的具体用法?C++ Phase::particles怎么用?C++ Phase::particles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phase
的用法示例。
在下文中一共展示了Phase::particles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeForces
void FParticleVectorMatrix::computeForces(Particle* part, int force_index)
{
Phase *phase = ((Simulation *) m_parent)->phase();
size_t nOfParts = phase->returnNofPartC(m_colour);
ParticleList& particles = phase->particles(m_colour);
// slow (constant for this call) particle-row-index
size_t p1 = part->mySlot;
size_t p1Contrib = p1*SPACE_DIMS*nOfParts*SPACE_DIMS;
// the force to be modified
point_t force = {0,0,0};
// outer (slow) cartesian loop
for(size_t d1 = 0; d1 < SPACE_DIMS; ++d1) {
size_t d1Contrib = d1*SPACE_DIMS*nOfParts;
// inner (fast) particle loop
for(size_t p2 = 0; p2 < nOfParts; ++p2) {
point_t& vec = particles[p2].tag.pointByOffset(m_invec_offset);
// inner (fast) cartesian loop
for(size_t d2 = 0; d2 < SPACE_DIMS; ++d2) {
size_t slot = d2
+ p2*SPACE_DIMS
+ d1Contrib
+ p1Contrib;
force[d1] += -m_mat[slot]*vec[d2];
}}}
part->tag.pointByOffset(m_force_offset[force_index]) += force*m_factor;
//MSG_DEBUG("FParticleVectorMatrix::computeForces", "force AFTER = " << part->tag.tensorByOffset(m_force_offset[force_index]));
}