stimulus: remove unused Stimulus
impl for RegionGated
This commit is contained in:
parent
2c68a53668
commit
1cfef7cac6
|
@ -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<G, S> {
|
||||
pub struct RegionGated<G, V> {
|
||||
region: G,
|
||||
stim: S,
|
||||
field: V,
|
||||
}
|
||||
|
||||
impl<G, S> RegionGated<G, S> {
|
||||
pub fn new(region: G, stim: S) -> Self {
|
||||
impl<G, V> RegionGated<G, V> {
|
||||
pub fn new(region: G, field: V) -> Self {
|
||||
Self {
|
||||
region, stim
|
||||
region, field
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: is this necessary?
|
||||
impl<R: Real, G: Region + Sync, S: Stimulus<R> + Sync> Stimulus<R> for RegionGated<G, S> {
|
||||
fn at(&self, t_sec: R, feat_size: R, loc: Index) -> Fields<R> {
|
||||
if self.region.contains(loc.to_meters(feat_size.cast())) {
|
||||
self.stim.at(t_sec, feat_size, loc)
|
||||
} else {
|
||||
Fields::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: Real, G: Region + Sync, S: VectorField<R>> VectorField<R> for RegionGated<G, S> {
|
||||
impl<R: Real, G: Region + Sync, V: VectorField<R>> VectorField<R> for RegionGated<G, V> {
|
||||
fn at(&self, feat_size: R, loc: Index) -> Fields<R> {
|
||||
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<G> {
|
||||
region: G,
|
||||
|
|
Loading…
Reference in New Issue
Block a user