When reachint T max, do not return but exit the while() loop, cause at the end one might need to do further stuff before exiting the program; ex dumping data.
This code is used to save the two output distributions (plastic, and metal) as NxM matrices, into two separate files.
They are saved at the end of the simulation, when the simulator reaches T = Tmax (or when exiting prematurely).
Note that if the resolution of the rectangular sampling gate is set to Nx1, the output is just a column vector.
Note that the distribution is NOT normalized to have unit volume or area, as it happens instead with the Irrlicht dynamic view.