Transient gratings by 4f → 5d excitation of rare earth impurities in solids