rename 'coremem_types' -> 'coremem_cross' to better reflect its purpose

This commit is contained in:
2022-07-28 15:40:23 -07:00
parent 9e35b29087
commit 45d2de29c6
46 changed files with 68 additions and 67 deletions

18
Cargo.lock generated
View File

@@ -312,7 +312,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"common_macros", "common_macros",
"coremem_types", "coremem_cross",
"criterion", "criterion",
"crossterm", "crossterm",
"csv", "csv",
@@ -345,6 +345,13 @@ dependencies = [
"y4m", "y4m",
] ]
[[package]]
name = "coremem_cross"
version = "0.2.0"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "coremem_post" name = "coremem_post"
version = "0.1.0" version = "0.1.0"
@@ -359,13 +366,6 @@ dependencies = [
"structopt", "structopt",
] ]
[[package]]
name = "coremem_types"
version = "0.1.0"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.3.2" version = "1.3.2"
@@ -2096,7 +2096,7 @@ source = "git+https://github.com/EmbarkStudios/rust-gpu#0866cf591a7fdbbd15bdb346
name = "spirv_backend" name = "spirv_backend"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"coremem_types", "coremem_cross",
"spirv-std", "spirv-std",
] ]

View File

@@ -5,7 +5,7 @@ members = [
"crates/spirv_backend", "crates/spirv_backend",
"crates/spirv_backend_builder", "crates/spirv_backend_builder",
"crates/spirv_backend_runner", "crates/spirv_backend_runner",
"crates/types", "crates/cross",
"crates/post", "crates/post",
"crates/applications/buffer_proto5", "crates/applications/buffer_proto5",

View File

@@ -12,7 +12,7 @@ use coremem::geom::{Coord as _, Cube, Index};
use coremem::units::Seconds; use coremem::units::Seconds;
use coremem::sim::spirv::{self, SpirvSim}; use coremem::sim::spirv::{self, SpirvSim};
use coremem::stim::{Stimulus, TimeVarying as _, UniformStimulus}; use coremem::stim::{Stimulus, TimeVarying as _, UniformStimulus};
use coremem::types::vec::Vec3; use coremem::cross::vec::Vec3;
type Mat = mat::FullyGenericMaterial<f32>; type Mat = mat::FullyGenericMaterial<f32>;

View File

@@ -47,7 +47,7 @@ spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu" }
spirv-std-macros = { git = "https://github.com/EmbarkStudios/rust-gpu" } spirv-std-macros = { git = "https://github.com/EmbarkStudios/rust-gpu" }
spirv_backend = { path = "../spirv_backend" } spirv_backend = { path = "../spirv_backend" }
spirv_backend_runner = { path = "../spirv_backend_runner" } spirv_backend_runner = { path = "../spirv_backend_runner" }
coremem_types = { path = "../types", features = ["fmt", "serde"] } coremem_cross = { path = "../cross", features = ["fmt", "serde"] }
[dev-dependencies] [dev-dependencies]

View File

@@ -1,7 +1,7 @@
use coremem::{self, Driver, GenericSim}; use coremem::{self, Driver, GenericSim};
use coremem::sim::legacy::SimState; use coremem::sim::legacy::SimState;
use coremem::sim::spirv::{SpirvSim, WgpuBackend}; use coremem::sim::spirv::{SpirvSim, WgpuBackend};
use coremem::types::mat::FullyGenericMaterial; use coremem::cross::mat::FullyGenericMaterial;
use coremem::geom::Index; use coremem::geom::Index;
use std::time::{Instant, Duration}; use std::time::{Instant, Duration};

View File

@@ -6,7 +6,7 @@ use crate::render::{self, MultiRenderer, Renderer};
use crate::sim::{GenericSim, MaterialSim, SampleableSim}; use crate::sim::{GenericSim, MaterialSim, SampleableSim};
use crate::sim::units::{Frame, Time}; use crate::sim::units::{Frame, Time};
use crate::stim::AbstractStimulus; use crate::stim::AbstractStimulus;
use crate::types::vec::Vec3; use crate::cross::vec::Vec3;
use log::{info, trace}; use log::{info, trace};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@@ -1,5 +1,5 @@
use coremem_types::real::Real; use coremem_cross::real::Real;
use coremem_types::vec::Vec2; use coremem_cross::vec::Vec2;
use std::ops::Add; use std::ops::Add;

View File

@@ -1,6 +1,6 @@
use crate::geom::Line2d; use crate::geom::Line2d;
use coremem_types::real::Real; use coremem_cross::real::Real;
use coremem_types::vec::Vec2; use coremem_cross::vec::Vec2;
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct Polygon2d<R> { pub struct Polygon2d<R> {

View File

@@ -1,6 +1,6 @@
use crate::geom::Meters; use crate::geom::Meters;
use coremem_types::real::Real as _; use coremem_cross::real::Real as _;
use coremem_types::vec::{Vec2, Vec3}; use coremem_cross::vec::{Vec2, Vec3};
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use std::fmt::{self, Display}; use std::fmt::{self, Display};

View File

@@ -1,5 +1,5 @@
use coremem_types::real::ToFloat; use coremem_cross::real::ToFloat;
use coremem_types::vec::{Vec3, Vec3u}; use coremem_cross::vec::{Vec3, Vec3u};
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::cmp::Ordering; use std::cmp::Ordering;

View File

@@ -16,9 +16,9 @@ pub mod stim;
pub use driver::*; pub use driver::*;
pub use sim::*; pub use sim::*;
pub use coremem_types as types; pub use coremem_cross as cross;
pub use coremem_types::real; pub use coremem_cross::real;
pub use coremem_types::mat; pub use coremem_cross::mat;
// Some things to keep in mind: // Some things to keep in mind:
// B = mu_r*H + M // B = mu_r*H + M

View File

@@ -1,6 +1,6 @@
use crate::geom::{Meters, Region, Torus, WorldRegion}; use crate::geom::{Meters, Region, Torus, WorldRegion};
use crate::real::{Real as _, ToFloat as _}; use crate::real::{Real as _, ToFloat as _};
use crate::types::vec::Vec3; use crate::cross::vec::Vec3;
use crate::sim::SampleableSim; use crate::sim::SampleableSim;
use dyn_clone::{self, DynClone}; use dyn_clone::{self, DynClone};
use indexmap::IndexMap; use indexmap::IndexMap;

View File

@@ -1,6 +1,6 @@
use crate::geom::Meters; use crate::geom::Meters;
use crate::real::ToFloat as _; use crate::real::ToFloat as _;
use crate::types::vec::{Vec2, Vec3}; use crate::cross::vec::{Vec2, Vec3};
use crate::sim::{SampleableSim, Sample, StaticSim}; use crate::sim::{SampleableSim, Sample, StaticSim};
use crate::meas::{self, AbstractMeasurement}; use crate::meas::{self, AbstractMeasurement};
use crossterm::{cursor, QueueableCommand as _}; use crossterm::{cursor, QueueableCommand as _};

View File

@@ -2,7 +2,7 @@ use super::Material;
use crate::geom::{Line2d, Polygon2d}; use crate::geom::{Line2d, Polygon2d};
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::cross::vec::{Vec2, Vec3};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use log::trace; use log::trace;

View File

@@ -2,7 +2,7 @@
use super::{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::cross::vec::Vec3;
pub fn conductor<R: Real, R2: Real>(conductivity: R2) -> IsomorphicConductor<R> { pub fn conductor<R: Real, R2: Real>(conductivity: R2) -> IsomorphicConductor<R> {
IsomorphicConductor::new(conductivity.cast()) IsomorphicConductor::new(conductivity.cast())

View File

@@ -1,7 +1,7 @@
use super::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::cross::vec::Vec3;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};

View File

@@ -1,6 +1,6 @@
use crate::real::Real; use crate::real::Real;
use crate::sim::legacy::{CellState, PmlParameters, PmlState, StepParameters, StepParametersMut}; use crate::sim::legacy::{CellState, PmlParameters, PmlState, StepParameters, StepParametersMut};
use crate::types::vec::Vec3; use crate::cross::vec::Vec3;
use enum_dispatch::enum_dispatch; use enum_dispatch::enum_dispatch;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
@@ -10,7 +10,7 @@ mod bh_ferromagnet;
mod linear; mod linear;
pub use bh_ferromagnet::*; pub use bh_ferromagnet::*;
pub use coremem_types::mat::{ pub use coremem_cross::mat::{
AnisomorphicConductor, AnisomorphicConductor,
Ferroxcube3R1MH, Ferroxcube3R1MH,
FullyGenericMaterial, FullyGenericMaterial,
@@ -316,14 +316,14 @@ impl<R: Real> Material<R> for GenericMaterialOneField<R> {
} }
} }
// coremem_types adapters // coremem_cross adapters
// TODO: move this to a dedicated file // TODO: move this to a dedicated file
/// the coremem_types Materials are stateless; /// the coremem_cross Materials are stateless;
/// rather than hold onto their own magnetic fields (for example), the simulation holds that. /// rather than hold onto their own magnetic fields (for example), the simulation holds that.
/// that's counter to the original cpu-only simulation, in which materials hold their own state. /// that's counter to the original cpu-only simulation, in which materials hold their own state.
/// ///
/// this type adapts any stateless coremem_types::mat::Material type to be a coremem::mat::Material. /// this type adapts any stateless coremem_cross::mat::Material type to be a coremem::mat::Material.
#[derive(Default, Copy, Clone, PartialEq, Serialize, Deserialize)] #[derive(Default, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct AdaptStateless<R, M> { pub struct AdaptStateless<R, M> {
mat: M, mat: M,
@@ -342,7 +342,7 @@ impl<R: Default, M> From<M> for AdaptStateless<R, M> {
} }
} }
impl<R: Real, M: coremem_types::mat::Material<R>> Material<R> for AdaptStateless<R, M> { impl<R: Real, M: coremem_cross::mat::Material<R>> Material<R> for AdaptStateless<R, M> {
fn m(&self) -> Vec3<R> { fn m(&self) -> Vec3<R> {
self.m self.m
} }
@@ -359,20 +359,20 @@ impl<R: Real, M: coremem_types::mat::Material<R>> Material<R> for AdaptStateless
// conductors: these are truly stateless // conductors: these are truly stateless
impl<R: Real> Material<R> for AnisomorphicConductor<R> { impl<R: Real> Material<R> for AnisomorphicConductor<R> {
fn step_parameters_mut<'a>(&'a mut self) -> StepParametersMut<'a, R> { fn step_parameters_mut<'a>(&'a mut self) -> StepParametersMut<'a, R> {
let c = coremem_types::mat::Material::conductivity(self); let c = coremem_cross::mat::Material::conductivity(self);
StepParametersMut::default().with_conductivity(c) StepParametersMut::default().with_conductivity(c)
} }
} }
impl<R: Real> Material<R> for IsomorphicConductor<R> { impl<R: Real> Material<R> for IsomorphicConductor<R> {
fn step_parameters_mut<'a>(&'a mut self) -> StepParametersMut<'a, R> { fn step_parameters_mut<'a>(&'a mut self) -> StepParametersMut<'a, R> {
let c = coremem_types::mat::Material::conductivity(self); let c = coremem_cross::mat::Material::conductivity(self);
StepParametersMut::default().with_conductivity(c) StepParametersMut::default().with_conductivity(c)
} }
} }
pub type MBPgram<R> = AdaptStateless<R, coremem_types::mat::MBPgram<R>>; pub type MBPgram<R> = AdaptStateless<R, coremem_cross::mat::MBPgram<R>>;
impl<R: Real> MBPgram<R> { impl<R: Real> MBPgram<R> {
pub fn new(b_start: R, b_end: R, m_max: R) -> Self { pub fn new(b_start: R, b_end: R, m_max: R) -> Self {
coremem_types::mat::MBPgram::new(b_start, b_end, m_max).into() coremem_cross::mat::MBPgram::new(b_start, b_end, m_max).into()
} }
} }

View File

@@ -1,8 +1,8 @@
pub mod mat; pub mod mat;
use crate::geom::{Coord, Index, Meters}; use crate::geom::{Coord, Index, Meters};
use crate::types::real::{R32, Real}; use crate::cross::real::{R32, Real};
use crate::types::vec::{Vec3, Vec3u}; use crate::cross::vec::{Vec3, Vec3u};
use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim, StaticSim}; use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim, StaticSim};
use crate::stim::AbstractStimulus; use crate::stim::AbstractStimulus;

