function faces_global=aste_tracer2global(aste,nfx,nfy);
%------------
%function faces_global=aste_tracer2global(aste,nfx,nfy);
% In:
% nfx: [270 0 270 180 450]
% nfy: [450 0 270 270 270]
% aste: aste domain size [nx*2 nfy(1)+nfy(3)+nfx(4)+nfx(5),nz]
%
% Out:
% faces_global: 5 faces, same as global faces obtained from patchface3D
% ATN 17-Oct-2012 ------------

nx=nfx(3);
[tempx tempy nz]=size(aste);
if((nfy(1)+nfy(3)+nfx(4))~=tempy);
  error('inconsistent nfx or nfy versus size aste');
  return
else;

%initialize:
  f{1}=nan(nx,3*nx,nz);f{2}=f{1};f{3}=nan(nx,nx,nz);f{4}=nan(3*nx,nx,nz);f{5}=f{4};

%filling
  f{1}(:,3*nx-nfy(1)+1:3*nx,:)=aste(nx+1:2*nx,1:nfy(1),:);
  for k=1:nz;
    f{3}(:,:,k)=sym_g_mod(aste(nx+1:2*nx , nfy(1)+1:nfy(1)+nx,k),7,0);
    f{4}(1:nfx(4),:,k)=sym_g_mod(aste(nx+1:2*nx , nfy(1)+nx+1:nfy(1)+nx+nfx(4),k),7,0);
    f{5}(1:nfx(5),:,k)=sym_g_mod(aste(1:nx      , 1:nfx(5),k),5,0);
  end;
end;
faces_global=f;

return

