Improve CLI a little
This commit is contained in:
parent
664aa87538
commit
f0ea44bb1a
@ -40,10 +40,16 @@ pub struct SurfaceProbabilityMeasureCli {
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum PCM {
|
||||
/// Traditional DLA model in a fixed-size 2D grid
|
||||
Initial(InitialCli),
|
||||
|
||||
/// Traditional DLA model in a fixed-size 2D grid with a probabilistic sticking component
|
||||
StickProbability(StickProbabilityCli),
|
||||
|
||||
/// Traditional DLA model in unbounded 3D space with probabilistic sticking
|
||||
Grid3d(KDStickProbabilityCli),
|
||||
|
||||
/// Traditional DLA model in unbounded 3D space with probabilistic sticking and off-axis walks
|
||||
Grid3dOffAxis(KDStickProbabilityCli),
|
||||
|
||||
Hex(StickProbabilityCli),
|
||||
@ -59,13 +65,13 @@ pub struct ModelCli {
|
||||
#[command(subcommand)]
|
||||
pub preconfigured_model: PCM,
|
||||
|
||||
#[arg(long)]
|
||||
#[arg(long, help = "Set the maximum number of ticks the system will run before exiting, will still produce data after this has been reached.")]
|
||||
pub max_frames: Option<usize>,
|
||||
|
||||
#[arg(short = 'N', long)]
|
||||
pub max_particles: usize,
|
||||
|
||||
#[arg(long, short)]
|
||||
#[arg(long, short, help = "Specifying a seed allows for deterministic runs (when combined with other parameters such as -N)")]
|
||||
pub seed: u64,
|
||||
|
||||
#[arg(value_enum, short, long, default_value_t = OutputFormat::Positions)]
|
||||
@ -74,6 +80,9 @@ pub struct ModelCli {
|
||||
#[arg(value_enum, short, long)]
|
||||
pub output: PathBuf,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "If the output file already exists, skipping running. Useful when running deterministically.")]
|
||||
pub preserve_existing: bool,
|
||||
|
||||
#[arg(short, long)]
|
||||
pub notify_every: Option<usize>,
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ use crate::system::spaces::square_grid::{Grid2D, Grid3D};
|
||||
use crate::system::spaces::VectorStorage;
|
||||
use crate::system::spawner::UniformSpawner;
|
||||
use crate::system::sticker::{ProbabilisticSticking, SimpleSticking};
|
||||
use crate::system::walker::{DiagonalRandomWalker, LocalRandomWalker};
|
||||
use crate::system::walker::{DiagonalRandomWalker, LocalRandomWalker, Walker};
|
||||
|
||||
mod system;
|
||||
mod surface_probability_measure;
|
||||
@ -26,6 +26,11 @@ mod cli;
|
||||
fn main() {
|
||||
let cli = ModelCli::parse();
|
||||
|
||||
if cli.preserve_existing && cli.output.exists() {
|
||||
println!("Skipping model execution as output file '{}' already exists", cli.output.to_str().unwrap());
|
||||
return;
|
||||
}
|
||||
|
||||
println!("Running: {:?}", cli);
|
||||
|
||||
match cli.preconfigured_model {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user