DensityInCellInterface is a pure interface. It is implemented by spatial grids that offer a fast way to obtain the density of a grid cell, given the cell index m, for each medium component h. If the MediumSystem class detects a spatial grid that implements this interface, it will call the numberDensity() function in this interface rather than sampling the density distribution in a number of random points. In some special cases, for example when the grid is lined up with some cell structure in the medium geometry, this can dramatically enhance performance.