diff --git a/crates/applications/wavefront/src/main.rs b/crates/applications/wavefront/src/main.rs index 60f9a1c..c4dda65 100644 --- a/crates/applications/wavefront/src/main.rs +++ b/crates/applications/wavefront/src/main.rs @@ -11,7 +11,7 @@ use coremem::{mat, Driver}; use coremem::geom::{Coord as _, Cube, Index}; use coremem::units::Seconds; use coremem::sim::spirv::{self, SpirvSim}; -use coremem::stim::{Stimulus, TimeVarying as _, UniformStimulus}; +use coremem::stim::{RegionGated, TimeVarying as _, UniformStimulus}; use coremem::cross::vec::Vec3; type Mat = mat::FullyGenericMaterial; @@ -46,7 +46,7 @@ fn main() { Index::new(201, height*3/4, 1).to_meters(feature_size), ); // emit a constant E/H delta over this region for 100 femtoseconds - let stim = Stimulus::new( + let stim = RegionGated::new( center_region, UniformStimulus::new( Vec3::new(2e19, 0.0, 0.0), // E field (per second) diff --git a/crates/coremem/src/stim.rs b/crates/coremem/src/stim.rs index b95f799..9a5403e 100644 --- a/crates/coremem/src/stim.rs +++ b/crates/coremem/src/stim.rs @@ -224,23 +224,23 @@ impl AbstractStimulus for RngStimulus { /// Apply a time-varying stimulus uniformly across some region #[derive(Clone)] -pub struct Stimulus { +pub struct RegionGated { region: R, - stim: T, + stim: S, } -impl Stimulus { - pub fn new(region: R, stim: T) -> Self { +impl RegionGated { + pub fn new(region: R, stim: S) -> Self { Self { region, stim } } } -impl AbstractStimulus for Stimulus { +impl AbstractStimulus for RegionGated { fn at(&self, t_sec: f32, pos: Meters) -> Fields { if self.region.contains(pos) { - self.stim.at(t_sec) + self.stim.at(t_sec, pos) } else { Fields::default() }