Refactors neighbors and periodicNeighbors in DistributedGrid

neighbors and periodicNeighbors in DistributedGrid should be implemented using the StaticArray.