View File

@@ -1,7 +1,7 @@
use crate::geom::{Coord, Cube, Index, InvertedRegion, Meters, Region}; use crate::geom::{Coord, Cube, Index, InvertedRegion, Meters, Region};
use crate::types::mat::Vacuum; use crate::cross::mat::Vacuum;
use crate::types::real::Real; use crate::cross::real::Real;
use crate::types::vec::{Vec3, Vec3u}; use crate::cross::vec::{Vec3, Vec3u};
use crate::stim::{AbstractStimulus, NoopStimulus}; use crate::stim::{AbstractStimulus, NoopStimulus};
use rayon::prelude::*; use rayon::prelude::*;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};

View File

@@ -1,7 +1,7 @@
use coremem_types::mat::Material; use coremem_cross::mat::Material;
use coremem_types::real::Real; use coremem_cross::real::Real;
use coremem_types::step::{SimMeta, StepEContext, StepHContext}; use coremem_cross::step::{SimMeta, StepEContext, StepHContext};
use coremem_types::vec::{Vec3, Vec3u}; use coremem_cross::vec::{Vec3, Vec3u};
use super::SimBackend; use super::SimBackend;

View File

@@ -5,8 +5,8 @@ use std::num::NonZeroU64;
use wgpu; use wgpu;
use wgpu::util::DeviceExt as _; use wgpu::util::DeviceExt as _;
use coremem_types::vec::{Vec3, Vec3u}; use coremem_cross::vec::{Vec3, Vec3u};
use coremem_types::step::SimMeta; use coremem_cross::step::SimMeta;
use spirv_backend::HasEntryPoints; use spirv_backend::HasEntryPoints;

