Pack a four dimensional array into a one dimensional vec to avoid the speed penalty of following multiple pointers and increase memory locality for caching.