From a7bc5599bc7221cdc5ea44f9979e403effc1f153 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Fri, 26 Mar 2021 14:03:26 +0000 Subject: [PATCH] small changes --- src/main.rs | 2 ++ src/model.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index 7694354..8094a61 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,8 @@ fn main() { } pb.finish(); + println!("Rendering all saved image data...."); model.render_all_imgdata(); model.flush_image_data(); + println!("Done!"); } diff --git a/src/model.rs b/src/model.rs index 968514a..2f9d8ce 100644 --- a/src/model.rs +++ b/src/model.rs @@ -18,6 +18,8 @@ use rayon::iter::{ParallelIterator, IntoParallelIterator}; use indicatif::{ParallelProgressIterator, ProgressBar, ProgressStyle}; +use std::path::Path; + /// A single Physarum agent. The x and y positions are continuous, hence we use floating point /// numbers instead of integers. #[derive(Debug)] @@ -235,6 +237,10 @@ impl Model { } pub fn render_all_imgdata(&self) { + if not Path::new("./tmp").exists() { + std::fs::create_dir("./tmp"); + } + let pb = ProgressBar::new(self.img_data_vec.len() as u64); pb.set_style(ProgressStyle::default_bar().template( "{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] ({pos}/{len}, {percent}%, {per_sec})",