implement topology preserving level set