A variational discrete element method for quasistatic and dynamic elastoplasticity. (22nd July 2020)