An algorithm for mesh rezoning with application to strain localization problems