Fix calculation of mean values for macroscopic quantities
The calculation of mean values for the macroscopic values causes a segmentation fault.
vx_SP_Med_Out and vx_SP_Med both need to be allocated to avoid the segmentation fault. It seems that vx_SP_Med_Out is on the host only and values from vx_SP_Med are copied to it. Why do we need this? We need to document this part of the code.
Also rename median to mean. Optional: add means to regression tests.