diff --git a/crates/coremem/src/stim/vector_field.rs b/crates/coremem/src/stim/vector_field.rs index 03e21d2..6b0aa70 100644 --- a/crates/coremem/src/stim/vector_field.rs +++ b/crates/coremem/src/stim/vector_field.rs @@ -1,6 +1,6 @@ use crate::geom::{Coord as _, HasCrossSection, Index, Region}; use crate::real::Real; -use crate::stim::{Fields, Stimulus}; +use crate::stim::Fields; use coremem_cross::dim::DimSlice; use coremem_cross::vec::Vec3u; @@ -29,45 +29,33 @@ where } } -/// Apply a time-varying stimulus uniformly across some region +/// restrict the VectorField to just the specified region, letting it be zero everywhere else #[derive(Clone)] -pub struct RegionGated { +pub struct RegionGated { region: G, - stim: S, + field: V, } -impl RegionGated { - pub fn new(region: G, stim: S) -> Self { +impl RegionGated { + pub fn new(region: G, field: V) -> Self { Self { - region, stim + region, field } } } -// TODO: is this necessary? -impl + Sync> Stimulus for RegionGated { - fn at(&self, t_sec: R, feat_size: R, loc: Index) -> Fields { - if self.region.contains(loc.to_meters(feat_size.cast())) { - self.stim.at(t_sec, feat_size, loc) - } else { - Fields::default() - } - } -} - -impl> VectorField for RegionGated { +impl> VectorField for RegionGated { fn at(&self, feat_size: R, loc: Index) -> Fields { if self.region.contains(loc.to_meters(feat_size.cast())) { - self.stim.at(feat_size, loc) + self.field.at(feat_size, loc) } else { Fields::default() } } } -/// apply a stimulus across some region. -/// the stimulus seen at each point is based on its angle about the specified ray. -/// the stimulus has equal E and H vectors. if you want just one, filter it one with `Scaled`. +/// VectorField whose field at each point is based on its angle about the specified ray. +/// the field has equal E and H vectors. if you want just one, filter it out with `Scaled`. #[derive(Clone)] pub struct CurlVectorField { region: G,