//  trace la fonction U
function [u,x,y]=trace_vecteur(U,COOR,NUMER,no,Nx,Ny)
//
//  calcule le maillage initial
//
   [Npt_u bid] = size(COOR);
   x0 = min(COOR(:,1)); x1 = max(COOR(:,1));
   y0 = min(COOR(:,2)); y1 = max(COOR(:,2));
   
   Dx = (x1-x0)/(Nx-1); Dy = (y1-y0)/(Ny-1);
   x = x0 + (0:Nx-1)*Dx; 
   y = y0 + (0:Ny-1)*Dy;

//  on evalue la fonction au points du maillage
//
   u = zeros(Nx,Ny);
   for i = 1:Nx
      xi = x(i);
      for j = 1:Ny
        yj = y(j)
// verifie si (xi, yj) n'est pas un noeud
        indice = find(and([COOR(:,1) == xi, COOR(:,2) == yj],2)); 
        if indice == [] 
           indice = cal_indice(COOR,[xi yj])
           Uno = U(NUMER(indice));
           Vno = U(NUMER(Npt_u+indice));

           Point = [xi yj]; Triangle = COOR(indice,:);
           FP = interpol(Point,Triangle);
           u(i,j) = Uno'*FP; 
           v(i,j) = Vno'*FP;
        else
           u(i,j) = U(NUMER(indice)); 
           v(i,j) = U(NUMER(Npt_u+indice));      
        end; 
      end;
   end;
  
    
    xbasc(no);
    xset("window",no);
    rect = [x0,y0,x1,y1]; 

    champ(x,y,u,v,1,rect,"011")

    xtitle('solution calculee');
endfunction
         
      
