17#include <SFML/Graphics.hpp>
29 int m_number_of_cases;
30 int m_number_of_steps;
34 std::vector<Cell*> m_cells_array;
35 std::vector<std::vector<int>> m_lattice;
37 std::vector<std::vector <float>> m_J;
38 std::vector<float> m_lambda_surface;
39 std::vector<float> m_lambda_length;
40 std::vector<float> m_lambda_chemotaxis;
42 std::vector<std::vector<double>> m_concentration_matrix;
46 Simulation(
int length_box,
int number_of_steps, std::vector<std::vector <float>> J, std::vector<float> lambda_surface, std::vector<float> lambda_length,
47 std::vector<float> lambda_chemotaxis,
float kT);
57 std::vector<std::vector <float>>
get_J();
62 void set_lattice(std::vector<std::vector<int>> lattice);
76 Cell*
create_cell(
int type,
int target_surface,
float target_length,sf::Color color);
82 void updateCellsLength();
89 void write_tail(std::ofstream &file,
float total_time);
91 void save_lattice(std::ofstream &file,
int step,
float time);
100 float calculate_total_hamiltonian();
109 void metropolis_algorithm(
int x,
int y,
int x_trial,
int y_trial,
float delta_H);
115 void simulation_step();
This is the cell header file for the Cellular Potts Model simulation : cell class.
This class represents the simulation of the Cellular Potts Model.
Definition Simulation.hpp:25
void remove_cell_from_lattice(Cell *c)
Remove a cell from the lattice.
Definition Simulation.cpp:302
void initialize_lattice(bool is_periodic)
Initialize the lattice.
Definition Simulation.cpp:201
std::vector< Cell * > get_cells_array()
Get the cells array This function returns the array of cells.
Definition Simulation.cpp:137
std::vector< int > monte_carlo_step()
Monte Carlo step of the simulation.
Definition Simulation.cpp:772
float calculate_energy_of_two_sites(int x1, int y1, int x2, int y2)
Calculate the energy of two sites.
Definition Simulation.cpp:491
Cell * create_cell(int type, int target_surface, float target_length, sf::Color color)
Create a cell.
Definition Simulation.cpp:256
void set_lattice(std::vector< std::vector< int > > lattice)
Set the lattice This function sets the lattice of the simulation.
Definition Simulation.cpp:187
void write_tail(std::ofstream &file, float total_time)
Write the tail of the data file to save the simulation.
Definition Simulation.cpp:418
std::vector< std::vector< int > > get_lattice()
Get the lattice This function returns the lattice of the simulation.
Definition Simulation.cpp:147
void updateCellShape(int x, int y, sf::RectangleShape &shape)
Update the shape of the cell.
Definition Simulation.cpp:1247
bool is_connectivity_broken(int x_trial, int y_trial, int cell_id)
Check if the connectivity is broken at a site.
Definition Simulation.cpp:629
void write_header(std::ofstream &file)
Write the header of the data file to save the simulation.
Definition Simulation.cpp:319
void run_simulation_sfml(const char *filename)
Run the simulation with SFML rendering.
Definition Simulation.cpp:1031
int get_number_of_steps()
Get the number of steps This function returns the number of steps of the simulation.
Definition Simulation.cpp:117
void save_lattice(std::ofstream &file, int step, float time)
Save the lattice to the data file.
Definition Simulation.cpp:445
~Simulation()
Destructor of the simulation.
Definition Simulation.cpp:81
float calculate_energy_of_site(int x, int y)
Calculate the energy of a site.
Definition Simulation.cpp:546
std::vector< float > get_lambda_surface()
Get the lambda surface vector This function returns the lambda surface vector of the simulation.
Definition Simulation.cpp:167
void run_simulation_sfml_diff(const char *filename)
Run the simulation with SFML rendering and diffusion.
Definition Simulation.cpp:1131
void run_simulation()
Run the simulation.
Definition Simulation.cpp:904
float calculate_local_hamiltonian(int x_trial, int y_trial, int cell_id_trial, int x, int y, int cell_id)
Calculate the local Hamiltonian of the simulation.
Definition Simulation.cpp:670
void display_lattice()
Display the lattice.
Definition Simulation.cpp:227
std::vector< std::vector< float > > get_J()
Get the J matrix This function returns the J matrix of the simulation.
Definition Simulation.cpp:157
int get_length_box()
Get the length of the box This function returns the size of the lattice.
Definition Simulation.cpp:97
int get_number_of_cases()
Get the number of cases This function returns the number of cases in the lattice.
Definition Simulation.cpp:107
void set_cells_array(std::vector< Cell * > cells_array)
Set the cells array This function sets the cells array of the simulation.
Definition Simulation.cpp:177
int get_number_of_cells()
Get the number of cells This function returns the number of cells in the simulation.
Definition Simulation.cpp:127
void add_cell_to_lattice(Cell *c, int safe_distance)
Add a cell to the lattice.
Definition Simulation.cpp:277
void run_and_save_simulation(int nb_save, const char *filename)
Run the simulation and save the data.
Definition Simulation.cpp:934