function f_out=aste_compact2globalcompact(f_in,nfx,nfy);

%%%
%function f_out=aste_compact2globalcompact(f_in,nfx,nfy);
% f_in: aste compact
% f_out: global compact

nx=nfx(3);
sz=size(f_in);if(length(sz)==2);sz=[sz 1];end;
nz=sz(3);

%aste faces
fa{1}=        f_in(1:nx,                     1:nfy(1)                     ,:);
fa{3}=        f_in(1:nx,nfy(1)              +1:nfy(1)+nfy(3)              ,:);
fa{4}=reshape(f_in(1:nx,nfy(1)+nfy(3)       +1:nfy(1)+nfy(3)+nfx(4)       ,:),nfx(4),nfy(4),nz);
fa{5}=reshape(f_in(1:nx,nfy(1)+nfy(3)+nfx(4)+1:nfy(1)+nfy(3)+nfx(4)+nfx(5),:),nfx(5),nfy(5),nz);

%global faces
fg{1}=zeros(nx,3*nx,nz);fg{1}(1:nx,3*nx-nfy(1)+1:3*nx,:)=fa{1};
fg{2}=zeros(nx,3*nx,nz);
fg{3}=fa{3};
fg{4}=zeros(3*nx,nx,nz);fg{4}(1:nfx(4),1:nx,:)=fa{4};
fg{5}=zeros(3*nx,nx,nz);fg{5}(1:nfx(5),1:nx,:)=fa{5};

%now put back to compact
f_out=cat(2,fg{1},fg{2},fg{3},reshape(fg{4},nx,3*nx),reshape(fg{5},nx,3*nx));

return
