36 lines
1.0 KiB
Rust
36 lines
1.0 KiB
Rust
use crate::real::Real;
|
|
use crate::vec::Vec3;
|
|
|
|
mod compound;
|
|
mod conductor;
|
|
mod mb_pgram;
|
|
mod mh_pgram;
|
|
pub use compound::{GenericMaterial, IsoConductorOr};
|
|
pub use conductor::{AnisomorphicConductor, IsomorphicConductor};
|
|
pub use mb_pgram::MBPgram;
|
|
pub use mh_pgram::{Ferroxcube3R1MH, MHPgram};
|
|
|
|
|
|
#[cfg(feature = "serde")]
|
|
use serde::{Serialize, Deserialize};
|
|
|
|
pub trait Material<R: Real>: Sized {
|
|
fn conductivity(&self) -> Vec3<R> {
|
|
Default::default()
|
|
}
|
|
/// returns the new M vector for this material
|
|
fn move_b_vec(&self, m: Vec3<R>, _target_b: Vec3<R>) -> Vec3<R> {
|
|
// XXX could return either 0, or `m`. they should be the same, but one might be more
|
|
// optimizable than the other (untested).
|
|
m
|
|
}
|
|
}
|
|
|
|
/// Default, non-interesting Material.
|
|
/// has 0 conductivity (electrical and magnetic)
|
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
|
#[cfg_attr(feature = "fmt", derive(Debug))]
|
|
#[derive(Copy, Clone, Default, PartialEq)]
|
|
pub struct Vacuum;
|
|
impl<R: Real> Material<R> for Vacuum {}
|