function [ v_num, e_num, t_num ] = freefem_msh_io_2d_size_read ( ffmsh_filename )

%*****************************************************************************80
%
%% freefem_msh_io_2d_size_read() reads sizes from a FFMSH file.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 December 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string FFMSH_FILENAME, the FFMSH filename.
%
%  Output:
%
%    integer V_NUM, the number of vertices.
%
%    integer E_NUM, the number of boundary edges.
%
%    integer T_NUM, the number of triangles.
%
  ffmsh_unit = fopen ( ffmsh_filename, 'rt' );

  if ( ffmsh_unit < 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'FREEFEM_MSH_IO_SIZE_READ - Error!\n' );
    fprintf ( 1, '  Could not open the input file "%s".\n', ffmsh_filename );
    error ( 'FREEFEM_MSH_IO_SIZE_READ - Error!' );
  end

  [ values, count ] = fscanf ( ffmsh_unit, '%d%d%d' );

  if ( count < 3 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'FREEFEM_MSH_IO_SIZE_READ - Error!\n' );
    fprintf ( 1, '  Could not read 3 values from line 1 of "%s".\n', ffmsh_filename );
    error ( 'FREEFEM_MSH_IO_SIZE_READ - Error!' );
  end

  v_num = values(1);
  t_num = values(2);
  e_num = values(3);

  fclose ( ffmsh_unit );

  return
end
