Gas cooling in semi-analytic models and smoothed particle hydrodynamics simulations: are results consistent?: Gas cooling in SAMs and SPH simulations