Discontinuities in materials and structures: A unifying computational approach