cleanup: use consts::real::HALF when possible

This commit is contained in:
2020-07-31 19:02:17 -07:00
parent 72c2ee599e
commit 4bfe282c36

View File

@@ -202,17 +202,15 @@ impl<M: Material + Clone> Cell<M> {
// Discretize (2): (\delta E_y)/(\delta t) = c^2 (-\delta B_z / \delta x - S_y)
// Rearrange: \delta E_y = c (-\delta B_z / 2 - c \delta_t S_y)
use consts::real::{C, MU0};
use consts::real::{C, HALF, MU0};
let half = R64::from_inner(0.5);
let delta_bz_y = self.bz - up.bz;
let static_ex: R64 = MU0() * self.mat.conductivity() * self.ex;
let delta_ex: R64 = C() * (half * delta_bz_y - C() * delta_t * static_ex);
let delta_ex: R64 = C() * (HALF() * delta_bz_y - C() * delta_t * static_ex);
let delta_bz_x = self.bz - left.bz;
let static_ey: R64 = MU0() * self.mat.conductivity() * self.ey;
let delta_ey: R64 = C() * (-half * delta_bz_x - C() * delta_t * static_ey);
let delta_ey: R64 = C() * (-HALF() * delta_bz_x - C() * delta_t * static_ey);
Cell {
ex: self.ex + delta_ex,