cleanup and comments

This commit is contained in:
Simon Gardling
2021-03-29 14:01:04 +00:00
parent 611dd03acf
commit 59d060261d
3 changed files with 20 additions and 22 deletions

View File

@@ -1,34 +1,32 @@
use indicatif::{ProgressBar, ProgressStyle};
use physarum::model;
use rand::Rng;
fn main() {
// let n_iterations = 16384;
let n_iterations = 10;
// let n_iterations = 100;
// let n_iterations = 10;
// # of iterations to go through
let n_iterations = 1024;
// Size of grid and pictures
let (width, height) = (256, 256);
// let (width, height) = (512, 512);
// let (width, height) = (1024, 1024);
// let (width, height) = (2048, 2048);
// # of agents
let n_particles = 1 << 22;
// let n_particles = 1 << 10;
// let n_particles = 1 << 20;
// let n_particles = 100;
println!("n_particles: {}", n_particles);
let diffusivity = 1;
let mut rng = rand::thread_rng();
// let n_populations = 1 + rng.gen_range(1..4);
// `n_populations` is the # of types of agents
let n_populations = 2;
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity);
model.print_configurations();
model.run(n_iterations);
// let n_populations = 1 + rng.gen_range(1..4); // make # of populations between 2 and 5
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity); // Create the model
model.print_configurations(); // Print config for model
model.run(n_iterations); // Actually run the model
// export saved image data
println!("Rendering all saved image data....");
model.render_all_imgdata();
model.flush_image_data();