function xv = Get_Solution_Multilevel(Base1,mesh1,xv1,Base2,mesh2,xv2,xv)

%% Get the solution on the multilevel meshes
% mesh2 is a refinement of mesh1
% Base1 on the mesh1 and Base2 on the mesh2
% xv1 is the solutions on the mesh1 with Base1, xv1\in R^{N1*Num_Eig}
% xv2 is the solutions on the mesh2 with Base2, xv2\in R^{Num_Eig*Num_Eig}
%
% 
%
% OUTPUT: the solution on the mesh2 with Base2
%% HEHU XIE 2012-03-13


%----------compute the freedom degree vector-------------------------------
[Free_deg31,Dim1]=DOF_Mangement(mesh1,Base1.DOF_3);
[Free_deg32,Dim2]=DOF_Mangement(mesh2,Base2.DOF_3);

coord3 = Base2.nodal_3;
Nr_int3 = size(coord3,1);
Nr_elem3 = size(mesh2.elem,1);

Num_Eig = size(xv,2);
xv = xv*xv2;  %the base vector

for ind =1: Num_Eig
    xv_tmp = xv(:,ind);
    xv1_tmp = xv1(:,ind);
    xv_element = xv_tmp(Free_deg32);     %save the solution in elementwise pattern
    
    %-------------Get the solution --------------------------------------
    if Nr_elem3 > 0
        %m = size(Base1.b_3([0,0]),2);
        
        for kk=1:Nr_int3
            
            %---------------Compute the mesh2 points on mesh1------------------    
            Node1 = mesh2.elemlocalnode(:,2)*[1 0] + mesh2.elemlocalnode(:,3)*[0 1];
            Node2 = mesh2.elemlocalnode(:,5)*[1 0] + mesh2.elemlocalnode(:,6)*[0 1];
            Node3 = mesh2.elemlocalnode(:,8)*[1 0] + mesh2.elemlocalnode(:,9)*[0 1];
            
            B_1 = Base1.b_3(Node1*(1-coord3(kk,1)-coord3(kk,2))+Node2*coord3(kk,1)+Node3*coord3(kk,2));
            xv_element(:,kk) = xv_element(:,kk) + sum(xv1_tmp(Free_deg31(mesh2.owner,:)).*B_1,2);                   
        end
    end     

    xv_tmp(Free_deg32) = xv_element;
    xv(:,ind) = xv_tmp;
end