rename CellStateWithM => Fields; parameterize Sample over R
This commit is contained in:
@@ -81,19 +81,29 @@ pub type GenericSim<R> = SpirvSim<R, FullyGenericMaterial<R>, CpuBackend>;
|
||||
/// +------------+------------+
|
||||
///
|
||||
#[derive(Clone, Default, Serialize, Deserialize)]
|
||||
pub struct Sample {
|
||||
state: CellStateWithM<f32>,
|
||||
conductivity: Vec3<f32>,
|
||||
pub struct Sample<R=f32> {
|
||||
state: Fields<R>,
|
||||
conductivity: Vec3<R>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct CellStateWithM<R> {
|
||||
pub struct Fields<R> {
|
||||
e: Vec3<R>,
|
||||
h: Vec3<R>,
|
||||
m: Vec3<R>,
|
||||
}
|
||||
|
||||
impl<R: Real> CellStateWithM<R> {
|
||||
impl<R: Real> Fields<R> {
|
||||
pub fn new(e: Vec3<R>, h: Vec3<R>, m: Vec3<R>) -> Self {
|
||||
Self { e, h, m }
|
||||
}
|
||||
pub fn cast<R2: Real>(&self) -> Fields<R2> {
|
||||
Fields {
|
||||
e: self.e.cast(),
|
||||
h: self.h.cast(),
|
||||
m: self.m.cast(),
|
||||
}
|
||||
}
|
||||
pub fn e(&self) -> Vec3<R> {
|
||||
self.e
|
||||
}
|
||||
|
Reference in New Issue
Block a user