function [no2xy, el2no, noExt] = ReadGrid(filename)
  
% Function:
%   [no2xy, el2no, noExt] = ReadGrid(filename)
% Arguments:
%   filename = the name of the file containing the grid
% Returns:
%   no2xy = the coordinates of the nodes
%   el2no = the nodes of the triangles
%   noExt = the nodes on the outer boundary
% Comments:
%   Reads the grid.

  % -------------------------------------------------------------
  % | ADD YOUR READING OF THE MESH-FILES HERE.                  |
  % ----------------------------------------------------------  |
  %                                                          |  |
  %                                                         \    /
  %                                                          \  /
  %                                                           \/
    
  fid = fopen(filename, 'r');

  fgetl(fid) % skip line
  no_of_nodes = textscan(fid, "%f");
  no_of_nodes = no_of_nodes{1}; % extract from cell array
  fgetl(fid) % skip line

  no2xy = textscan(fid, "%f %f");
  no2xy = cell2mat(no2xy)';
  
  assert(no_of_nodes == length(no2xy))

  fgetl(fid) % skip line

  no_of_elements = textscan(fid, "%f");
  no_of_elements = no_of_elements{1};

  fgetl(fid)
  el2no = textscan(fid, "%f %f %f");
  el2no = cell2mat(el2no)';

  assert(no_of_elements == length(el2no))

  fgetl(fid) % skip line
  no_nodes_on_boundary = textscan(fid, "%f");
  no_nodes_on_boundary = no_nodes_on_boundary{1};
  fgetl(fid) % skip line
  noExt = textscan(fid, "%f");
  noExt = cell2mat(noExt)';

  assert(no_nodes_on_boundary == length(noExt))

  fclose(fid);

  %                                                           /\
  %                                                          /  \
  %                                                         /    \
  %                                                          |  |
  % ----------------------------------------------------------  |
  % | END OF CODE                                               |
  % -------------------------------------------------------------
