function tno_sparse_grid_write ( header, l, m, n, x, w )

%*****************************************************************************80
%
%% tno_sparse_grid_write() writes a Truncated Normal Odd Sparse Grid to X and W files.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 July 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string HEADER, a header for the file names.
%
%    integer L, the level of the rule.
%
%    integer M, the spatial dimension.
%
%    integer N, the number of points.
%
%    real X(M,N), the abscissas.
%
%    real W(N), the weights.
%
  w_filename = sprintf ( '%s_d%d_level%d_w.txt', header, m, l );
  x_filename = sprintf ( '%s_d%d_level%d_x.txt', header, m, l );

  r8vec_write ( w_filename, n, w );
  r8mat_write ( x_filename, m, n, x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  W data written to "%s".\n', w_filename );
  fprintf ( 1, '  X data written to "%s",\n', x_filename );

  return
end
