Numerical simulation of finite dimensional multibody nonsmooth mechanical systems