function psi = transport_sweep(phi, psi_left, psi_right, angles, source, ...
              sweep_data) 
% TRANSPORT_SWEEP
% One transport sweep.
%
c=sweep_data.c;
q=source;
dx=sweep_data.dx;
na2=length(angles);
na=na2/2;
nx=length(phi);
%
% Initialize the intensities.
%
psi=zeros(nx,na2);
psi(nx,1:na)=psi_right;
psi(1,na+1:na2)=psi_left;
%
%
%
source_total = .5*c.*phi + q;
source_average=(source_total(2:nx)+source_total(1:nx-1))*.5;
forward_angles=angles(na+1:na2);
backward_angles=angles(1:na);
%
vfl=(forward_angles/dx) + .5;
vfl=1./vfl;
vfr=(forward_angles/dx) - .5;
dfl=diag(vfl); dfr=diag(vfr);
%
% Forward sweep
%
ptmp=psi(1,na+1:na2);
for ix=2:nx
   psi(ix,na+1:na2)=(psi(ix-1,na+1:na2)*dfr + source_average(ix-1)).*vfl';
end
vfl=(-backward_angles/dx) + .5;
vfl=1./vfl;
vfr=(-backward_angles/dx) - .5;
dfl=diag(vfl); dfr=diag(vfr);
%
% Backward sweep
%
for ix=nx-1:-1:1
   psi(ix,1:na)=(psi(ix+1,1:na)*dfr + source_average(ix)).*vfl';
end
