replace 'StaticSim' with the SpirvSim type, material being the Vacuum
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use crate::geom::{Coord, Cube, Index, InvertedRegion, Meters, Region};
|
||||
use crate::types::mat::Vacuum;
|
||||
use crate::types::real::Real;
|
||||
use crate::types::vec::{Vec3, Vec3u};
|
||||
use crate::stim::{AbstractStimulus, NoopStimulus};
|
||||
use ndarray::Zip;
|
||||
use rayon::prelude::*;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use std::iter::Sum;
|
||||
@@ -11,7 +11,9 @@ pub mod legacy;
|
||||
pub mod spirv;
|
||||
pub mod units;
|
||||
|
||||
use legacy::StaticSim;
|
||||
use spirv::{CpuBackend, SpirvSim};
|
||||
|
||||
pub type StaticSim = SpirvSim<f32, Vacuum, CpuBackend>;
|
||||
|
||||
|
||||
pub trait MaterialSim: GenericSim {
|
||||
@@ -374,21 +376,5 @@ pub trait SampleableSim: Send + Sync {
|
||||
}
|
||||
|
||||
/// Take a "snapshot" of the simulation, dropping all material-specific information.
|
||||
fn to_static(&self) -> StaticSim {
|
||||
let mut state = legacy::SimState::new(self.size(), self.feature_size());
|
||||
state.step_no = self.step_no();
|
||||
Zip::from(ndarray::indices_of(&state.cells)).and(&mut state.e).and(&mut state.h).par_map_assign_into(
|
||||
&mut state.cells,
|
||||
|(z, y, x), e, h| {
|
||||
let idx = Index((x as u32, y as u32, z as u32).into());
|
||||
let cell = self.sample(idx.to_meters(self.feature_size()));
|
||||
*e = cell.e().cast();
|
||||
*h = cell.h().cast();
|
||||
legacy::mat::Static {
|
||||
conductivity: cell.conductivity().cast(),
|
||||
m: cell.m().cast(),
|
||||
}
|
||||
});
|
||||
state
|
||||
}
|
||||
fn to_static(&self) -> StaticSim;
|
||||
}
|
||||
|
Reference in New Issue
Block a user