stimulus: remove unused Stimulus
impl for RegionGated
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use crate::geom::{Coord as _, HasCrossSection, Index, Region};
|
use crate::geom::{Coord as _, HasCrossSection, Index, Region};
|
||||||
use crate::real::Real;
|
use crate::real::Real;
|
||||||
use crate::stim::{Fields, Stimulus};
|
use crate::stim::Fields;
|
||||||
use coremem_cross::dim::DimSlice;
|
use coremem_cross::dim::DimSlice;
|
||||||
use coremem_cross::vec::Vec3u;
|
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)]
|
#[derive(Clone)]
|
||||||
pub struct RegionGated<G, S> {
|
pub struct RegionGated<G, V> {
|
||||||
region: G,
|
region: G,
|
||||||
stim: S,
|
field: V,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<G, S> RegionGated<G, S> {
|
impl<G, V> RegionGated<G, V> {
|
||||||
pub fn new(region: G, stim: S) -> Self {
|
pub fn new(region: G, field: V) -> Self {
|
||||||
Self {
|
Self {
|
||||||
region, stim
|
region, field
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: is this necessary?
|
impl<R: Real, G: Region + Sync, V: VectorField<R>> VectorField<R> for RegionGated<G, V> {
|
||||||
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> {
|
|
||||||
fn at(&self, feat_size: R, loc: Index) -> Fields<R> {
|
fn at(&self, feat_size: R, loc: Index) -> Fields<R> {
|
||||||
if self.region.contains(loc.to_meters(feat_size.cast())) {
|
if self.region.contains(loc.to_meters(feat_size.cast())) {
|
||||||
self.stim.at(feat_size, loc)
|
self.field.at(feat_size, loc)
|
||||||
} else {
|
} else {
|
||||||
Fields::default()
|
Fields::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// apply a stimulus across some region.
|
/// VectorField whose field at each point is based on its angle about the specified ray.
|
||||||
/// the stimulus seen 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`.
|
||||||
/// the stimulus has equal E and H vectors. if you want just one, filter it one with `Scaled`.
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CurlVectorField<G> {
|
pub struct CurlVectorField<G> {
|
||||||
region: G,
|
region: G,
|
||||||
|
Reference in New Issue
Block a user