An efficient method is described to handle mesh indexes in multidimensional problems like numerical integration of partial differential equations, lattice model simulations, and determination of atomic neighbor lists. By creating an extended mesh, beyond the periodic unit cell, the stride in memory between equivalent pairs of mesh points is independent of their position within the cell. This allows to contract the mesh indexes of all dimensions into a single index, avoiding modulo and other implicit index operations.