function Rtransient = reconstructSolution(self,u,tlist)
%reconstructSolution - Reconstruct the full-model transient solution
% R = reconstructSolution(rom,u,tlist) expands the transient solution
% obtained using the reduced-order model, rom, to the full solution and
% returns a pde.TransientThermalResults object. The inputs arguments u
% is the temperature in modal coordinates. The argument tlist is a vector of
% the time-steps that you used to solve the reduced model. The number of
% rows in the input matrix u must match the number of modes. The number of
% columns in the input matrice u must match the number of elements in tlist.
%
%    See also pde.ThermalModel, pde.ThermalModel/reduce

% Copyright 2021-2023 The MathWorks, Inc.

arguments
    self pde.ReducedThermalModel
    u  {mustBeA(u,"double"),mustBeNonsparse,mustBeNonNan,mustBeFinite,mustBeNonempty}
    tlist (1,:) {mustBeA(tlist,"double"),mustBeVector,mustBeNonsparse,mustBeNonNan,mustBeFinite,mustBeNonempty} 
end

pde.EquationModel.checkTlist(tlist);

numROMDoF = size(self.K,1);
numtimesteps = numel(tlist);
validateattributes(u,{'double'},{'2d','size',[numROMDoF,numtimesteps]},2);
    
W = self.TransformationMatrix;
uFull = W*u;

Rtransient = pde.TransientThermalResults(self.ModelForReconstruction,uFull,tlist,self.Coefficients);
end
