Enforce periodicity

This commit is contained in:
Guilhem Lavaux 2014-06-14 17:26:49 +02:00
parent e698201f38
commit 19b23fbe4f

View File

@ -75,6 +75,11 @@ int main(int argc, char **argv)
parts[q][0] = p->Pos[0][i]/1000;
parts[q][1] = p->Pos[1][i]/1000;
parts[q][2] = p->Pos[2][i]/1000;
for (int j = 0; j < 3; j++)
{
while (parts[q][j] < 0) parts[q][j] += L0;
while (parts[q][j] >= L0) parts[q][j] -= L0;
}
parts[q][3] = p->Vel[0][i];
parts[q][4] = p->Vel[1][i];
parts[q][5] = p->Vel[2][i];