move coremem/mat -> coremem/sim/legacy/mat
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
use coremem::*;
|
use coremem::*;
|
||||||
use coremem::geom::*;
|
use coremem::geom::*;
|
||||||
use coremem::real::{Real as _, ToFloat as _};
|
use coremem::real::{Real as _, ToFloat as _};
|
||||||
|
use coremem::sim::legacy::mat::Static;
|
||||||
use coremem::stim::AbstractStimulus;
|
use coremem::stim::AbstractStimulus;
|
||||||
use coremem::types::vec::Vec3;
|
use coremem::types::vec::Vec3;
|
||||||
use rand::rngs::StdRng;
|
use rand::rngs::StdRng;
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
use crate::geom::{Coord, Index, Meters, Region};
|
use crate::geom::{Coord, Index, Meters, Region};
|
||||||
use crate::mat::{self, Pml};
|
use crate::mat;
|
||||||
use crate::meas::{self, AbstractMeasurement};
|
use crate::meas::{self, AbstractMeasurement};
|
||||||
use crate::real::{self, Real};
|
use crate::real::{self, Real};
|
||||||
use crate::render::{self, MultiRenderer, Renderer};
|
use crate::render::{self, MultiRenderer, Renderer};
|
||||||
use crate::sim::{GenericSim, MaterialSim, SampleableSim};
|
use crate::sim::{GenericSim, MaterialSim, SampleableSim};
|
||||||
use crate::sim::legacy::SimState;
|
use crate::sim::legacy::{self, SimState};
|
||||||
|
use crate::sim::legacy::mat::Pml;
|
||||||
use crate::sim::units::{Frame, Time};
|
use crate::sim::units::{Frame, Time};
|
||||||
use crate::sim::spirv::SpirvSim;
|
use crate::sim::spirv::SpirvSim;
|
||||||
use crate::stim::AbstractStimulus;
|
use crate::stim::AbstractStimulus;
|
||||||
@@ -37,7 +38,7 @@ pub struct Driver<S=SimState> {
|
|||||||
sim_end_time: Option<Frame>,
|
sim_end_time: Option<Frame>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type CpuDriver<R=real::R32, M=mat::GenericMaterial<R>> = Driver<SimState<R, M>>;
|
pub type CpuDriver<R=real::R32, M=legacy::mat::GenericMaterial<R>> = Driver<SimState<R, M>>;
|
||||||
pub type SpirvDriver<M=mat::FullyGenericMaterial<f32>> = Driver<SpirvSim<M>>;
|
pub type SpirvDriver<M=mat::FullyGenericMaterial<f32>> = Driver<SpirvSim<M>>;
|
||||||
|
|
||||||
impl<R: Real, M: Default> Driver<SimState<R, M>> {
|
impl<R: Real, M: Default> Driver<SimState<R, M>> {
|
||||||
|
@@ -9,7 +9,6 @@ use log::info;
|
|||||||
|
|
||||||
pub mod driver;
|
pub mod driver;
|
||||||
pub mod geom;
|
pub mod geom;
|
||||||
pub mod mat;
|
|
||||||
pub mod meas;
|
pub mod meas;
|
||||||
pub mod render;
|
pub mod render;
|
||||||
pub mod sim;
|
pub mod sim;
|
||||||
@@ -17,10 +16,10 @@ pub mod stim;
|
|||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
pub use driver::*;
|
pub use driver::*;
|
||||||
pub use mat::*;
|
|
||||||
pub use sim::*;
|
pub use sim::*;
|
||||||
pub use coremem_types as types;
|
pub use coremem_types as types;
|
||||||
pub use coremem_types::real;
|
pub use coremem_types::real;
|
||||||
|
pub use coremem_types::mat;
|
||||||
|
|
||||||
// Some things to keep in mind:
|
// Some things to keep in mind:
|
||||||
// B = mu_r*H + M
|
// B = mu_r*H + M
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
use super::Material;
|
||||||
use crate::geom::{Line2d, Polygon2d};
|
use crate::geom::{Line2d, Polygon2d};
|
||||||
use crate::mat::Material;
|
|
||||||
use crate::real::Real;
|
use crate::real::Real;
|
||||||
use crate::sim::legacy::{CellState, StepParametersMut};
|
use crate::sim::legacy::{CellState, StepParametersMut};
|
||||||
use crate::types::vec::{Vec2, Vec3};
|
use crate::types::vec::{Vec2, Vec3};
|
@@ -1,6 +1,6 @@
|
|||||||
//! database of common materials
|
//! database of common materials
|
||||||
|
|
||||||
use crate::mat::{AnisomorphicConductor, IsomorphicConductor, LinearMagnet, Ferroxcube3R1, MinimalSquare};
|
use super::{AnisomorphicConductor, IsomorphicConductor, LinearMagnet, Ferroxcube3R1, MinimalSquare};
|
||||||
use crate::real::Real;
|
use crate::real::Real;
|
||||||
use crate::types::vec::Vec3;
|
use crate::types::vec::Vec3;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
use crate::mat::Material;
|
use super::Material;
|
||||||
use crate::real::Real;
|
use crate::real::Real;
|
||||||
use crate::sim::legacy::CellState;
|
use crate::sim::legacy::CellState;
|
||||||
use crate::types::vec::Vec3;
|
use crate::types::vec::Vec3;
|
@@ -1,9 +1,13 @@
|
|||||||
|
pub mod mat;
|
||||||
|
|
||||||
use crate::geom::{Coord, Index, Meters};
|
use crate::geom::{Coord, Index, Meters};
|
||||||
use crate::mat::{self, GenericMaterial, Material, MaterialExt as _};
|
|
||||||
use crate::types::real::{R32, Real};
|
use crate::types::real::{R32, Real};
|
||||||
use crate::types::vec::{Vec3, Vec3u};
|
use crate::types::vec::{Vec3, Vec3u};
|
||||||
use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim};
|
use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim};
|
||||||
use crate::stim::AbstractStimulus;
|
use crate::stim::AbstractStimulus;
|
||||||
|
|
||||||
|
use mat::{GenericMaterial, Material, MaterialExt as _};
|
||||||
|
|
||||||
use log::trace;
|
use log::trace;
|
||||||
use ndarray::{Array3, Zip};
|
use ndarray::{Array3, Zip};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
@@ -878,7 +882,7 @@ impl<R: Real> CellState<R> {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::geom::{Cube, Region, WorldRegion};
|
use crate::geom::{Cube, Region, WorldRegion};
|
||||||
use crate::mat::{AnisomorphicConductor, IsomorphicConductor, Pml, Static};
|
use crate::sim::legacy::mat::{AnisomorphicConductor, IsomorphicConductor, Pml, Static};
|
||||||
use crate::real::{R64, ToFloat as _};
|
use crate::real::{R64, ToFloat as _};
|
||||||
use float_eq::assert_float_eq;
|
use float_eq::assert_float_eq;
|
||||||
use more_asserts::*;
|
use more_asserts::*;
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
use crate::geom::{Coord, Cube, Index, InvertedRegion, Meters, Region};
|
use crate::geom::{Coord, Cube, Index, InvertedRegion, Meters, Region};
|
||||||
use crate::mat;
|
|
||||||
use crate::types::real::Real;
|
use crate::types::real::Real;
|
||||||
use crate::types::vec::{Vec3, Vec3u};
|
use crate::types::vec::{Vec3, Vec3u};
|
||||||
use crate::stim::{AbstractStimulus, NoopStimulus};
|
use crate::stim::{AbstractStimulus, NoopStimulus};
|
||||||
@@ -385,7 +384,7 @@ pub trait SampleableSim: Send + Sync {
|
|||||||
let cell = self.sample(idx.to_meters(self.feature_size()));
|
let cell = self.sample(idx.to_meters(self.feature_size()));
|
||||||
*e = cell.e().cast();
|
*e = cell.e().cast();
|
||||||
*h = cell.h().cast();
|
*h = cell.h().cast();
|
||||||
mat::Static {
|
legacy::mat::Static {
|
||||||
conductivity: cell.conductivity().cast(),
|
conductivity: cell.conductivity().cast(),
|
||||||
m: cell.m().cast(),
|
m: cell.m().cast(),
|
||||||
}
|
}
|
||||||
|
@@ -652,7 +652,7 @@ mod test {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::real::ToFloat as _;
|
use crate::real::ToFloat as _;
|
||||||
use crate::sim::SampleableSim;
|
use crate::sim::SampleableSim;
|
||||||
use crate::sim::legacy::SimState;
|
use crate::sim::legacy::{self, SimState};
|
||||||
use crate::mat::{self, AnisomorphicConductor};
|
use crate::mat::{self, AnisomorphicConductor};
|
||||||
fn mean_magnitude_e(sim: &dyn SampleableSim) -> f32 {
|
fn mean_magnitude_e(sim: &dyn SampleableSim) -> f32 {
|
||||||
(sim.map_sum_enumerated(|_pos: Index, cell| {
|
(sim.map_sum_enumerated(|_pos: Index, cell| {
|
||||||
@@ -909,7 +909,7 @@ mod test {
|
|||||||
let slope = rng.gen_range(0.0..0.9*f32::mu0_inv());
|
let slope = rng.gen_range(0.0..0.9*f32::mu0_inv());
|
||||||
let b_end = b_start + b_range;
|
let b_end = b_start + b_range;
|
||||||
let m_max = b_range * slope;
|
let m_max = b_range * slope;
|
||||||
ref_state.put_material(Index::new(x, y, z), mat::MBPgram::new(
|
ref_state.put_material(Index::new(x, y, z), legacy::mat::MBPgram::new(
|
||||||
b_start.cast(), b_end.cast(), m_max.cast()
|
b_start.cast(), b_end.cast(), m_max.cast()
|
||||||
));
|
));
|
||||||
dut_state.put_material(Index::new(x, y, z), coremem_types::mat::MBPgram::new(
|
dut_state.put_material(Index::new(x, y, z), coremem_types::mat::MBPgram::new(
|
||||||
@@ -1177,7 +1177,7 @@ mod test {
|
|||||||
let slope = rng.gen_range(0.0..0.9*f32::mu0_inv());
|
let slope = rng.gen_range(0.0..0.9*f32::mu0_inv());
|
||||||
let b_end = b_start + b_range;
|
let b_end = b_start + b_range;
|
||||||
let m_max = b_range * slope;
|
let m_max = b_range * slope;
|
||||||
ref_state.put_material(Index::new(x, y, z), mat::MBPgram::new(
|
ref_state.put_material(Index::new(x, y, z), legacy::mat::MBPgram::new(
|
||||||
b_start.cast(), b_end.cast(), m_max.cast()
|
b_start.cast(), b_end.cast(), m_max.cast()
|
||||||
));
|
));
|
||||||
dut_state.put_material(Index::new(x, y, z), coremem_types::mat::MBPgram::new(
|
dut_state.put_material(Index::new(x, y, z), coremem_types::mat::MBPgram::new(
|
||||||
|
Reference in New Issue
Block a user