function [ C, N, S, E, W ] = cnsew ( i, j, nx )

%*****************************************************************************80
%
%% cnsew returns the variable indices of the 5 point Laplacian stencil.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 July 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer i, j: the grid indices of a point.
%
%    integer nx: the number of nodes in the x direction.
%
%  Output:
%
%    integer C, N, S, E, W: the variable indices for the central,
%    north, south, east, and west nodes.
%
  C = i     + ( j - 1 ) * nx;
  N = i     + ( j     ) * nx;
  S = i     + ( j - 2 ) * nx;
  E = i + 1 + ( j - 1 ) * nx;
  W = i - 1 + ( j - 1 ) * nx;

  return
end
