driver: rename new_with_state
-> new
This commit is contained in:
@@ -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::<f32, Mat, WgpuBackend>::new(
|
||||
let mut driver = Driver::new(SpirvSim::<f32, Mat, WgpuBackend>::new(
|
||||
g.dim.to_index(p.geom.feat_size), p.geom.feat_size
|
||||
));
|
||||
driver.set_steps_per_stim(1000);
|
||||
|
@@ -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::<f32, Mat, WgpuBackend>::new(
|
||||
let mut driver = Driver::new(SpirvSim::<f32, Mat, WgpuBackend>::new(
|
||||
sim_bounds.to_index(feat_size), feat_size,
|
||||
));
|
||||
driver.add_classical_boundary(sim_padding);
|
||||
|
@@ -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::<f32, mat::FullyGenericMaterial<f32>, WgpuBackend>::new(
|
||||
let mut driver = Driver::new(SpirvSim::<f32, mat::FullyGenericMaterial<f32>, WgpuBackend>::new(
|
||||
Meters::new(width, height, depth).to_index(feat_size), feat_size
|
||||
));
|
||||
|
||||
|
@@ -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::<f32, Mat, spirv::CpuBackend>::new(
|
||||
let mut driver = Driver::new(SpirvSim::<f32, Mat, spirv::CpuBackend>::new(
|
||||
size, feature_size
|
||||
));
|
||||
|
||||
|
@@ -10,7 +10,7 @@ pub fn bench_step_spirv(c: &mut Criterion) {
|
||||
for size in &[10, 20, 40, 80, 160] {
|
||||
let sim = SpirvSim::<f32, Mat, WgpuBackend>::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::<f32, Mat, WgpuBackend>::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())
|
||||
});
|
||||
}
|
||||
|
@@ -24,28 +24,28 @@ fn measure_steps<S: GenericSim + Clone + Default + Send + Sync + 'static>(name:
|
||||
|
||||
fn main() {
|
||||
coremem::init_logging();
|
||||
measure_steps("spirv/80", 1, Driver::new_with_state(
|
||||
measure_steps("spirv/80", 1, Driver::new(
|
||||
SpirvSim::<f32, FullyGenericMaterial<f32>, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3)
|
||||
));
|
||||
measure_steps("sim/80", 1, Driver::<SimState>::new_with_state(
|
||||
measure_steps("sim/80", 1, Driver::<SimState>::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::<f32, FullyGenericMaterial<f32>, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3)
|
||||
));
|
||||
measure_steps("sim/80 step(2)", 2, Driver::<SimState>::new_with_state(
|
||||
measure_steps("sim/80 step(2)", 2, Driver::<SimState>::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::<f32, FullyGenericMaterial<f32>, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3)
|
||||
));
|
||||
measure_steps("sim/80 step(10)", 10, Driver::<SimState>::new_with_state(
|
||||
measure_steps("sim/80 step(10)", 10, Driver::<SimState>::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::<f32, FullyGenericMaterial<f32>, WgpuBackend>::new(Index::new(80, 80, 80), 1e-3)
|
||||
));
|
||||
measure_steps("sim/80 step(100)", 100, Driver::<SimState>::new_with_state(
|
||||
measure_steps("sim/80 step(100)", 100, Driver::<SimState>::new(
|
||||
SimState::new(Index::new(80, 80, 80), 1e-3)
|
||||
));
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ pub struct Driver<S> {
|
||||
}
|
||||
|
||||
impl<S> Driver<S> {
|
||||
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<S> Driver<S> {
|
||||
sim_end_time: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Driver<S> {
|
||||
pub fn add_stimulus<Stim: AbstractStimulus + 'static>(&mut self, s: Stim) {
|
||||
self.stimuli.push(Box::new(s))
|
||||
}
|
||||
|
Reference in New Issue
Block a user