View File

@@ -6,9 +6,9 @@ use crate::geom::{Coord, Index, Meters};
use crate::real::Real; use crate::real::Real;
use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim, StaticSim}; use crate::sim::{CellStateWithM, GenericSim, MaterialSim, Sample, SampleableSim, StaticSim};
use crate::stim::AbstractStimulus; use crate::stim::AbstractStimulus;
use crate::types::vec::Vec3; use crate::cross::vec::Vec3;
use coremem_types::mat::{FullyGenericMaterial, Material}; use coremem_cross::mat::{FullyGenericMaterial, Material};
use coremem_types::step::SimMeta; use coremem_cross::step::SimMeta;
mod cpu; mod cpu;
mod gpu; mod gpu;
@@ -514,7 +514,7 @@ mod test {
ref_state.put_material(Index::new(x, y, z), legacy::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_cross::mat::MBPgram::new(
b_start, b_end, m_max b_start, b_end, m_max
)); ));
} }

View File

@@ -1,5 +1,5 @@
use crate::real::*; use crate::real::*;
use crate::types::vec::Vec3; use crate::cross::vec::Vec3;
use crate::geom::{Meters, Region}; use crate::geom::{Meters, Region};
use rand; use rand;

View File

@@ -1,10 +1,11 @@
[package] [package]
name = "coremem_types" name = "coremem_cross"
version = "0.1.0" version = "0.2.0"
authors = ["Colin <colin@uninsane.org>"] authors = ["Colin <colin@uninsane.org>"]
edition = "2021" edition = "2021"
[features] [features]
# some functionality does not compile for the spirv target, so we feature gate these.
serde = [ "dep:serde" ] serde = [ "dep:serde" ]
fmt = [] fmt = []

