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 ellipse_grid_points_test(): #*****************************************************************************80 # #% ELLIPSE_GRID_POINTS_TEST tests ELLIPSE_GRID_POINTS. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 08 April 2015 # # Author: # # John Burkardt # import numpy as np from ellipse_grid_count import ellipse_grid_count from ellipse_grid_display import ellipse_grid_display from r82vec_print_part import r82vec_print_part from r8mat_transpose_write import r8mat_transpose_write print '' print 'ELLIPSE_GRID_POINTS_TEST:' print ' ELLIPSE_GRID_POINTS can define a grid of points' print ' with N+1 points on the minor half axis,' print ' based on any ellipse.' n = 8 r = np.array([2.0, 1.0]) c = np.array([1.0, 2.0]) print '' print ' We use N = %d' % (n) print ' Radius R = (%g,%g)' % (r[0], r[1]) print ' Center C = (%g,%g)' % (c[0], c[1]) ng = ellipse_grid_count(n, r, c) print '' print ' Number of grid points will be %d' % (ng) cg = ellipse_grid_points(n, r, c, ng) r82vec_print_part(ng, cg, 20, ' Part of the grid point array:') # # Write grid points to a file. # filename = 'ellipse_grid.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 = 'ellipse_grid.png' ellipse_grid_display(n, r, c, ng, cg, filename) # # Terminate. # print '' print 'ELLIPSE_GRID_POINTS_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 ellipse_grid_points_test ( ): #*****************************************************************************80 # #% ELLIPSE_GRID_POINTS_TEST tests ELLIPSE_GRID_POINTS. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 08 April 2015 # # Author: # # John Burkardt # import numpy as np from ellipse_grid_count import ellipse_grid_count from ellipse_grid_display import ellipse_grid_display from r82vec_print_part import r82vec_print_part from r8mat_transpose_write import r8mat_transpose_write print '' print 'ELLIPSE_GRID_POINTS_TEST:' print ' ELLIPSE_GRID_POINTS can define a grid of points' print ' with N+1 points on the minor half axis,' print ' based on any ellipse.' n = 8 r = np.array ( [ 2.0, 1.0 ] ) c = np.array ( [ 1.0, 2.0 ] ) print '' print ' We use N = %d' % ( n ) print ' Radius R = (%g,%g)' % ( r[0], r[1] ) print ' Center C = (%g,%g)' % ( c[0], c[1] ) ng = ellipse_grid_count ( n, r, c ) print '' print ' Number of grid points will be %d' % ( ng ) cg = ellipse_grid_points ( n, r, c, ng ) r82vec_print_part ( ng, cg, 20, ' Part of the grid point array:' ) # # Write grid points to a file. # filename = 'ellipse_grid.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 = 'ellipse_grid.png' ellipse_grid_display ( n, r, c, ng, cg, filename ) # # Terminate. # print '' print 'ELLIPSE_GRID_POINTS_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