function plot_gmsh(gmsh_struct,label,box_flag, color_flag, type_flag, ...
                   plot_points, index_points, color_points, ...
                   plot_lines, index_lines, color_lines, ...
                   plot_triangles, index_triangles, color_triangles, ... 
                   plot_quads, index_quads, color_quads, ...
                   plot_tets, index_tets, color_tets, ...
                   plot_hexas, index_hexas, color_hexas, ... 
                   plot_prisms, index_prisms, color_prisms, ...
                   plot_pyramids, index_pyramids, color_pyramids)

// Global parameters
if (~isdef('label','local'))           then label           = %F; end
if (~isdef('box_flag','local'))        then box_flag        = 4;  end
if (~isdef('color_flag','local'))      then color_flag      = 9;  end
if (~isdef('type_flag','local'))       then type_flag       = 3;  end
// Parameter for each kind of plot
if (~isdef('plot_points','local'))     then plot_points     = %T; end
if (~isdef('plot_lines','local'))      then plot_lines      = %T; end
if (~isdef('plot_triangles','local'))  then plot_triangles  = %T; end
if (~isdef('plot_quads','local'))      then plot_quads      = %T; end
if (~isdef('plot_tets','local'))       then plot_tets       = %T; end
if (~isdef('plot_hexas','local'))      then plot_hexas      = %T; end
if (~isdef('plot_prisms','local'))     then plot_prisms     = %T; end
if (~isdef('plot_pyramids','local'))   then plot_pyramids   = %T; end
if (~isdef('index_points','local'))    then index_points    = []; end
if (~isdef('index_lines','local'))     then index_lines     = []; end
if (~isdef('index_triangles','local')) then index_triangles = []; end
if (~isdef('index_quads','local'))     then index_quads     = []; end
if (~isdef('index_tets','local'))      then index_tets      = []; end
if (~isdef('index_hexas','local'))     then index_hexas     = []; end
if (~isdef('index_prisms','local'))    then index_prisms    = []; end
if (~isdef('index_pyramids','local'))  then index_pyramids  = []; end
if (~isdef('color_points','local'))    then color_points    = color_flag; end
if (~isdef('color_lines','local'))     then color_lines     = color_flag; end
if (~isdef('color_triangles','local')) then color_triangles = color_flag; end
if (~isdef('color_quads','local'))     then color_quads     = color_flag; end
if (~isdef('color_tets','local'))      then color_tets      = color_flag; end
if (~isdef('color_hexas','local'))     then color_hexas     = color_flag; end
if (~isdef('color_prisms','local'))    then color_prisms    = color_flag; end
if (~isdef('color_pyramids','local'))  then color_pyramids  = color_flag; end

[nargout, nargin] = argn();

drawlater;

EBox = [gmsh_struct.MIN(1), gmsh_struct.MAX(1), gmsh_struct.MIN(2), gmsh_struct.MAX(2), gmsh_struct.MIN(3), gmsh_struct.MAX(3)];

////////////////////
// Display points //
////////////////////

if (gmsh_struct.nbPoints~=0) & plot_points then
  if (isempty(index_points)) then index_points = 1:gmsh_struct.nbPoints; end
  X = gmsh_struct.POS(gmsh_struct.POINTS(index_points,1),1);
  Y = gmsh_struct.POS(gmsh_struct.POINTS(index_points,1),2);
  Z = gmsh_struct.POS(gmsh_struct.POINTS(index_points,1),3);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,1)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_points)
      xstring(0,0, string(gmsh_struct.POINTS(index_points(i),$))) ;
      text = gce() ; // get the text handle
      text.data  = [X(index_points(i)),Y(index_points(i)),Z(index_points(i))] ; // change the three coordinates of the text position
    end
  end
  
  clear index_points;
end

///////////////////
// Display lines //
///////////////////

if (gmsh_struct.nbLines~=0) & plot_lines then
  if (isempty(index_lines)) then index_lines = 1:gmsh_struct.nbLines; end
  X = matrix(gmsh_struct.POS(gmsh_struct.LINES(index_lines,1:$-1),1), length(index_lines), 2);
  Y = matrix(gmsh_struct.POS(gmsh_struct.LINES(index_lines,1:$-1),2), length(index_lines), 2);
  Z = matrix(gmsh_struct.POS(gmsh_struct.LINES(index_lines,1:$-1),3), length(index_lines), 2);
  for i=1:size(X,1)
    param3d1(X(i,:), Y(i,:), list(Z(i,:), color_flag*ones(1,2)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_lines)
      xstring(0,0, string(gmsh_struct.LINES(i,$))) ;
      text = gce() ; // get the text handle
      text.data = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))]; // change the three coordinates of the text position
    end
  end
  
  clear index_lines;
end

///////////////////////
// Display triangles //
///////////////////////

