function u_g= Mergesolution_g(u_f,G_mn,y_s);
%MERGESOLUTION_G - plug spcs in the solution
%
%   Usage:
%      u_g= Mergesolution_g(u_f,G_mn,y_s)

global gridset


%	Merge f_set and s_set to n_set

u_n= sparse([],[],[],gridset.nsize,1);
u_n(gridset.pv_f,:)= u_f;

% Note: we assume u_f and y_s have the same no.of columns
if ~isempty(y_s)
	u_n(gridset.pv_s,:)= y_s;
end

%   Merge n_set and m_set to g_set
u_g = sparse([],[],[],gridset.gsize,1);
u_g(gridset.pv_n,:)= u_n;

if (gridset.msize>0)
	u_m = G_mn * u_n;
	u_g(gridset.pv_m,:)= u_m;
end
