Discontinuous dynamical systems: Theory and numerical methods