Partly Smooth Models and Algorithms