pub struct Material {
pub epsilon: Aniso,
pub mue: Aniso,
pub kappa: Aniso,
pub sigma: Aniso,
pub density: Scalar,
pub density_weight: WeightFn,
pub isotropic: bool,
}Expand description
Electric/magnetic material with (optionally anisotropic and position dependent) constitutive parameters.
epsilon: relative permittivitymue: relative permeabilitykappa: electric conductivity (S/m)sigma: magnetic conductivity (Ω/m)density: mass density (kg/m³)
The default is vacuum (εᵣ = μᵣ = 1, lossless), isotropic.
use csx::properties::{Material, MaterialQuantity};
use csx::Vec3;
// isotropic FR4
let fr4 = Material::new(4.3, 0.02);
assert_eq!(fr4.base_value(MaterialQuantity::Epsilon, 2), 4.3);
// anisotropic (uniaxial) material: ε_z differs
let mut m = Material::new(9.4, 0.0);
m.isotropic = false;
m.epsilon.value[2].set(11.6);
assert_eq!(m.values_at(MaterialQuantity::Epsilon, Vec3::ZERO), [9.4, 9.4, 11.6]);
// graded permittivity along x
let mut g = Material::new(2.0, 0.0);
g.epsilon.set_weight("1 + x/10");
assert_eq!(g.value_at(MaterialQuantity::Epsilon, 0, Vec3::new(5.0, 0.0, 0.0)), 3.0);Fields§
§epsilon: AnisoRelative permittivity.
mue: AnisoRelative permeability.
kappa: AnisoElectric conductivity.
sigma: AnisoMagnetic conductivity.
density: ScalarMass density.
density_weight: WeightFnWeighting function of the density.
isotropic: boolIf true only the first axis of each quantity is used.
Implementations§
Source§impl Material
impl Material
Sourcepub fn new(epsilon: f64, kappa: f64) -> Self
pub fn new(epsilon: f64, kappa: f64) -> Self
Material with the given relative permittivity and conductivity.
Sourcepub fn quantity(&self, q: MaterialQuantity) -> &Aniso
pub fn quantity(&self, q: MaterialQuantity) -> &Aniso
The quantity selected by q.
Sourcepub fn quantity_mut(&mut self, q: MaterialQuantity) -> &mut Aniso
pub fn quantity_mut(&mut self, q: MaterialQuantity) -> &mut Aniso
Mutable access to the quantity selected by q.
Sourcepub fn value_at(&self, q: MaterialQuantity, dir: usize, p: Vec3) -> f64
pub fn value_at(&self, q: MaterialQuantity, dir: usize, p: Vec3) -> f64
Weighted value of q along axis dir (0..=2; higher values are
clamped to 2) at Cartesian point p. Isotropic materials use axis 0
for every direction.
Sourcepub fn values_at(&self, q: MaterialQuantity, p: Vec3) -> [f64; 3]
pub fn values_at(&self, q: MaterialQuantity, p: Vec3) -> [f64; 3]
Weighted values of q on all three axes at p.
Sourcepub fn base_value(&self, q: MaterialQuantity, dir: usize) -> f64
pub fn base_value(&self, q: MaterialQuantity, dir: usize) -> f64
Unweighted value of q along dir.
Sourcepub fn density_at(&self, p: Vec3) -> f64
pub fn density_at(&self, p: Vec3) -> f64
Weighted density at p.
Trait Implementations§
impl StructuralPartialEq for Material
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more