Geometry of Mechanics and Thermodynamics