function diffusivity_2d_pwc_contour ( h, w, a, b, c, d )

%*****************************************************************************80
%
%% diffusivity_2d_pwc_contour: plot diffusivity_2d_pwc() function.
%
%  Discussion:
%
%    The diffusivity function is computed by diffusivity_2d_pwc().
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    06 March 2019
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer H, W, the height and width of the element grid.
%
%    Input, real A, B, C, D, the lower and upper limits of X, and of Y.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'diffusivity_2d_pwc_contour\n' );
  fprintf ( 1, '  Test diffusivity_2d_pwc\n' );
  fprintf ( 1, '  Display contour or surface plots of a stochastic\n' );
  fprintf ( 1, '  diffusivity function defined by diffusivity_2d_pwc.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Underlying grid is %d elements wide (X) and %d high (Y)\n', w, h );
%
%  Set the spatial grid X, Y..
%
  nx = 101;
  ny = 101;

  x_1d = linspace ( a, b, nx );
  y_1d = linspace ( c, d, ny );

  [ Xmat, Ymat ] = ndgrid ( x_1d, y_1d );

  omega = 1.0 - 0.5 * rand ( h * w, 1 );
  n = nx * ny;

  Amat = diffusivity_2d_pwc ( h, w, a, b, c, d, omega, n, Xmat, Ymat );
%
%  Plot the diffusivity field.
%
  surf ( Xmat, Ymat, Amat, 'EdgeColor', 'interp' )
  xlabel ( '<--- X --->', 'fontsize', 12 )
  ylabel ( '<--- Y --->', 'fontsize', 12 )
  zlabel ( '<--- \rho(X,Y) --->', 'fontsize', 12 )
  title ( 'diffusivity\_2d\_pwc()', 'fontsize', 18 )

  filename = 'diffusivity_2d_pwc.png';
  print ( '-dpng', filename )
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Plot file stored as "%s".\n', filename );

  pause ( 5 );

  return
end
