From 26efc12c21e341ae019dd8b9c37b4c8bb046ea69 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 28 Jul 2022 13:20:26 -0700 Subject: [PATCH] multi_core_inverter: abstractions to allow swapping out float impl and backend --- crates/applications/multi_core_inverter/src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/applications/multi_core_inverter/src/main.rs b/crates/applications/multi_core_inverter/src/main.rs index 7cf5e63..9d5246d 100644 --- a/crates/applications/multi_core_inverter/src/main.rs +++ b/crates/applications/multi_core_inverter/src/main.rs @@ -37,12 +37,15 @@ //! ``` use coremem::geom::{Coord as _, Meters, Torus}; -use coremem::sim::spirv::{SpirvSim, WgpuBackend}; +use coremem::real::{self, Real as _}; +use coremem::sim::spirv::{self, SpirvSim}; use coremem::sim::units::Seconds; use coremem::mat::{Ferroxcube3R1MH, IsoConductorOr, IsomorphicConductor}; use coremem::Driver; -type Mat = IsoConductorOr; +type R = real::R32; +type Mat = IsoConductorOr; +type Backend = spirv::WgpuBackend; fn main() { coremem::init_logging(); @@ -73,14 +76,14 @@ fn main() { let s = |n| Torus::new_xy(Meters::new(sx(n), sy, sz), s_major, s_minor); let coupling = |n| Torus::new_xz(Meters::new(couplingx(n), sy, sz), coupling_major, coupling_minor); - let wire_mat = IsomorphicConductor::new(1e6); + let wire_mat = IsomorphicConductor::new(1e6f32.cast::()); let ferro_mat = wire_mat; // let ferro_mat = Ferroxcube3R1MH::new(); // uncomment when ready to simulate for real - let mut driver = Driver::new(SpirvSim::::new( + let mut driver = Driver::new(SpirvSim::::new( sim_bounds.to_index(feat_size), feat_size, )); - driver.add_classical_boundary(sim_padding); + driver.add_classical_boundary_explicit::(sim_padding); driver.fill_region(&drive0, wire_mat); driver.fill_region(&sense3, wire_mat); for core in 0..4 {