buffer_proto5: auto-create the output directories (and fix them to out/applications)

This commit is contained in:
2022-07-17 13:03:38 -07:00
parent 87ff2f2329
commit 193e17e2c8

View File

@@ -335,6 +335,12 @@ fn derive_geometries(p: GeomParams) -> Option<Geometries> {
})
}
fn ensure_out_dir(id: u32) -> String {
let base = format!("out/applications/buffer_proto5/{}", id);
let _ = std::fs::create_dir_all(&base);
base
}
fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
info!("run_sim {}: {:?}", id, p);
@@ -346,10 +352,11 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
info!("ferro1: {:?}", g.ferro1_region.center());
info!("ferro2: {:?}", g.ferro2_region.center());
let base = format!("buffer5-{}", id);
let prefix = format!("out/{}/{}-{}-{}setmA-{}setps-{}clkmA-{}clkps-{}um-{}ferromaj-{}:{}wraps-{}:{}cov-{:?}clk",
base,
let base = ensure_out_dir(id);
let prefix = format!(
"{}/{}-{}-{}setmA-{}setps-{}clkmA-{}clkps-{}um-{}ferromaj-{}:{}wraps-{}:{}cov-{:?}clk",
base,
id,
*g.dim.to_index(p.geom.feat_size),
(p.peak_set_current * 1e3).round() as i64,
(p.set_duration * 1e12).round() as i64,
@@ -630,7 +637,7 @@ fn main() {
);
let mut geom_cache = DiskCache::new_with_supplier(
&format!("out/buffer5-{}/.geom_cache", i),
&format!("{}/.geom_cache", ensure_out_dir(i)),
|geom: &GeomParams| derive_geometries(geom.clone())
);