35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "board.hpp"
|
|
#include "pedestrian.hpp"
|
|
|
|
// Initializes the pedestrians used in the simulation.
|
|
//
|
|
// The returned array contains n_p pedestrians split into two groups:
|
|
// one group walking from left to right and one group walking from right to left.
|
|
// Pedestrian positions, desired speeds, destinations, and initial directions are
|
|
// initialized according to the simulation setup.
|
|
//
|
|
// @param n_p : Number of pedestrians to initialize.
|
|
// @return Pointer to a dynamically allocated array of pedestrians.
|
|
Pedestrian *init_pedestrians(int n_p);
|
|
|
|
// Initializes a simulation board with no obstacles inside.
|
|
//
|
|
// @return Initialized Board instance.
|
|
Board init_board_without_obstacles();
|
|
|
|
// Runs the social force model with n_p pedestrians for n_iter iterations,
|
|
// i.e., n_iter * dt simulated seconds.
|
|
// If dump_path is not nullptr, the simulation states are written to that CSV
|
|
// file, which can be used to generate a visualization video. If dump_path is
|
|
// nullptr, no output file is generated.
|
|
//
|
|
// @param pedestrians : Array of pedestrians to simulate. The array is updated in place.
|
|
// @param board : Board containing the simulation dimensions and obstacles.
|
|
// @param n_p : Number of pedestrians.
|
|
// @param n_iter : Number of simulation iterations.
|
|
// @param dump_path : Optional path to the CSV output file.
|
|
// @return 0 on success.
|
|
int run_simulation(Pedestrian *pedestrians, Board &board, int n_p, int n_iter, const char *dump_path);
|