Best way to flatten the top and bottom of a torus geometry

Since it starts with a super-flat torus, and then just expands it according to your needs and the displacement map - this solution could likely be also used here.