Convergence and synchronization in heterogeneous networks of smooth and piecewise smooth systems