The effect of non-gravitational gas heating in groups andclusters of galaxies