pub struct Medium { /* private fields */ }Expand description
A lattice region of any shape: the nodes inside a mask and each node’s four neighbours, a neighbour outside the mask (or the lattice) replaced by the node itself, so the 5-point Laplacian sees a zero gradient there (no-flux wall).
Implementations§
Source§impl Medium
impl Medium
Sourcepub fn rebuild(&mut self, size: Size, inside: impl Fn(i32, i32) -> bool)
pub fn rebuild(&mut self, size: Size, inside: impl Fn(i32, i32) -> bool)
Rebuild for a size lattice with inside(x, y) as the mask (reusing buffers).
pub fn size(&self) -> Size
Sourcepub fn contains(&self, i: usize) -> bool
pub fn contains(&self, i: usize) -> bool
Whether lattice node i is inside the mask (false off the lattice).
Sourcepub fn contains_xy(&self, x: i32, y: i32) -> bool
pub fn contains_xy(&self, x: i32, y: i32) -> bool
Whether (x, y) is inside the mask (false off the lattice).
Sourcepub fn neighbours(&self, i: usize) -> [u32; 4]
pub fn neighbours(&self, i: usize) -> [u32; 4]
The four neighbours of node i (walls folded back onto i).
Trait Implementations§
Auto Trait Implementations§
impl Forget for Medium
impl Freeze for Medium
impl Move for Medium
impl RefUnwindSafe for Medium
impl Send for Medium
impl Sync for Medium
impl Unpin for Medium
impl UnsafeUnpin for Medium
impl UnwindSafe for Medium
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