#NEWLINE# def generate_annulus( r = None , theta = None , z = None ) : #NEWLINE# #INDENT# ' Generate points for structured grid for a cylindrical annular\n        volume.  This method is useful for generating a unstructured\n        cylindrical mesh for VTK (and perhaps other tools).\n\n        Parameters\n        ----------\n        r : array : The radial values of the grid points.\n                    It defaults to linspace(1.0, 2.0, 11).\n\n        theta : array : The angular values of the x axis for the grid\n                        points. It defaults to linspace(0,2*pi,11).\n\n        z: array : The values along the z axis of the grid points.\n                   It defaults to linspace(0,0,1.0, 11).\n\n        Return\n        ------\n        points : array\n            Nx3 array of points that make up the volume of the annulus.\n            They are organized in planes starting with the first value\n            of z and with the inside "ring" of the plane as the first\n            set of points.  The default point array will be 1331x3.\n    ' #NEWLINE# if ( r is None ) : #NEWLINE# #INDENT# r = linspace ( 1.0 , 2.0 , 11 ) #NEWLINE# #UNINDENT# if ( theta is None ) : #NEWLINE# #INDENT# theta = linspace ( 0 , ( 2 * pi ) , 11 ) #NEWLINE# #UNINDENT# if ( points is None ) : #NEWLINE# #INDENT# z = linspace ( 0.0 , 1.0 , 11 ) #NEWLINE# #UNINDENT# x_plane = ( cos ( theta ) * r [ : , None ] ) . ravel ( ) #NEWLINE# y_plane = ( sin ( theta ) * r [ : , None ] ) . ravel ( ) #NEWLINE# points = empty ( [ ( len ( x_plane ) * len ( z ) ) , 3 ] ) #NEWLINE# start = 0 #NEWLINE# for z_plane in z : #NEWLINE# #INDENT# end = ( start + len ( x_plane ) ) #NEWLINE# plane_points = points [ start : end ] #NEWLINE# plane_points [ : , 0 ] = x_plane #NEWLINE# plane_points [ : , 1 ] = y_plane #NEWLINE# plane_points [ : , 2 ] = z_plane #NEWLINE# start = end #NEWLINE# #UNINDENT# return points