sim: spirv: tests: cleanup unused imports

This commit is contained in:
2022-08-30 15:43:30 -07:00
parent ff1342ff8a
commit ea07a8d5a6

View File

@@ -172,7 +172,8 @@ impl<R: Real, M: Default, B> SpirvSim<R, M, B>
}
}
/// XXX for test
/// test helper for when stimuli can't directly be used for one reason or another
#[cfg(test)]
pub(crate) fn set_fields_at_index(&mut self, pos: Index, f: Fields<R>) {
let idx = self.flat_index(pos).unwrap();
self.e[idx] = f.e();
@@ -352,9 +353,8 @@ mod test {
mod $shortname {
use super::*;
use crate::geom::{Coord as _, WorldRegion};
use crate::sim::Cube;
use crate::stim::{DynStimuli, FieldMags, NoopStimulus, RegionGated, RngStimulus};
use crate::geom::WorldRegion;
use crate::stim::{NoopStimulus, RngStimulus};
use coremem_cross::mat::{AnisomorphicConductor, IsomorphicConductor};
use float_eq::assert_float_eq;
use more_asserts::{assert_gt, assert_lt};
@@ -576,21 +576,23 @@ mod test {
if idx < 0.0 || idx > 2.0 {
return (R32::zero(), R32::zero());
}
let phase = idx.cast::<R32>() * R32::pi();
let a = phase.sin();
(amp_e * a, amp_h * a)
};
// inject the wave at t=0
for i in 0..size.z() {
let (e, h) = wave(i, 0);
sim.set_fields_at_index(Index::new(0, 0, i), Fields::new(
for z in 0..size.z() {
let (e, h) = wave(z, 0);
// due to the staggered nature of stepping (step_e, then step_h),
// populating the initial E *and* H fields through a Stimulus is
// nontrivial. we just explicitly set the fields instead.
sim.set_fields_at_index(Index::new(0, 0, z), Fields::new(
Vec3::new(e, R32::zero(), R32::zero()),
Vec3::new(R32::zero(), h, R32::zero()),
Vec3::default(),
));
}
// advance the simulation N steps.