Add const in a couple of places.
Make MPI code more efficient by using continuous arrays.