StructuredGridFactory: index[j] is only defined for j < dim

(cherry picked from commit d96f2a7a4fea35932b198f152d2a935c4f189151)
Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>