Multicasting algorithms for mesh and torus networks