Treatment of water, waste water, or sewage by heating by distillation or evaporation by direct contact with a particulate solid or with a fluid, as a heat transfer medium