move Ferroxcube3R1MH from spirv_bindings to coremem_types::mat
This commit is contained in:
@@ -10,8 +10,8 @@ mod ffi {
|
|||||||
pub use spirv_backend::entry_points;
|
pub use spirv_backend::entry_points;
|
||||||
pub use spirv_backend::sim::SerializedSimMeta;
|
pub use spirv_backend::sim::SerializedSimMeta;
|
||||||
pub use spirv_backend::support::Optional;
|
pub use spirv_backend::support::Optional;
|
||||||
pub use spirv_backend::mat::{Ferroxcube3R1MH, FullyGenericMaterial, IsoConductorOr};
|
pub use spirv_backend::mat::{FullyGenericMaterial, IsoConductorOr};
|
||||||
pub use coremem_types::mat::{MBPgram, MHPgram};
|
pub use coremem_types::mat::{Ferroxcube3R1MH, MBPgram, MHPgram};
|
||||||
}
|
}
|
||||||
|
|
||||||
// conversion traits for types defined cross-lib
|
// conversion traits for types defined cross-lib
|
||||||
|
@@ -19,9 +19,9 @@ pub mod support;
|
|||||||
pub use sim::{SerializedSimMeta, SerializedStepE, SerializedStepH};
|
pub use sim::{SerializedSimMeta, SerializedStepE, SerializedStepH};
|
||||||
pub use support::{Optional, UnsizedArray};
|
pub use support::{Optional, UnsizedArray};
|
||||||
|
|
||||||
use mat::{IsoConductorOr, Ferroxcube3R1MH, FullyGenericMaterial};
|
use mat::{IsoConductorOr, FullyGenericMaterial};
|
||||||
|
|
||||||
use coremem_types::mat::Material;
|
use coremem_types::mat::{Ferroxcube3R1MH, Material};
|
||||||
use coremem_types::vec::{Vec3, Vec3u};
|
use coremem_types::vec::{Vec3, Vec3u};
|
||||||
|
|
||||||
type Iso3R1 = IsoConductorOr<Ferroxcube3R1MH>;
|
type Iso3R1 = IsoConductorOr<Ferroxcube3R1MH>;
|
||||||
|
@@ -25,24 +25,6 @@ impl Material<f32> for FullyGenericMaterial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MHPgram that's vaguely similar to Ferroxcube's 3R1 material
|
|
||||||
#[derive(Copy, Clone, Default, PartialEq)]
|
|
||||||
pub struct Ferroxcube3R1MH;
|
|
||||||
|
|
||||||
impl Into<MHPgram<f32>> for Ferroxcube3R1MH {
|
|
||||||
fn into(self) -> MHPgram<f32> {
|
|
||||||
// TODO: how much (if any) penalty do we pay for this not being `const`?
|
|
||||||
MHPgram::new(25.0, 881.33, 44000.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Material<f32> for Ferroxcube3R1MH {
|
|
||||||
fn move_b_vec(&self, m: Vec3<f32>, target_b: Vec3<f32>) -> Vec3<f32> {
|
|
||||||
let curve: MHPgram<f32> = (*self).into();
|
|
||||||
curve.move_b_vec(m, target_b)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Optimized material aimed at saving space for the common case of a simulation that contains
|
/// Optimized material aimed at saving space for the common case of a simulation that contains
|
||||||
/// isomorphic conductors plus one exception material.
|
/// isomorphic conductors plus one exception material.
|
||||||
#[derive(Copy, Clone, Default, PartialEq)]
|
#[derive(Copy, Clone, Default, PartialEq)]
|
||||||
|
@@ -176,6 +176,25 @@ impl<R: Real> Material<R> for MHPgram<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// MHPgram that's vaguely similar to Ferroxcube's 3R1 material
|
||||||
|
#[derive(Copy, Clone, Default, PartialEq)]
|
||||||
|
pub struct Ferroxcube3R1MH;
|
||||||
|
|
||||||
|
impl<R: Real> Into<MHPgram<R>> for Ferroxcube3R1MH {
|
||||||
|
fn into(self) -> MHPgram<R> {
|
||||||
|
// TODO: how much (if any) penalty do we pay for this not being `const`?
|
||||||
|
MHPgram::new(25.0f32.cast(), 881.33f32.cast(), 44000.0f32.cast())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<R: Real> Material<R> for Ferroxcube3R1MH {
|
||||||
|
fn move_b_vec(&self, m: Vec3<R>, target_b: Vec3<R>) -> Vec3<R> {
|
||||||
|
let curve: MHPgram<R> = (*self).into();
|
||||||
|
curve.move_b_vec(m, target_b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
Reference in New Issue
Block a user