Moved pos2Idx from PeriodicGrid to Grid