title: How to fill an array without a for loop
body: <p>I have some code which generates the coordinates of a cylindrically-symmetric surface, with coordinates given as (r, theta, phi).  At the moment, I generate the coordinates of one phi slice, and store that in a 2xN array (for N bins), and then in a for loop I copy this array for each value of phi from 0 to 2pi:</p>
  
  <pre><code>import numpy as np
  
  # this is the number of bins that my surface is chopped into
  numbins = 50
  
  # these are the values for r
  r_vals = np.linspace(0.0001, 50, numbins, endpoint = True)
  
  # these are the values for theta
  theta_vals = np.linspace(0, np.pi / 2, numbins, endpoint = True)
  
  # I combine the r and theta values into a 2xnumbins array for one "slice" of phi
  phi_slice = np.vstack([r_vals,theta_vals]).T
  
  # this is the array which will store all of the coordinates of the surface
  surface = np.zeros((numbins**2,3))
  lower_bound = 0
  upper_bound = numbins
  
  # this is the size of the bin for phi
  dphi = (2 * np.pi) / numbins
  
  # this is the for loop I'd like to eliminate.
  # For every value of phi, it puts a copy of the phi_slice array into
  # the surface array, so that the surface is cylindrical about phi.
  for phi in np.linspace(0, (2 * np.pi) - dphi, numbins):
      surface[lower_bound:upper_bound, :2] = phi_slice
      surface[lower_bound:upper_bound,2] = phi
      lower_bound += numbins
      upper_bound += numbins
  </code></pre>
  
  <p>I'm calling this routine in a numerical integration of 1e6 or 1e7 steps, and while numbins is 50 in the example above, in practice it'll be in the thousands.  This for loop is a choking point, and I'd really like to eliminate it to speed things up.  Is there a good NumPythonic way to do the same thing as this for loop?</p>