function baffle_test ( )

%*****************************************************************************80
%
%% baffle_test() demonstrates MESH2D on the 12x8 channel with 13 circular baffles.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 December 2012
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'baffle_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Demonstrate mesh2d() on a channel with circular baffles.\n' );

  clf ( );

  warning off
%
%  Display the nodes.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Channel, max element size is 0.50, baffles inserted.\n' );

  v = [ 0.0,  1.0; 12.0, 1.0; 12.0, 7.0; 0.0, 7.0; ...
        1.8, 1.68;  1.6, 2.0;  1.8, 2.32;  2.2, 2.32;  2.4, 2.0;  2.2, 1.68; ...
        5.8, 1.68;  5.6, 2.0;  5.8, 2.32;  6.2, 2.32;  6.4, 2.0;  6.2, 1.68; ...
        9.8, 1.68;  9.6, 2.0;  9.8, 2.32; 10.2, 2.32; 10.4, 2.0; 10.2, 1.68; ...
        1.8, 3.68;  1.6, 4.0;  1.8, 4.32;  2.2, 4.32;  2.4, 4.0;  2.2, 3.68; ...
        5.8, 3.68;  5.6, 4.0;  5.8, 4.32;  6.2, 4.32;  6.4, 4.0;  6.2, 3.68; ...
        9.8, 3.68;  9.6, 4.0;  9.8, 4.32; 10.2, 4.32; 10.4, 4.0; 10.2, 3.68; ...
        1.8, 5.68;  1.6, 6.0;  1.8, 6.32;  2.2, 6.32;  2.4, 6.0;  2.2, 5.68; ...
        5.8, 5.68;  5.6, 6.0;  5.8, 6.32;  6.2, 6.32;  6.4, 6.0;  6.2, 5.68; ...
        9.8, 5.68;  9.6, 6.0;  9.8, 6.32; 10.2, 6.32; 10.4, 6.0; 10.2, 5.68; ...
        3.8, 2.68;  3.6, 3.0;  3.8, 3.32;  4.2, 3.32;  4.4, 3.0;  4.2, 2.68; ...
        7.8, 2.68;  7.6, 3.0;  7.8, 3.32;  8.2, 3.32;  8.4, 3.0;  8.2, 2.68; ...
        3.8, 4.68;  3.6, 5.0;  3.8, 5.32;  4.2, 5.32;  4.4, 5.0;  4.2, 4.68; ...
        7.8, 4.68;  7.6, 5.0;  7.8, 5.32;  8.2, 5.32;  8.4, 5.0;  8.2, 4.68  ...
      ];

  e = [ 1,  2;  2,  3;  3,  4;  4,  1; ...
        5,  6;  6,  7;  7,  8;  8,  9;  9, 10; 10,  5; ...
       11, 12; 12, 13; 13, 14; 14, 15; 15, 16; 16, 11; ...
       17, 18; 18, 19; 19, 20; 20, 21; 21, 22; 22, 17; ...
       23, 24; 24, 25; 25, 26; 26, 27; 27, 28; 28, 23; ...
       29, 30; 30, 31; 31, 32; 32, 33; 33, 34; 34, 29; ...
       35, 36; 36, 37; 37, 38; 38, 39; 39, 40; 40, 35; ...
       41, 42; 42, 43; 43, 44; 44, 45; 45, 46; 46, 41; ...
       47, 48; 48, 49; 49, 50; 50, 51; 51, 52; 52, 47; ...
       53, 54; 54, 55; 55, 56; 56, 57; 57, 58; 58, 53; ...
       59, 60; 60, 61; 61, 62; 62, 63; 63, 64; 64, 59; ...
       65, 66; 66, 67; 67, 68; 68, 69; 69, 70; 70, 65; ...
       71, 72; 72, 73; 73, 74; 74, 75; 75, 76; 76, 71; ...
       77, 78; 78, 79; 79, 80; 80, 81; 81, 82; 82, 77  ...
      ];

  hdata = [];
  hdata.hmax = 0.50;

  [ p, t ] = mesh2d ( v, e, hdata );

  [ nv, ~ ] = size ( v );
  [ np, ~ ] = size ( p );
  [ nt, ~ ] = size ( t );

  fprintf ( 1, ...
    '  %d boundary vertices input, %d nodes and %d triangles created\n', ...
    nv, np, nt );

  pause ( 5 );
%
%  Close the figure.
%
  close ( gcf )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'baffle_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
