Principles of grid generation