An Introduction to Piecewise Smooth Dynamics (Advanced Courses in Mathematics - CRM Barcelona)