added copyBoundaries for rectangular shaped grid