def disk_grid_regular_test(): #*****************************************************************************80 # #% DISK_GRID_REGULAR_TEST tests DISK_GRID_REGULAR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 07 April 2015 # # Author: # # John Burkardt # import numpy as np from disk_grid_regular_count import disk_grid_regular_count from disk_grid_display import disk_grid_display # # Plot the grid, and save the plot in a file. # n = 50 # Do 50 subdivisions r = 1300. # Our radius c = np.array([0.0, 0.0]) ng = disk_grid_regular_count( n, r, c) # Figures out the total number of points given the subdivisions (n) cg = disk_grid_regular( n, r, c, ng) # returns the points for the given number of subdivisions (n) print cg.shape[1] filename = 'disk_grid_regular.png' disk_grid_display(n, r, c, ng, cg, filename) return
def disk_grid_fibonacci_test ( ): #*****************************************************************************80 # #% DISK_GRID_FIBONACCI_TEST tests DISK_GRID_FIBONACCI. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 07 April 2015 # # Author: # # John Burkardt # import numpy as np from disk_grid_regular_count import disk_grid_regular_count from disk_grid_display import disk_grid_display from r82vec_print_part import r82vec_print_part from r8mat_transpose_write import r8mat_transpose_write print '' print 'DISK_GRID_FIBONACCI_TEST:' print ' DISK_GRID_FIBONACCI can define a grid of N points' print '' n = 1000 r = 2.0 c = np.array ( [ 1.0, 5.0 ] ) print '' print ' We use N = %d' % ( n ) print ' Radius R = %g' % ( r ) print ' Center C = (%g,%g)' % ( c[0], c[1] ) ng = n cg = disk_grid_fibonacci ( n, r, c ); r82vec_print_part ( n, cg, 20, ' Part of the grid point array:' ); # # Write grid points to a file. # filename = 'disk_grid_fibonacci.xy' r8mat_transpose_write ( filename, 2, ng, cg ) print '' print ' Data written to the file "%s".' % ( filename ) # # Plot the grid, and save the plot in a file. # filename = 'disk_grid_fibonacci.png' disk_grid_display ( n, r, c, ng, cg, filename ) # # Terminate. # print '' print 'DISK_GRID_FIBONACCI_TEST:' print ' Normal end of execution.' return
def disk_grid_regular_test(): #*****************************************************************************80 # #% DISK_GRID_REGULAR_TEST tests DISK_GRID_REGULAR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 07 April 2015 # # Author: # # John Burkardt # import numpy as np from disk_grid_regular_count import disk_grid_regular_count from disk_grid_display import disk_grid_display from r82vec_print_part import r82vec_print_part from r8mat_transpose_write import r8mat_transpose_write print '' print 'DISK_GRID_REGULAR_TEST:' print ' DISK_GRID_REGULAR can define a grid of points' print ' with N+1 points on a horizontal or vertical radius,' print ' based on any disk.' n = 20 r = 2.0 c = np.array([1.0, 5.0]) print '' print ' We use N = %d' % (n) print ' Radius R = %g' % (r) print ' Center C = (%g,%g)' % (c[0], c[1]) ng = disk_grid_regular_count(n, r, c) print '' print ' Number of grid points will be %d' % (ng) cg = disk_grid_regular(n, r, c, ng) r82vec_print_part(ng, cg, 20, ' Part of the grid point array:') # # Write grid points to a file. # filename = 'disk_grid_regular.xy' r8mat_transpose_write(filename, 2, ng, cg) print '' print ' Data written to the file "%s".' % (filename) # # Plot the grid, and save the plot in a file. # filename = 'disk_grid_regular.png' disk_grid_display(n, r, c, ng, cg, filename) # # Terminate. # print '' print 'DISK_GRID_REGULAR_TEST:' print ' Normal end of execution.' return
def disk_grid_regular_test ( ): #*****************************************************************************80 # #% DISK_GRID_REGULAR_TEST tests DISK_GRID_REGULAR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 07 April 2015 # # Author: # # John Burkardt # import numpy as np from disk_grid_regular_count import disk_grid_regular_count from disk_grid_display import disk_grid_display from r82vec_print_part import r82vec_print_part from r8mat_transpose_write import r8mat_transpose_write print '' print 'DISK_GRID_REGULAR_TEST:' print ' DISK_GRID_REGULAR can define a grid of points' print ' with N+1 points on a horizontal or vertical radius,' print ' based on any disk.' n = 20 r = 2.0 c = np.array ( [ 1.0, 5.0 ] ) print '' print ' We use N = %d' % ( n ) print ' Radius R = %g' % ( r ) print ' Center C = (%g,%g)' % ( c[0], c[1] ) ng = disk_grid_regular_count ( n, r, c ) print '' print ' Number of grid points will be %d' % ( ng ) cg = disk_grid_regular ( n, r, c, ng ) r82vec_print_part ( ng, cg, 20, ' Part of the grid point array:' ) # # Write grid points to a file. # filename = 'disk_grid_regular.xy' r8mat_transpose_write ( filename, 2, ng, cg ) print '' print ' Data written to the file "%s".' % ( filename ) # # Plot the grid, and save the plot in a file. # filename = 'disk_grid_regular.png' disk_grid_display ( n, r, c, ng, cg, filename ) # # Terminate. # print '' print 'DISK_GRID_REGULAR_TEST:' print ' Normal end of execution.' return