fix test compilation failures from vec migration

This commit is contained in:
2022-07-17 22:41:39 -07:00
parent 8c3a26e798
commit 19849c2428
4 changed files with 25 additions and 25 deletions

View File

@@ -1259,7 +1259,7 @@ impl<R: Real> CellStateWithM<R> {
mod test {
use super::*;
use crate::geom::{Cube, Region, WorldRegion};
use crate::mat::{Conductor, Pml, Static};
use crate::mat::{AnisomorphicConductor, IsomorphicConductor, Pml, Static};
use crate::real::{R64, ToFloat as _};
use float_eq::assert_float_eq;
use more_asserts::*;
@@ -1683,14 +1683,14 @@ mod test {
#[test]
fn conductor_dissipates_energy() {
let (energy_0, energy_1) = conductor_test(Conductor::new(R64::from_f32(1e3)));
let (energy_0, energy_1) = conductor_test(IsomorphicConductor::new(R64::from_f32(1e3)));
assert_float_eq!(energy_1/energy_0, 0.0, abs <= 1e-6);
}
#[test]
fn anisotropic_conductor_inactive_x() {
let (energy_0, energy_1) = conductor_test(Conductor::new_anisotropic(
Vec3::new_x(1e3)
let (energy_0, energy_1) = conductor_test(AnisomorphicConductor::new(
Vec3::new_x(1e3).cast()
));
assert_gt!(energy_1, 0.9*energy_0);
// XXX: I think this gains energy because we only set the E field and not the H field
@@ -1699,8 +1699,8 @@ mod test {
#[test]
fn anisotropic_conductor_inactive_y() {
let (energy_0, energy_1) = conductor_test(Conductor::new_anisotropic(
Vec3::new_y(1e3)
let (energy_0, energy_1) = conductor_test(AnisomorphicConductor::new(
Vec3::new_y(1e3).cast()
));
assert_gt!(energy_1, 0.9*energy_0);
assert_lt!(energy_1, 1.5*energy_0);
@@ -1708,8 +1708,8 @@ mod test {
#[test]
fn anisotropic_conductor_active_z() {
let (energy_0, energy_1) = conductor_test(Conductor::new_anisotropic(
Vec3::new_z(1e3)
let (energy_0, energy_1) = conductor_test(AnisomorphicConductor::new(
Vec3::new_z(1e3).cast()
));
assert_float_eq!(energy_1/energy_0, 0.0, abs <= 1e-6);
}
@@ -1733,13 +1733,13 @@ mod test {
}
/// Like state_for_pml, but the boundary is an ordinary electric conductor -- not PML
fn state_for_graded_conductor(size: Index) -> SimState<R64, Conductor<R64>> {
fn state_for_graded_conductor(size: Index) -> SimState<R64, IsomorphicConductor<R64>> {
let mut state = SimState::new(size, 1e-6);
let timestep = state.timestep();
state.fill_boundary_using(size/4, |boundary_ness| {
let b = boundary_ness.elem_pow(3.0);
let conductivity = f32::eps0() * b.mag() * 0.5 / timestep;
Conductor::new(conductivity.cast())
IsomorphicConductor::new(conductivity.cast())
});
state
}