driver: remove new_spirv
method
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
//! to couple them. i parameterize the entire setup over a bunch of different factors in order to
|
||||
//! search for the conditions which maximize energy transfer from the one core to the other.
|
||||
|
||||
use coremem::{Driver, mat, meas, SpirvDriver};
|
||||
use coremem::{Driver, mat, meas};
|
||||
use coremem::geom::{region, Cube, Dilate, Memoize, Meters, Spiral, SwapYZ, Torus, Translate, Wrap};
|
||||
use coremem::mat::{Ferroxcube3R1MH, IsoConductorOr};
|
||||
use coremem::real::{R32, Real as _};
|
||||
use coremem::render::CsvRenderer;
|
||||
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
|
||||
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
|
||||
use coremem::sim::units::{Seconds, Time as _};
|
||||
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid1, TimeVarying as _};
|
||||
use coremem::util::cache::DiskCache;
|
||||
use log::{error, info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -389,7 +390,9 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
p.clock_type,
|
||||
);
|
||||
|
||||
let mut driver: SpirvDriver<f32, Mat> = Driver::new_spirv(g.dim, p.geom.feat_size);
|
||||
let mut driver = Driver::new_with_state(SpirvSim::<f32, Mat, WgpuBackend>::new(
|
||||
g.dim.to_index(p.geom.feat_size), p.geom.feat_size
|
||||
));
|
||||
driver.set_steps_per_stim(1000);
|
||||
if !driver.add_state_file(&*format!("{}/state.bc", prefix), 16000) {
|
||||
// mu_r=881.33, starting at H=25 to H=75.
|
||||
@@ -414,7 +417,7 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
info!("loaded state file: skipping geometry calculations");
|
||||
}
|
||||
|
||||
let add_drive_sine_pulse = |driver: &mut SpirvDriver<f32, Mat>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let add_drive_sine_pulse = |driver: &mut Driver<_>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let wave = Sinusoid1::from_wavelength(amp, duration * 2.0)
|
||||
.half_cycle()
|
||||
.shifted(start);
|
||||
@@ -426,7 +429,7 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
));
|
||||
};
|
||||
|
||||
let add_drive_square_pulse = |driver: &mut SpirvDriver<f32, Mat>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let add_drive_square_pulse = |driver: &mut Driver<_>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let wave = Gated::new(amp, start, start+duration);
|
||||
driver.add_stimulus(CurlStimulus::new(
|
||||
region.clone(),
|
||||
@@ -436,7 +439,7 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
));
|
||||
};
|
||||
|
||||
let add_drive_exp_pulse = |driver: &mut SpirvDriver<f32, Mat>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let add_drive_exp_pulse = |driver: &mut Driver<_>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let wave = Exp1::new_at(amp, start, 0.5*duration);
|
||||
driver.add_stimulus(CurlStimulus::new(
|
||||
region.clone(),
|
||||
@@ -447,11 +450,11 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
};
|
||||
|
||||
// step function: "permanently" increase the current by `amp`.
|
||||
let _add_drive_step = |driver: &mut SpirvDriver<f32, Mat>, region: &Torus, start: f32, amp: f32| {
|
||||
let _add_drive_step = |driver: &mut Driver<_>, region: &Torus, start: f32, amp: f32| {
|
||||
add_drive_square_pulse(driver, region, start, 1.0 /* effectively infinite duration */, amp);
|
||||
};
|
||||
|
||||
let add_drive_pulse = |ty: PulseType, driver: &mut SpirvDriver<f32, Mat>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
let add_drive_pulse = |ty: PulseType, driver: &mut Driver<_>, region: &Torus, start: f32, duration: f32, amp: f32| {
|
||||
match ty {
|
||||
PulseType::Square => add_drive_square_pulse(driver, region, start, duration, amp),
|
||||
PulseType::Sine => add_drive_sine_pulse(driver, region, start, duration, amp),
|
||||
|
Reference in New Issue
Block a user