View File

@@ -8,4 +8,4 @@ crate-type = ["dylib", "lib"]
[dependencies] [dependencies]
spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["glam"] } # MIT or Apache 2.0 spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["glam"] } # MIT or Apache 2.0
coremem_types = { path = "../types" } coremem_cross = { path = "../cross" }

View File

@@ -1,9 +1,9 @@
use spirv_std::RuntimeArray; use spirv_std::RuntimeArray;
use coremem_types::mat::Material; use coremem_cross::mat::Material;
use coremem_types::real::Real; use coremem_cross::real::Real;
use coremem_types::step::{SimMeta, StepEContext, StepHContext}; use coremem_cross::step::{SimMeta, StepEContext, StepHContext};
use coremem_types::vec::{Vec3, Vec3u}; use coremem_cross::vec::{Vec3, Vec3u};
use crate::support::SizedArray; use crate::support::SizedArray;

View File

@@ -15,10 +15,10 @@ use spirv_std::macros::spirv;
mod adapt; mod adapt;
mod support; mod support;
use coremem_types::mat::{Ferroxcube3R1MH, FullyGenericMaterial, IsoConductorOr}; use coremem_cross::mat::{Ferroxcube3R1MH, FullyGenericMaterial, IsoConductorOr};
use coremem_types::real::R32; use coremem_cross::real::R32;
use coremem_types::step::SimMeta; use coremem_cross::step::SimMeta;
use coremem_types::vec::{Vec3, Vec3u}; use coremem_cross::vec::{Vec3, Vec3u};
type Iso3R1<R> = IsoConductorOr<R, Ferroxcube3R1MH>; type Iso3R1<R> = IsoConductorOr<R, Ferroxcube3R1MH>;