2d.hh: use a single contiguous vector instead of vector of vectors