created two passes
Pass1: compute all forces Pass2: integrate the forces and do the updates If we dont separate it, we will have some inter pedestrian forces calculated on a mix of new and updated values
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user