Adaptive mesh generation preserving the quality of the initial grid