function solu = interpolation(mesh,Base,FUN)

%  Lagrange Interpolation the exact function with the Base and the mesh 
%  
%  INPUT: Base, the base function in the finite element method
%         mesh: the corresponding mesh
%         FUN: the function handle for the exact function
%  OUTPUT: v, the interpolation value at the corresponding interpolation
%  points. 

%----------compute the freedom degree vector-------------------------------


%--------compute the base value at the integral points---------------------
Nr_elem = size(mesh.elem,1);
%----------compute the freedom degree vector-------------------------------
[Free_deg3,Dim] = DOF_Mangement(mesh,Base.DOF_3);

%-----------------------compute the interpolation--------------------------
solu=sparse(Dim,1);

if Nr_elem > 0
    
    m=size(Base.nodal_3,1);
    % the relation of the nodal coordinates and nodal number 
    Index = [2 3 1]; 
    
    for i=1:m        
                                   
        solu(Free_deg3(:,i),1) = FUN(Base.nodal_3(i,1)*mesh.node(mesh.elem(:,2),1:2)+...
                                        Base.nodal_3(i,2)*mesh.node(mesh.elem(:,3),1:2)+...
                                        (1-Base.nodal_3(i,1)-Base.nodal_3(i,2))*mesh.node(mesh.elem(:,1),1:2));
    end
end
showFeFunction(mesh,solu)
