function h = p17_fh ( p, varargin )

%*****************************************************************************80
%
%% p17_fh() returns a mesh size function for problem 17.
%
%  Modified:
%
%    05 July 2008
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Per-Olof Persson and Gilbert Strang,
%    A Simple Mesh Generator in MATLAB,
%    SIAM Review,
%    Volume 46, Number 2, June 2004, pages 329-345.
%
%  Input:
%
%    real P(NP,ND), the point coordinates.
%
%    VARARGIN, room for extra arguments.
%
%  Output:
%
%    real H(NP,1), the mesh size function.
%
  if ( false )

    np = size ( p, 1 );
    h = ones ( np, 1 );

  else

    hmax = 5;
    hmin = 1;
    dmax = max ( abs ( p17_fd ( p ) ) );
    dmin = min ( abs ( p17_fd ( p ) ) );

    h = ( ( dmax - abs ( p17_fd ( p ) )        ) * hmin   ...
        + (        abs ( p17_fd ( p ) ) - dmin ) * hmax ) ...
        / ( dmax                        - dmin );

  end

  return
end

