stim: convert CurlStimulus to a CurlVectorField and use ModulatedVectorField
this opens the door to caching the vector field stuff.
This commit is contained in:
@@ -22,7 +22,7 @@ use coremem::real::{R32, Real as _};
|
||||
use coremem::render::CsvRenderer;
|
||||
use coremem::sim::spirv::{SpirvSim, WgpuBackend};
|
||||
use coremem::sim::units::{Seconds, Time as _};
|
||||
use coremem::stim::{CurlStimulus, Exp1, Gated, Sinusoid, StimExt as _};
|
||||
use coremem::stim::{CurlVectorField, Exp1, Gated, ModulatedVectorField, Sinusoid, StimExt as _};
|
||||
use log::{error, info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -441,25 +441,25 @@ fn run_sim(id: u32, p: Params, g: Geometries) -> Results {
|
||||
let wave = Sinusoid::from_wavelength(amp, duration * 2.0)
|
||||
.half_cycle()
|
||||
.shifted(start);
|
||||
driver.add_stimulus(CurlStimulus::new(
|
||||
region.clone(),
|
||||
wave.clone(),
|
||||
driver.add_stimulus(ModulatedVectorField::new(
|
||||
CurlVectorField::new(region.clone()),
|
||||
wave,
|
||||
));
|
||||
};
|
||||
|
||||
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(),
|
||||
wave.clone(),
|
||||
driver.add_stimulus(ModulatedVectorField::new(
|
||||
CurlVectorField::new(region.clone()),
|
||||
wave,
|
||||
));
|
||||
};
|
||||
|
||||
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(),
|
||||
wave.clone(),
|
||||
driver.add_stimulus(ModulatedVectorField::new(
|
||||
CurlVectorField::new(region.clone()),
|
||||
wave,
|
||||
));
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user