1 function x=smoothing(K,F,X,x,params)
3 % one smoothing iteration
5 it_type=sprintf('level %g smoothing',params.levels);
6 switch params.smoothing
7 case {'horizontal planes'}
8 % disp('red-black vertical, planes horizontal')
11 [planex,planey]=ndgrid(1:n(1),1:n(2));
12 planez = i3*ones(n(1),n(2));
13 % solving horizontal layer
14 ix = sub2ind(n,planex,planey,planez);
15 x(ix) = x(ix) - K(ix,ix)\(K(:,ix)'*x - F(ix));
18 case {'vertical lines'}
19 % disp('red-black relaxation horizontal, lines vertical')
24 % solving horizontal location i1 i2 and vertical line
25 ix = sub2ind(n,i1*onez,i2*onez,colz);
26 x(ix) = x(ix) - K(ix,ix)\(K(:,ix)'*x - F(ix));
31 case {'vertical sweeps'}
32 % disp('red-black relaxation horizontal, down to up sweep vertical')
33 x = vertical_sweeps(K,F,X,x);
41 ix = sub2ind(n,i1,i2,i3);
42 x(ix) = x(ix) - K(ix,ix)\(K(:,ix)'*x - F(ix));
50 error(['smoothing ',params.smoothing,' unknown'])