A finite element method for the simulation of strong and weak discontinuities in solid mechanics