24 December 2011 11:44:06 AM HEX_GRID_PRB C++ version Test the HEX_GRID library. TEST01 For a hexagonal grid of points in the unit square, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_01_LAYERS computes LAYERS, the number of layers. NODES LAYERS PER LAYER 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 9 9 10 10 11 11 12 21 24 41 47 81 93 101 116 1001 1155 10001 11548 TEST02 For a hexagonal grid of points in the unit square, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_01_H computes HX and HY, the spacings in the row and column directions. NODES LAYERS HX HY PER LAYER 1 1 1 1 2 2 1 0.866025 3 3 0.5 0.433013 4 4 0.333333 0.288675 5 5 0.25 0.216506 6 6 0.2 0.173205 7 7 0.166667 0.144338 8 9 0.142857 0.123718 9 10 0.125 0.108253 10 11 0.111111 0.096225 11 12 0.1 0.0866025 21 24 0.05 0.0433013 41 47 0.025 0.0216506 81 93 0.0125 0.0108253 101 116 0.01 0.00866025 1001 1155 0.001 0.000866025 10001 11548 0.0001 8.66025e-05 LAYERS is chosen so that LAYERS-1 layers just fit inside the unit square, but LAYERS layers do not LAYERS HY (LAYERS-1)*HY LAYERS*HY 1 1 0 1 2 0.866025 0.866025 1.73205 3 0.433013 0.866025 1.29904 4 0.288675 0.866025 1.1547 5 0.216506 0.866025 1.08253 6 0.173205 0.866025 1.03923 7 0.144338 0.866025 1.01036 9 0.123718 0.989743 1.11346 10 0.108253 0.974279 1.08253 11 0.096225 0.96225 1.05848 12 0.0866025 0.952628 1.03923 24 0.0433013 0.995929 1.03923 47 0.0216506 0.995929 1.01758 93 0.0108253 0.995929 1.00675 116 0.00866025 0.995929 1.00459 1155 0.000866025 0.999393 1.00026 11548 8.66025e-05 1 1.00009 TEST03 For a hexagonal grid of points in the unit square, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_01_N computes N, the total number of grid points in the unit square. NODES LAYERS N PER LAYER 1 1 1 2 2 3 3 3 8 4 4 14 5 5 23 6 6 33 7 7 46 8 9 68 9 10 85 10 11 105 11 12 126 21 24 492 41 47 1904 81 93 7487 101 116 11658 1001 1155 1155578 10001 11548 115485774 TEST04 For a hexagonal grid of points in the unit square, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_01_POINTS computes P, the coordinates of the points of the grid. HEX_GRID_WRITE writes the data to a file. NODES LAYERS N Filename PER LAYER 1 1 1 hex_grid_01_1_1_1.txt 2 2 3 hex_grid_01_2_2_3.txt 3 3 8 hex_grid_01_3_3_8.txt 4 4 14 hex_grid_01_4_4_14.txt 5 5 23 hex_grid_01_5_5_23.txt 6 6 33 hex_grid_01_6_6_33.txt 7 7 46 hex_grid_01_7_7_46.txt 8 9 68 hex_grid_01_8_9_68.txt 9 10 85 hex_grid_01_9_10_85.txt 10 11 105 hex_grid_01_10_11_105.txt 11 12 126 hex_grid_01_11_12_126.txt 21 24 492 hex_grid_01_21_24_492.txt 41 47 1904 hex_grid_01_41_47_1904.txt 81 93 7487 hex_grid_01_81_93_7487.txt 101 116 11658 hex_grid_01_101_116_11658.txt TEST05 For a hexagonal grid of points in the unit box, HEX_GRID_01_APPROXIMATE_N seeks the value of NODES_PER_LAYER that produces a mesh of about N points. N_GOAL NODES_PER_LAYER N 100 10 105 200 14 216 500 22 538 10000 93 9898 TEST06 For a hexagonal grid of points in the unit box, HEX_GRID_01_APPROXIMATE_H seeks the value of NODES_PER_LAYER that produces a mesh with spacing that is H or less. H_GOAL NODES_PER_LAYER H N 0.1 11 0.1 126 0.01 101 0.01 11658 0.0001 10001 0.0001 115485774 TEST07 For a hexagonal grid of points in a coordinate box, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_LAYERS computes LAYERS, the number of layers. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 NODES LAYERS PER LAYER 1 1 2 2 3 4 4 6 5 8 6 10 7 12 8 14 9 16 10 18 11 20 21 39 41 77 81 154 101 193 TEST08 For a hexagonal grid of points in a coordinate box, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_H computes HX and HY, the spacings in the row and column directions. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 NODES LAYERS HX HY PER LAYER 1 1 3 5 2 2 3 2.59808 3 4 1.5 1.29904 4 6 1 0.866025 5 8 0.75 0.649519 6 10 0.6 0.519615 7 12 0.5 0.433013 8 14 0.428571 0.371154 9 16 0.375 0.32476 10 18 0.333333 0.288675 11 20 0.3 0.259808 21 39 0.15 0.129904 41 77 0.075 0.0649519 81 154 0.0375 0.032476 101 193 0.03 0.0259808 LAYERS is chosen so that LAYERS-1 layers just fit inside the unit square, but LAYERS layers do not. LAYERS HY (LAYERS-1)*HY LAYERS*HY 1 5 0 5 2 2.59808 2.59808 5.19615 4 1.29904 3.89711 5.19615 6 0.866025 4.33013 5.19615 8 0.649519 4.54663 5.19615 10 0.519615 4.67654 5.19615 12 0.433013 4.76314 5.19615 14 0.371154 4.825 5.19615 16 0.32476 4.87139 5.19615 18 0.288675 4.90748 5.19615 20 0.259808 4.93634 5.19615 39 0.129904 4.93634 5.06625 77 0.0649519 4.93634 5.0013 154 0.032476 4.96882 5.0013 193 0.0259808 4.98831 5.01429 TEST09 For a hexagonal grid of points in a coordinate box, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_N computes N, the total number of grid points in the coordinate box. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 NODES LAYERS N PER LAYER 1 1 1 2 2 3 3 4 10 4 6 21 5 8 36 6 10 55 7 12 78 8 14 105 9 16 136 10 18 171 11 20 210 21 39 800 41 77 3119 81 154 12397 101 193 19397 TEST10 For a hexagonal grid of points in a coordinate box, given NODES_PER_LAYER, the number of grid points along the first layer, HEX_GRID_POINTS computes P, the coordinates of the points of the grid. HEX_GRID_WRITE writes the data to a file. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 NODES LAYERS N Filename PER LAYER 1 1 1 hex_grid_1_1_1.txt 2 2 3 hex_grid_2_2_3.txt 3 4 10 hex_grid_3_4_10.txt 4 6 21 hex_grid_4_6_21.txt 5 8 36 hex_grid_5_8_36.txt 6 10 55 hex_grid_6_10_55.txt 7 12 78 hex_grid_7_12_78.txt 8 14 105 hex_grid_8_14_105.txt 9 16 136 hex_grid_9_16_136.txt 10 18 171 hex_grid_10_18_171.txt 11 20 210 hex_grid_11_20_210.txt 21 39 800 hex_grid_21_39_800.txt TEST11 For a hexagonal grid of points in a coordinate box, HEX_GRID_APPROXIMATE_N seeks the value of NODES_PER_LAYER that produces a mesh of about N points. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 N_GOAL NODES_PER_LAYER N 100 7 78 200 10 171 500 16 450 10000 73 10078 TEST12 For a hexagonal grid of points in the unit box, HEX_GRID_APPROXIMATE_H seeks the value of NODES_PER_LAYER that produces a mesh with spacing that is H or less. Coordinate box: 1 <= X <= 4 2 <= Y <= 7 H_GOAL NODES_PER_LAYER H N 0.1 31 0.1 1769 0.01 301 0.01 173689 0.0001 30001 0.0001 1732108868 HEX_GRID_PRB Normal end of execution. 24 December 2011 11:44:06 AM