A method for adaptive mesh generation with a given number of cells based on the approximate solution of a boundary value problem is considered. The method is particularly attractive in engineering applications. An analysis of the method is presented, and computational experiments are described.