From 19b23fbe4fd9bc2d272559d72bd09884809cc943 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sat, 14 Jun 2014 17:26:49 +0200 Subject: [PATCH] Enforce periodicity --- sample/gadgetToArray.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sample/gadgetToArray.cpp b/sample/gadgetToArray.cpp index 6f646c6..386fa01 100644 --- a/sample/gadgetToArray.cpp +++ b/sample/gadgetToArray.cpp @@ -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];