Move grid generation for GrafIC into Cython. Add unit test.