function laplace_periodic_test ( )

%*****************************************************************************80
%
%% laplace_periodic_test plots data computed by FreeFem++.
%
%  Licensing:
%
%    Copyright (C) 2018 Chloros2 <chloros2@gmx.de>
%
%    This program is free software: you can redistribute it and/or modify it
%    under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful, but
%    WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program.  If not, see
%    <https://www.gnu.org/licenses/>.
%
%  Modified:
%
%    2018-05-13
%
%  Author:
%
%    Chloros2 <chloros2@gmx.de>
%    Modifications by John Burkardt.
%
  addpath ( '../ffmatlib' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'laplace_periodic_test:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Make plots of data from the solution of the Laplace\n' );
  fprintf ( 1, '  equation on a periodic domain,\n' );
  fprintf ( 1, '  as computed by FreeFem++, using the ffmatlib() interface.\n' );

  clear ( 'all' );
%
%  Read the FreeFem++ data.
%
  [ p, b, t, nv, nbe, nt, labels ] = ffreadmesh ( 'laplace_periodic.msh' );
  [ vh ] = ffreaddata ( 'laplace_periodic_vh.txt' );
  [ u ] = ffreaddata ( 'laplace_periodic_data.txt' );
%
%  Mesh Plot
%
  figure ( );

  ffpdeplot ( p, b, t, ...
    'Mesh','on', ...
    'Boundary','on', ...
    'Title','Mesh');

  ylabel ( 'y' );
  xlabel ( 'x' );

  filename = 'laplace_periodic_mesh.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Show Labels
%
  figure ( );

  ffpdeplot ( p, b, t, ...
    'Mesh','off', ...
    'Boundary','on', ...
    'BDLabels',labels, ...
    'BDShowText','on', ...
    'Title','Boundary Labels');

  filename = 'laplace_periodic_labels.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  2D Patch (density map) Plot + Contour
%
  figure ( );

  ffpdeplot ( p, b, t, ...
    'XYData',u, ...
    'VhSeq',vh, ...
    'Mesh','off', ...
    'Boundary','on', ...
    'CBTitle','u', ...
    'Contour','on', ...
    'Title','Patch Plot + Contour');

  ylabel ( 'y' );
  xlabel ( 'x' );

  filename = 'laplace_periodic_density.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'laplace_periodic_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../ffmatlib' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

