diff --git a/crates/applications/buffer_proto5/src/main.rs b/crates/applications/buffer_proto5/src/main.rs index bc3e378..72a5b41 100644 --- a/crates/applications/buffer_proto5/src/main.rs +++ b/crates/applications/buffer_proto5/src/main.rs @@ -390,7 +390,7 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results { p.clock_type, ); - let mut driver = Driver::new_with_state(SpirvSim::::new( + let mut driver = Driver::new(SpirvSim::::new( g.dim.to_index(p.geom.feat_size), p.geom.feat_size )); driver.set_steps_per_stim(1000); diff --git a/crates/applications/multi_core_inverter/src/main.rs b/crates/applications/multi_core_inverter/src/main.rs index 50d2cf4..7cf5e63 100644 --- a/crates/applications/multi_core_inverter/src/main.rs +++ b/crates/applications/multi_core_inverter/src/main.rs @@ -77,7 +77,7 @@ fn main() { let ferro_mat = wire_mat; // let ferro_mat = Ferroxcube3R1MH::new(); // uncomment when ready to simulate for real - let mut driver = Driver::new_with_state(SpirvSim::::new( + let mut driver = Driver::new(SpirvSim::::new( sim_bounds.to_index(feat_size), feat_size, )); driver.add_classical_boundary(sim_padding); diff --git a/crates/applications/sr_latch/src/main.rs b/crates/applications/sr_latch/src/main.rs index 5f44401..45f10d4 100644 --- a/crates/applications/sr_latch/src/main.rs +++ b/crates/applications/sr_latch/src/main.rs @@ -59,7 +59,7 @@ fn main() { let coupling_region = Torus::new_xz(Meters::new(0.5*(ferro1_center + ferro2_center), ferro_center_y, half_depth), wire_coupling_major, wire_minor); let sense_region = Torus::new_xz(Meters::new(ferro2_center + ferro_major, ferro_center_y, half_depth), wire_major, wire_minor); - let mut driver = Driver::new_with_state(SpirvSim::, WgpuBackend>::new( + let mut driver = Driver::new(SpirvSim::, WgpuBackend>::new( Meters::new(width, height, depth).to_index(feat_size), feat_size )); diff --git a/crates/applications/wavefront/src/main.rs b/crates/applications/wavefront/src/main.rs index 3baf112..b21ee59 100644 --- a/crates/applications/wavefront/src/main.rs +++ b/crates/applications/wavefront/src/main.rs @@ -29,7 +29,7 @@ fn main() { // the first parameter is the float type to use: f32 for unchecked math, coremem::real::R32 // to guard against NaN/Inf (useful for debugging). // to run this on the gpu instead of the gpu, replace `CpuBackend` with `WgpuBackend`. - let mut driver = Driver::new_with_state(SpirvSim::::new( + let mut driver = Driver::new(SpirvSim::::new( size, feature_size )); diff --git a/crates/coremem/benches/driver.rs b/crates/coremem/benches/driver.rs index caf138c..3878cb6 100644 --- a/crates/coremem/benches/driver.rs +++ b/crates/coremem/benches/driver.rs @@ -10,7 +10,7 @@ pub fn bench_step_spirv(c: &mut Criterion) { for size in &[10, 20, 40, 80, 160] { let sim = SpirvSim::::new(Index::new(*size, *size, *size), 1e-5); c.bench_with_input(BenchmarkId::new("Driver::step_spirv", size), &sim, |b, sim| { - let mut driver = Driver::new_with_state(sim.clone()); + let mut driver = Driver::new(sim.clone()); b.iter(|| driver.step()) }); } @@ -21,7 +21,7 @@ pub fn bench_step_spirv_iso_3r1(c: &mut Criterion) { for size in &[10, 20, 40, 80, 160] { let sim = SpirvSim::::new(Index::new(*size, *size, *size), 1e-5); c.bench_with_input(BenchmarkId::new("Driver::spirv_ISO3R1", size), &sim, |b, sim| { - let mut driver = Driver::new_with_state(sim.clone()); + let mut driver = Driver::new(sim.clone()); b.iter(|| driver.step()) }); } diff --git a/crates/coremem/src/bin/bench.rs b/crates/coremem/src/bin/bench.rs index dfd8611..4cce159 100644 --- a/crates/coremem/src/bin/bench.rs +++ b/crates/coremem/src/bin/bench.rs @@ -24,28 +24,28 @@ fn measure_steps(name: fn main() { coremem::init_logging(); - measure_steps("spirv/80", 1, Driver::new_with_state( + measure_steps("spirv/80", 1, Driver::new( SpirvSim::, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("sim/80", 1, Driver::::new_with_state( + measure_steps("sim/80", 1, Driver::::new( SimState::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("spirv/80 step(2)", 2, Driver::new_with_state( + measure_steps("spirv/80 step(2)", 2, Driver::new( SpirvSim::, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("sim/80 step(2)", 2, Driver::::new_with_state( + measure_steps("sim/80 step(2)", 2, Driver::::new( SimState::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("spirv/80 step(10)", 10, Driver::new_with_state( + measure_steps("spirv/80 step(10)", 10, Driver::new( SpirvSim::, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("sim/80 step(10)", 10, Driver::::new_with_state( + measure_steps("sim/80 step(10)", 10, Driver::::new( SimState::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("spirv/80 step(100)", 100, Driver::new_with_state( + measure_steps("spirv/80 step(100)", 100, Driver::new( SpirvSim::, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3) )); - measure_steps("sim/80 step(100)", 100, Driver::::new_with_state( + measure_steps("sim/80 step(100)", 100, Driver::::new( SimState::new(Index::new(80, 80, 80), 1e-3) )); } diff --git a/crates/coremem/src/driver.rs b/crates/coremem/src/driver.rs index 466e22b..ffd9be4 100644 --- a/crates/coremem/src/driver.rs +++ b/crates/coremem/src/driver.rs @@ -36,7 +36,7 @@ pub struct Driver { } impl Driver { - pub fn new_with_state(state: S) -> Self { + pub fn new(state: S) -> Self { Self { state, renderer: Arc::new(MultiRenderer::new()), @@ -59,9 +59,7 @@ impl Driver { sim_end_time: None, } } -} -impl Driver { pub fn add_stimulus(&mut self, s: Stim) { self.stimuli.push(Box::new(s)) }