diff --git a/main.cpp b/main.cpp index ffbc725..6e00475 100644 --- a/main.cpp +++ b/main.cpp @@ -58,7 +58,7 @@ int main(int argc, const char *argv[]) { // # (8 + 55N - 55 + 144 + 4 + 8 + 4 + 10)*n_p*n_iter for (int t = 0; t < n_iter; t++) { - + // Pass1: conmpute all forces from the current state for (int i = 0; i < n_p; i++) { Pedestrian &p = pedestrians[i]; @@ -73,7 +73,10 @@ int main(int argc, const char *argv[]) { // # 144 flops compute_repulsive_effects_from_borders(board, &p); - + } + // Pass2: integrate the forces and update the current state + for (int i = 0; i < n_p; i++) { + Pedestrian &p = pedestrians[i]; // # 4 flops = 2 ADDs, 2 MULTs Vector2d w_alpha = p.curr_vel + p.f_i * dt; @@ -91,18 +94,18 @@ int main(int argc, const char *argv[]) { std::cout << "W(n): "; std::cout << W; std::cout << " flops\n"; - + double T = stop_tsc(start); std::cout << "T(n): "; std::cout << T; std::cout << " cycles\n"; - double P = W/T; + double P = W / T; std::cout << "P(n): "; std::cout << P; std::cout << " flops/cycle\n"; - delete []pedestrians; + delete[] pedestrians; return 0; }