1 function X_coarse=coarsening_X(hzc,icl3,X,params)
2 % [P,X_coarse]=coarsening_2_linear_decide(X,params)
4 % hzc coarsening factors in horizontal directions 1 and 2
5 % icl3 coarse indices in direction 3
9 % X_coarse coarse grid coordinates
13 [icl1,icl2]=hzc2icl(hzc,n);
14 nc = [length(icl1),length(icl2),length(icl3)];
17 X_coarse{l}=zeros(nc); % preallocate coarse points coordinates
19 for ic3=1:nc(3) % loop over coarse layers
20 if3=icl3(ic3); % the fine number of the coarse layer
21 for ic1=1:nc(1) % horizontal loops over coarse points
22 if1=icl1(ic1); % fine grid index of the coarse point
24 if2=icl2(ic2); % fine grid index of the coarse point
25 for l=1:3 % copy coordinates
26 X_coarse{l}(ic1,ic2,ic3)=X{l}(if1,if2,if3);