A stencil calculation for three-dimension array