Stencil codes are computer codes that update array elements according to some fixed pattern, called stencils,^{[1]} which themselves are a class of kernels.^{[2]} A stencil code may be thought of as an integer array, containing the indices of the vertices in a geometry array (of the previous level).^{[3]} Multiple stencil codes may be contained in an array of integer arrays known as a stencil array.^{[3]} Stencil codes are used in many scientific and engineering application, but commonly used in solving partial differential equations, image processing, and geometric modeling.^{[2]} Jacobi kernels and Gauss–Seidel kernels are examples of stencil codes.^{[1]}
In operation stencil codes perform a sequence of sweeps through a given array.^{[1]} In each sweep, the stencil code updates all array elements except the boundary.^{[1]} Using neighboring array elements in a fixed stencil pattern, stencil codes compute values of the array and, for each element of the array, the stencil pattern of data accesses is repeated.^{[4]}
