Means for shaping the magnetic field