Region: remove the Serialization requirement

This commit is contained in:
2022-08-12 00:56:28 -07:00
parent 090b1ca09a
commit d5fbb4e9b2
7 changed files with 30 additions and 111 deletions

View File

@@ -13,9 +13,9 @@ use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
use log::{error, info, warn};
use serde::{Deserialize, Serialize};
mod cache;
use cache::DiskCache;
// XXX: cache was disabled during Region rework.
// mod cache;
// use cache::DiskCache;
type Mat = IsoConductorOr<f32, Ferroxcube3R1MH>;
@@ -142,7 +142,7 @@ struct Params {
dump_frames: (u64, Option<u64>),
}
#[derive(Clone, Default, Serialize, Deserialize)]
#[derive(Clone, Default)]
struct Geometries {
dim: Meters,
ferro1_region: Torus,
@@ -657,10 +657,14 @@ fn main() {
variants.len() / post_times.len(),
);
let mut geom_cache = DiskCache::new_with_supplier(
&format!("{}/.geom_cache", ensure_out_dir(i)),
|geom: &GeomParams| derive_geometries(geom.clone())
);
// let mut geom_cache = DiskCache::new_with_supplier(
// &format!("{}/.geom_cache", ensure_out_dir(i)),
// |geom: &GeomParams| derive_geometries(geom.clone())
// );
// TODO: re-enable geometry cache. had to disable during Region serialization rework
fn geom_cache_get_or_insert_from_supplier(geom: GeomParams) -> Option<Geometries> {
derive_geometries(geom)
}
for (peak_clock_current, clock_duration, post_time, clock_type, ferro_major, wrap1_coverage, wrap2_coverage, wrap1_density, wrap2_density) in variants {
info!("{}A/{}s {}s {}m {}:{}cov {}:{}density", peak_clock_current, clock_duration, post_time, ferro_major, wrap1_coverage, wrap2_coverage, wrap1_density, wrap2_density);
@@ -709,7 +713,7 @@ fn main() {
wraps1: (wraps1 * 4) as f32,
..base_params.geom
};
let geoms = geom_cache.get_or_insert_from_supplier(params.clone())?;
let geoms = geom_cache_get_or_insert_from_supplier(params.clone())?;
Some((params, geoms))
})
.collect();
@@ -734,7 +738,7 @@ fn main() {
wraps2: (wraps2 * 4) as f32,
..base_params.geom
};
let geoms = geom_cache.get_or_insert_from_supplier(params.clone())?;
let geoms = geom_cache_get_or_insert_from_supplier(params.clone())?;
Some((params, geoms))
})
.collect();
@@ -755,7 +759,7 @@ fn main() {
let mut params = base_params;
params.geom.wraps1 = wraps1;
params.geom.wraps2 = wraps2;
match geom_cache.get_or_insert_from_supplier(params.geom.clone()) {
match geom_cache_get_or_insert_from_supplier(params.geom.clone()) {
Some(geoms) => {
run_sim(i, params, geoms);
},