if (gmsh_struct.nbTriangles~=0) & plot_triangles then
  if (isempty(index_triangles)) then index_triangles = 1:gmsh_struct.nbTriangles; end
  X = matrix(gmsh_struct.POS(gmsh_struct.TRIANGLES(index_triangles,1:$-1),1), length(index_triangles), 3);
  Y = matrix(gmsh_struct.POS(gmsh_struct.TRIANGLES(index_triangles,1:$-1),2), length(index_triangles), 3);
  Z = matrix(gmsh_struct.POS(gmsh_struct.TRIANGLES(index_triangles,1:$-1),3), length(index_triangles), 3);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,4)), flag=[type_flag box_flag], ebox = EBox);
  end
  
  // If required, we can show the labels
  disp(index_triangles)
  if (label) then
    for i=1:length(index_triangles)
      xstring(0,0, string(gmsh_struct.TRIANGLES(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end
  
  clear index_triangles;
end

///////////////////
// Display quads //
///////////////////

if (gmsh_struct.nbQuads~=0) & plot_quads then
  if (isempty(index_quads)) then index_quads = 1:gmsh_struct.nbQuads; end
  X = matrix(gmsh_struct.POS(gmsh_struct.QUADS(index_quads,1:$-1),1), length(index_quads), 4);
  Y = matrix(gmsh_struct.POS(gmsh_struct.QUADS(index_quads,1:$-1),2), length(index_quads), 4);
  Z = matrix(gmsh_struct.POS(gmsh_struct.QUADS(index_quads,1:$-1),3), length(index_quads), 4);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,5)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_quads)
      xstring(0,0, string(gmsh_struct.QUADS(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end

  clear index_quads;
end

//////////////////
// Display tets //
//////////////////

if (gmsh_struct.nbTets~=0) & plot_tets then
  if (isempty(index_tets)) then index_tets = 1:gmsh_struct.nbTets; end
  X = matrix(gmsh_struct.POS(gmsh_struct.TETS(index_tets,1:$-1),1), length(index_tets), 5);
  Y = matrix(gmsh_struct.POS(gmsh_struct.TETS(index_tets,1:$-1),2), length(index_tets), 5);
  Z = matrix(gmsh_struct.POS(gmsh_struct.TETS(index_tets,1:$-1),3), length(index_tets), 5);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,6)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_tets)
      xstring(0,0, string(gmsh_struct.TETS(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end

  clear index_tets;
end

///////////////////
// Display hexas //
///////////////////

if (gmsh_struct.nbHexas~=0) & plot_hexas then
  if (isempty(index_hexas)) then index_hexas = 1:gmsh_struct.nbHexas; end
  X = matrix(gmsh_struct.POS(gmsh_struct.HEXAS(index_hexas,1:$-1),1), length(index_hexas), 6);
  Y = matrix(gmsh_struct.POS(gmsh_struct.HEXAS(index_hexas,1:$-1),2), length(index_hexas), 6);
  Z = matrix(gmsh_struct.POS(gmsh_struct.HEXAS(index_hexas,1:$-1),3), length(index_hexas), 6);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,7)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_hexas)
      xstring(0,0, string(gmsh_struct.HEXAS(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end

  clear index_hexas;
end

////////////////////
// Display prisms //
////////////////////

if (gmsh_struct.nbPrisms~=0) & plot_prisms then
  if (isempty(index_prisms)) then index_prisms = 1:gmsh_struct.nbPrisms; end
  X = matrix(gmsh_struct.POS(gmsh_struct.PRISMS(index_prisms,1:$-1),1), length(index_prisms), 7);
  Y = matrix(gmsh_struct.POS(gmsh_struct.PRISMS(index_prisms,1:$-1),2), length(index_prisms), 7);
  Z = matrix(gmsh_struct.POS(gmsh_struct.PRISMS(index_prisms,1:$-1),3), length(index_prisms), 7);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,8)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_prisms)
      xstring(0,0, string(gmsh_struct.PRISMS(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end

  clear index_prisms;
end

//////////////////////
// Display pyramids //
//////////////////////

if (gmsh_struct.nbPyramids~=0) & plot_pyramids then
  if (isempty(index_pyramids)) then index_pyramids = 1:gmsh_struct.nbPyramids; end
  X = matrix(gmsh_struct.POS(gmsh_struct.PYRAMIDS(index_pyramids,1:$-1),1), length(index_pyramids), 8);
  Y = matrix(gmsh_struct.POS(gmsh_struct.PYRAMIDS(index_pyramids,1:$-1),2), length(index_pyramids), 8);
  Z = matrix(gmsh_struct.POS(gmsh_struct.PYRAMIDS(index_pyramids,1:$-1),3), length(index_pyramids), 8);
  for i=1:size(X,1)
    param3d1([X(i,:) X(i,1)], [Y(i,:) Y(i,1)],list([Z(i,:) Z(i,1)],color_flag*ones(1,9)), flag=[type_flag box_flag], ebox = EBox);
  end

  // If required, we can show the labels
  if (label) then
    for i=1:length(index_pyramids)
      xstring(0,0, string(gmsh_struct.PYRAMIDS(i,$))) ;
      text = gce() ; // get the text handle
      text.data  = [mean(X(i,:)),mean(Y(i,:)),mean(Z(i,:))] ; // change the three coordinates of the text position
    end
  end

  clear index_pyramids;
end
drawnow;
endfunction

