a TON of stuff and changes

This commit is contained in:
Simon Gardling
2021-03-26 13:44:58 +00:00
parent e694c48d0a
commit 50b3f35059
11 changed files with 224 additions and 51 deletions

View File

@@ -4,33 +4,35 @@ use physarum::model;
use rand::Rng;
fn main() {
let n_iterations = 400;
let (width, height) = (1024, 1024);
let n_iterations = 16384;
// let (width, height) = (512, 512);
// let (width, height) = (1024, 1024);
let (width, height) = (2048, 2048);
let n_particles = 1 << 22;
println!("n_particles: {}", n_particles);
let diffusivity = 1;
let mut rng = rand::thread_rng();
loop {
let pb = ProgressBar::new(n_iterations);
pb.set_style(
ProgressStyle::default_bar()
.template(
"{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({eta})",
)
.progress_chars("#>-"),
);
let pb = ProgressBar::new(n_iterations);
pb.set_style(
ProgressStyle::default_bar()
.template(
"{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({eta} {percent}%, {per_sec})",
)
.progress_chars("#>-"),
);
let n_populations = 1 + rng.gen_range(1..4);
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity);
model.print_configurations();
let n_populations = 1 + rng.gen_range(1..4);
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity);
model.print_configurations();
for i in 0..n_iterations {
model.step();
pb.set_position(i);
}
pb.finish();
let now: DateTime<Utc> = Utc::now();
model.save_to_image(format!("out_{}.png", now.timestamp()).as_str());
for i in 0..n_iterations {
model.step();
pb.set_position(i);
}
pb.finish();
model.render_all_imgdata();
model.flush_image_data();
}