1function u = get_uSol(x,t,snIdxNow,sn,an,interpNodesIdx_sol,interpAndGLWeights_sol,interpShift_sol,s,M,delta,tol)
2% GET_USOL gets the solution by forming local and history parts
3%
4% u = get_uSol(x,t,snIdxNow,sn,an,K,interpNodesIdx_sol,...
5% interpAndGLWeights_sol,interpShift_sol,s,M,delta)
6% returns the solution u by evaluating the local and the history parts.
7% The function requires the spatial grid 'x', the current time 't', the
8% unifrom time grid 'tn', the Fourier coefficients 'an', the frequency
9% grid 'K', 'delta' the width of the window function used in the
10% local/history split, the location of sources 's' s = [s(1),...,s(M)]
11% where 'M' is the number of sources, 'sn' is the computed density.
12%
13% Other input values:
14% snIdxNow: index of the density at the current time step.
15% interpNodesIdx_sol: interpolation nodes used to evaluate the density at
16% GL nodes
17% interpAndGLWeights_sol: interpolation/integration weights needed to
18% evaluate the local integral
19% interpShift_sol: initial shift of interpolation nodes (to undo the shift)
21% get the local part of the solution
22ul = get_uLocal(x,t,snIdxNow,sn,interpNodesIdx_sol,interpAndGLWeights_sol,interpShift_sol,s,M,delta);
24% get the history part of the solution
25uh = get_uHistory(an,x,tol);
27% compute the solution
28u = uh + ul;
30end