sim: remove unused impulse_b, impulse_h methods

This commit is contained in:
2022-07-28 15:55:50 -07:00
parent 1898542372
commit afc1f874d2
3 changed files with 0 additions and 65 deletions

View File

@@ -376,14 +376,6 @@ impl<R: Real, M: Material<R> + Send + Sync> GenericSim for SimState<R, M> {
fn impulse_e_meters(&mut self, pos: Meters, amount: Vec3<f32>) { fn impulse_e_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
*self.get_e_mut(pos) += amount.cast(); *self.get_e_mut(pos) += amount.cast();
} }
fn impulse_h_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
self.impulse_b_meters(pos, amount * f32::mu0());
}
fn impulse_b_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
self.get_hcell(pos).impulse_b(amount.cast());
}
} }
#[allow(unused)] #[allow(unused)]
@@ -582,18 +574,6 @@ impl<'a, R: Real, M: Material<R>> HCell<'a, R, M> {
(*self.h + self.mat.m()) * R::mu0() (*self.h + self.mat.m()) * R::mu0()
} }
fn impulse_b(&mut self, delta_b: Vec3<R>) {
let b_prev = self.b();
let state = CellState {
e: *self.e,
h: *self.h,
};
self.mat.step_b(&state, delta_b);
// mu0 (H + M) = B
// therefore, H = B mu0^-1 - M
*self.h = (b_prev + delta_b) * R::mu0_inv() - self.mat.m();
}
fn step(&mut self, neighbors: Neighbors<'_, R>, delta_t: R, inv_feature_size: R) { fn step(&mut self, neighbors: Neighbors<'_, R>, delta_t: R, inv_feature_size: R) {
// ```tex // ```tex
// Maxwell-Faraday equation: $\nabla x E = -dB/dt$ (1) // Maxwell-Faraday equation: $\nabla x E = -dB/dt$ (1)

View File

@@ -129,27 +129,11 @@ pub trait GenericSim: SampleableSim {
/// DEPRECATED. Use stimulus instead /// DEPRECATED. Use stimulus instead
fn impulse_e_meters(&mut self, pos: Meters, amount: Vec3<f32>); fn impulse_e_meters(&mut self, pos: Meters, amount: Vec3<f32>);
/// DEPRECATED. Use stimulus instead
fn impulse_h_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
self.impulse_b_meters(pos, amount * f32::mu0());
}
/// DEPRECATED. Use stimulus instead
fn impulse_b_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
self.impulse_h_meters(pos, amount * f32::mu0_inv());
}
fn impulse_e<C: Coord>(&mut self, pos: C, amt: Vec3<f32>) { fn impulse_e<C: Coord>(&mut self, pos: C, amt: Vec3<f32>) {
self.impulse_e_meters(pos.to_meters(self.feature_size()), amt) self.impulse_e_meters(pos.to_meters(self.feature_size()), amt)
} }
fn impulse_h<C: Coord>(&mut self, pos: C, amt: Vec3<f32>) {
self.impulse_h_meters(pos.to_meters(self.feature_size()), amt)
}
fn impulse_b<C: Coord>(&mut self, pos: C, amt: Vec3<f32>) {
self.impulse_b_meters(pos.to_meters(self.feature_size()), amt)
}
fn impulse_ex<C: Coord>(&mut self, c: C, ex: f32) { fn impulse_ex<C: Coord>(&mut self, c: C, ex: f32) {
self.impulse_e(c, Vec3::new_x(ex)); self.impulse_e(c, Vec3::new_x(ex));
} }
@@ -159,26 +143,6 @@ pub trait GenericSim: SampleableSim {
fn impulse_ez<C: Coord>(&mut self, c: C, ez: f32) { fn impulse_ez<C: Coord>(&mut self, c: C, ez: f32) {
self.impulse_e(c, Vec3::new_z(ez)); self.impulse_e(c, Vec3::new_z(ez));
} }
fn impulse_hx<C: Coord>(&mut self, c: C, hx: f32) {
self.impulse_h(c, Vec3::new_x(hx));
}
fn impulse_hy<C: Coord>(&mut self, c: C, hy: f32) {
self.impulse_h(c, Vec3::new_y(hy));
}
fn impulse_hz<C: Coord>(&mut self, c: C, hz: f32) {
self.impulse_h(c, Vec3::new_z(hz));
}
fn impulse_bx<C: Coord>(&mut self, c: C, bx: f32) {
self.impulse_b(c, Vec3::new_x(bx));
}
fn impulse_by<C: Coord>(&mut self, c: C, by: f32) {
self.impulse_b(c, Vec3::new_y(by));
}
fn impulse_bz<C: Coord>(&mut self, c: C, bz: f32) {
self.impulse_b(c, Vec3::new_z(bz));
}
} }
/// Conceptually, one cell looks like this (in 2d): /// Conceptually, one cell looks like this (in 2d):

View File

@@ -166,15 +166,6 @@ where
let flat_idx = self.flat_index(idx).unwrap(); let flat_idx = self.flat_index(idx).unwrap();
self.e[flat_idx] += amount.cast(); self.e[flat_idx] += amount.cast();
} }
fn impulse_h_meters(&mut self, pos: Meters, amount: Vec3<f32>) {
let idx = pos.to_index(self.feature_size());
let flat_idx = self.flat_index(idx).unwrap();
self.h[flat_idx] += amount.cast();
}
fn impulse_b_meters(&mut self, _pos: Meters, _amount: Vec3<f32>) {
unimplemented!()
}
} }
impl<R: Real, M: Default, B> SpirvSim<R, M, B> impl<R: Real, M: Default, B> SpirvSim<R, M, B>