examples: buffer_proto2: get compiling (fails in region_filled assertion)

This commit is contained in:
2022-05-03 17:23:41 -07:00
parent e5eaa214b5
commit 7688922692

View File

@@ -1,7 +1,7 @@
use coremem::{Driver, mat, meas, SampleableSim as _, SimState};
use coremem::real::R32 as Real;
use coremem::geom::{Index, Meters, Torus};
use coremem::stim::{CurlStimulus, Sinusoid1, TimeVarying1 as _};
use coremem::{Driver, mat, meas, SpirvDriver};
use coremem::geom::{Meters, Torus};
use coremem::sim::units::Seconds;
use coremem::stim::{CurlStimulus, Sinusoid1, TimeVarying as _};
fn main() {
coremem::init_logging();
@@ -58,15 +58,15 @@ fn main() {
Torus::new_xz(Meters::new(0.5*(ferro1_center + ferro2_center), ferro_center_y + off, half_depth), wire_coupling_major, wire_minor)
}).collect();
let mut driver: Driver<_> = Driver::new_spirv(Meters::new(width, height, depth), feat_size);
let mut driver: SpirvDriver = Driver::new_spirv(Meters::new(width, height, depth), feat_size);
driver.set_steps_per_stim(1000);
// mu_r=881.33, starting at H=25 to H=75.
driver.fill_region(&ferro1_region, mat::MHPgram::new(25.0, 881.33, 44000.0));
driver.fill_region(&ferro2_region, mat::MHPgram::new(25.0, 881.33, 44000.0));
driver.fill_region(&set1_region, mat::db::conductor(drive_conductivity));
driver.fill_region(&set2_region, mat::db::conductor(drive_conductivity));
driver.fill_region(&set1_region, mat::IsomorphicConductor::new(drive_conductivity));
driver.fill_region(&set2_region, mat::IsomorphicConductor::new(drive_conductivity));
for r in &coupling_regions {
driver.fill_region(r, mat::db::conductor(drive_conductivity));
driver.fill_region(r, mat::IsomorphicConductor::new(drive_conductivity));
}
println!("boundary: {}um; {}um", m_to_um(boundary_xy), m_to_um(boundary_z));
@@ -74,10 +74,10 @@ fn main() {
assert!(driver.test_region_filled(&ferro1_region, mat::MHPgram::new(25.0, 881.33, 44000.0)));
assert!(driver.test_region_filled(&ferro2_region, mat::MHPgram::new(25.0, 881.33, 44000.0)));
assert!(driver.test_region_filled(&set1_region, mat::db::conductor(drive_conductivity)));
assert!(driver.test_region_filled(&set2_region, mat::db::conductor(drive_conductivity)));
assert!(driver.test_region_filled(&set1_region, mat::IsomorphicConductor::new(drive_conductivity)));
assert!(driver.test_region_filled(&set2_region, mat::IsomorphicConductor::new(drive_conductivity)));
for r in &coupling_regions {
assert!(driver.test_region_filled(r, mat::db::conductor(drive_conductivity)));
assert!(driver.test_region_filled(r, mat::IsomorphicConductor::new(drive_conductivity)));
}
let mut add_drive_pulse = |region: &Torus, start, duration, amp| {
@@ -141,9 +141,9 @@ fn main() {
let _ = std::fs::create_dir_all(&prefix);
driver.add_state_file(&*format!("{}/state.bc", prefix), 9600);
// driver.add_serializer_renderer(&*format!("{}/frame-", prefix), 36000);
driver.add_csv_renderer(&*format!("{}/meas.csv", prefix), 200);
driver.add_csv_renderer(&*format!("{}/meas-sparse.csv", prefix), 8000);
// driver.add_serializer_renderer(&*format!("{}/frame-", prefix), 36000, None);
driver.add_csv_renderer(&*format!("{}/meas.csv", prefix), 200, None);
driver.add_csv_renderer(&*format!("{}/meas-sparse.csv", prefix), 8000, None);
driver.step_until(duration);
driver.step_until(Seconds(duration));
}