diff --git a/src/imgdata.rs b/src/imgdata.rs index 6f55000..7d9a6c4 100644 --- a/src/imgdata.rs +++ b/src/imgdata.rs @@ -1,6 +1,6 @@ use crate::{ - grid::{combine, Grid, PopulationConfig}, - palette::{random_palette, Palette}, + grid::{Grid}, + palette::{Palette}, }; diff --git a/src/main.rs b/src/main.rs index a85d214..c8fd59c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(); diff --git a/src/model.rs b/src/model.rs index fdb8585..7f55f04 100644 --- a/src/model.rs +++ b/src/model.rs @@ -9,8 +9,8 @@ use rand_distr::{Distribution, Normal}; use rayon::prelude::*; use itertools::multizip; use std::f32::consts::TAU; -use std::time::{Duration, Instant}; -use rayon::iter::{ParallelIterator, IntoParallelIterator}; +use std::time::{Instant}; +use rayon::iter::{ParallelIterator,}; use indicatif::{ParallelProgressIterator, ProgressBar, ProgressStyle}; use std::path::Path; @@ -191,7 +191,7 @@ impl Model { combine(grids, &self.attraction_table); let agents_tick_time = Instant::now(); self.agents.par_iter_mut().for_each(|agent| { - let i: usize = agent.i; + // let i: usize = agent.i; let grid = &grids[agent.population_id]; let (width, height) = (grid.width, grid.height);