Some verbose logging if wanted (I'm running 50000 and dear god I'm bored)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
b94d001ab2
commit
183293fe7e
@ -53,4 +53,7 @@ pub struct ModelCli {
|
|||||||
|
|
||||||
#[arg(value_enum, short, long)]
|
#[arg(value_enum, short, long)]
|
||||||
pub output: PathBuf,
|
pub output: PathBuf,
|
||||||
|
|
||||||
|
#[arg(short, long)]
|
||||||
|
pub notify_every: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,10 +8,20 @@ use crate::system::walker::Walker;
|
|||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod output;
|
pub mod output;
|
||||||
|
|
||||||
pub fn drive_system<R: Rng, P: Position, S: Storage<P>, W: Walker<P>, Sp: Spawner<P>, St: Sticker<P, S>>(sys: &mut DLASystem<R, P, S, W, Sp, St>, max_frames: Option<usize>) {
|
pub fn drive_system<R: Rng, P: Position, S: Storage<P>, W: Walker<P>, Sp: Spawner<P>, St: Sticker<P, S>>(
|
||||||
|
sys: &mut DLASystem<R, P, S, W, Sp, St>,
|
||||||
|
max_frames: Option<usize>,
|
||||||
|
notify_every: Option<usize>,
|
||||||
|
) {
|
||||||
|
let mut previous_n: usize = 0;
|
||||||
while sys.running {
|
while sys.running {
|
||||||
sys.update();
|
sys.update();
|
||||||
|
|
||||||
|
if let Some(notify_every) = notify_every && (sys.history.len() % notify_every) == 0 && previous_n != sys.history.len() {
|
||||||
|
println!("On frame {}, deposited {} particles", sys.frame, sys.history.len());
|
||||||
|
previous_n = sys.history.len();
|
||||||
|
}
|
||||||
|
|
||||||
match max_frames {
|
match max_frames {
|
||||||
Some(max_frames) if max_frames <= sys.frame => {
|
Some(max_frames) if max_frames <= sys.frame => {
|
||||||
sys.running = false;
|
sys.running = false;
|
||||||
|
|||||||
11
src/main.rs
11
src/main.rs
@ -1,5 +1,6 @@
|
|||||||
#![feature(array_zip)]
|
#![feature(array_zip)]
|
||||||
#![feature(generic_const_exprs)]
|
#![feature(generic_const_exprs)]
|
||||||
|
#![feature(let_chains)]
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
@ -35,7 +36,7 @@ fn main() {
|
|||||||
cli.max_particles,
|
cli.max_particles,
|
||||||
);
|
);
|
||||||
|
|
||||||
drive_system(&mut sys, cli.max_frames);
|
drive_system(&mut sys, cli.max_frames, cli.notify_every);
|
||||||
write(&sys, cli.format, &cli.output);
|
write(&sys, cli.format, &cli.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ fn main() {
|
|||||||
cli.max_particles,
|
cli.max_particles,
|
||||||
);
|
);
|
||||||
|
|
||||||
drive_system(&mut sys, cli.max_frames);
|
drive_system(&mut sys, cli.max_frames, cli.notify_every);
|
||||||
write(&sys, cli.format, &cli.output);
|
write(&sys, cli.format, &cli.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ fn main() {
|
|||||||
cli.max_particles,
|
cli.max_particles,
|
||||||
);
|
);
|
||||||
|
|
||||||
drive_system(&mut sys, cli.max_frames);
|
drive_system(&mut sys, cli.max_frames, cli.notify_every);
|
||||||
write(&sys, cli.format, &cli.output);
|
write(&sys, cli.format, &cli.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ fn main() {
|
|||||||
cli.max_particles,
|
cli.max_particles,
|
||||||
);
|
);
|
||||||
|
|
||||||
drive_system(&mut sys, cli.max_frames);
|
drive_system(&mut sys, cli.max_frames, cli.notify_every);
|
||||||
write(&sys, cli.format, &cli.output);
|
write(&sys, cli.format, &cli.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ fn main() {
|
|||||||
cli.max_particles,
|
cli.max_particles,
|
||||||
);
|
);
|
||||||
|
|
||||||
drive_system(&mut sys, cli.max_frames);
|
drive_system(&mut sys, cli.max_frames, cli.notify_every);
|
||||||
write(&sys, cli.format, &cli.output);
|
write(&sys, cli.format, &cli.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user