stim: introduce a VectorField trait which we'll use to build a more structured approach to Stimulus

This commit is contained in:
2022-08-18 16:55:06 -07:00
parent cf2d21f975
commit 9461cc7781
3 changed files with 125 additions and 33 deletions

View File

@@ -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::{RegionGated, StimExt as _, UniformStimulus};
use coremem::stim::{Fields, ModulatedVectorField, Pulse, RegionGated};
use coremem::cross::vec::Vec3;
type Mat = mat::FullyGenericMaterial<f32>;
@@ -46,12 +46,12 @@ 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 = RegionGated::new(
center_region,
UniformStimulus::new(
Vec3::new(2e19, 0.0, 0.0), // E field (per second)
Vec3::new(0.0, 0.0, 2e19/376.730) // H field (per second)
).gated(0.0, 100e-15),
let stim = ModulatedVectorField::new(
RegionGated::new(center_region, Fields::new_eh(
Vec3::new(2e19, 0.0, 0.0),
Vec3::new(0.0, 0.0, 2e19/376.730),
)),
Pulse::new(0.0, 100e-15),
);
driver.add_stimulus(stim);