Global formation of topological defects in the multiferroic hexagonal manganites