num::sample_2d_periodic¶
Defined in header <pde/stencil.hpp>
real sample_2d_periodic(const vec<real> &field, idx N, real h, real px, real py,
real ox, real oy); // (1)
real sample_2d_periodic(const scalar_field_2d &g, real px, real py, real ox = 0.0,
real oy = 0.0); // (2)
Bilinear interpolation on a periodic NxN grid with a stagger offset.
field[i,j] sits at physical position (ih + ox, jh + oy). On a MAC grid, u takes (ox, oy) = (0, h/2) and v takes (h/2, 0).
Parameters¶
field: Flattened grid samples.N: Grid width and height.h: Grid spacing.px: Physical x coordinate.py: Physical y coordinate.ox: x offset in physical units.oy: y offset in physical units.