C++ iterator for 3D grids.