Skip to content

Commit 3d32113

Browse files
Added more parallelization
1 parent 5029d53 commit 3d32113

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/gravity/step.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ inline void Step(std::vector<Particle>& p, real dt) {
1414
root.computeMass();
1515

1616
real theta = 0.5;
17-
17+
1818
#pragma omp parallel for schedule(static)
19-
for (int i = 0; i < p.size(); i++) {
20-
bhForce(&root, p[i], theta, dt);
19+
for (int i = 0; i < p.size(); i++) {
20+
bhForce(&root, p[i], theta, dt);
2121
}
2222

23+
#pragma omp parallel for
2324
for (auto& a : p) {
2425
a.x += a.vx * dt;
2526
a.y += a.vy * dt;
@@ -28,3 +29,4 @@ inline void Step(std::vector<Particle>& p, real dt) {
2829

2930

3031
}
32+

0 commit comments

Comments
 (0)