diff --git a/crates/cross/src/step/mod.rs b/crates/cross/src/step/mod.rs index f05d4b0..60cb105 100644 --- a/crates/cross/src/step/mod.rs +++ b/crates/cross/src/step/mod.rs @@ -12,6 +12,7 @@ pub use support::{ VolumeSamplePos, }; +// TODO: make the fields private and hide behind a constructor? pub struct StepEContext<'a, R, M> { pub inv_feature_size: R, pub time_step: R, @@ -23,6 +24,9 @@ pub struct StepEContext<'a, R, M> { } impl<'a, R: Real, M: Material> StepEContext<'a, R, M> { + /// given the simulation resoures (material, stimulus, fields), + /// advance the `e` field at the provided index. + /// this is a good toplevel function to use if you don't care about any of the details. pub fn step_flat_view( meta: SimMeta, mat: &RM, @@ -59,6 +63,7 @@ impl<'a, R: Real, M: Material> StepEContext<'a, R, M> { e_matrix[idx] = new_e; } + /// return the e field for this cell at `t=t_{now} + \delta t` pub fn step_e(self) -> Vec3 { let twice_eps0 = R::twice_eps0(); let deltas = self.in_h.delta_h(); @@ -90,6 +95,9 @@ pub struct StepHContext<'a, R, M> { } impl<'a, R: Real, M: Material> StepHContext<'a, R, M> { + /// given the simulation resoures (material, stimulus, fields), + /// advance the `h` field at the provided index. + /// this is a good toplevel function to use if you don't care about any of the details. pub fn step_flat_view( meta: SimMeta, mat: &RM, @@ -131,6 +139,7 @@ impl<'a, R: Real, M: Material> StepHContext<'a, R, M> { m_matrix[idx] = new_m; } + /// return the `(h, m)` fields for this cell at `t=t_{now} + \delta t` pub fn step_h(self) -> (Vec3, Vec3) { let mu0 = R::mu0(); let mu0_inv = R::mu0_inv();