Mechanical theory of heat