Crate stencil [] [src]

Stencil calculations

One-dimensional case

Example to calculate the central-difference of sin(x) function using N1D1 stencil and Torus

let mut a = torus::Torus::<f64, Ix1>::zeros(n);
let mut b = a.clone();
a.coordinate_fill(|x| x.sin());
let dx = a.dx();
a.stencil_map(&mut b, |n: N1D1<f64>| (n.r - n.l) / (2.0 * dx));

Two-dimensional case

Example to calculate the central-difference of sin(x)cos(y) function using N1D2 stencil and Torus

let mut a = torus::Torus::<f64, Ix2>::zeros((n, m));
a.coordinate_fill(|(x, y)| x.sin() * y.cos());
let (dx, dy) = a.dx();
let mut ax = a.clone();
let mut ay = a.clone();
a.stencil_map(&mut ax, |n: N1D2<f64>| (n.r - n.l) / (2.0 * dx));
a.stencil_map(&mut ay, |n: N1D2<f64>| (n.t - n.b) / (2.0 * dy));

Modules

padding

Typed Padding

region

Line regions for fixed boundary condition

torus

Define N-dimensional torus

Structs

N1D1

one-neighbor, one-dimensional stencil

N1D2

one-neighbor, two-dimensional stencil

N2D1

two-neighbor, one-dimensional stencil

Traits

Manifold

Uniformly coordinated array

NdArray
Stencil
StencilArray

Array with stencil calculations