Skip to main content

compute_laplacian

Function compute_laplacian 

Source
fn compute_laplacian(
    f: &[f64],
    mask: &[u8],
    nx: usize,
    ny: usize,
    nz: usize,
    vsx: f64,
    vsy: f64,
    vsz: f64,
) -> Vec<f64>
Expand description

Compute Laplacian of a 3D field using mask-adaptive finite differences

Matches MATLAB’s lap1_mex.c: uses central differences where both neighbors are in the mask, forward/backward one-sided stencils near mask boundaries, and zero contribution where neither neighbor is in the mask.