12 January 2010 11:12:05.687 PM SPARSE_GRID_CLOSED_PRB: FORTRAN90 version Test routines in the SPARSE_GRID_CLOSED library. TEST01 SPARSE_GRID_CFN_SIZE returns the number of distinct points in a sparse grid, made up of product grids formed from closed fully nested quadrature rules. The sparse grid is the sum of all product grids of order LEVEL, with 0 <= LEVEL <= LEVEL_MAX. LEVEL is the sum of the levels of the 1D rules, the order of the 1D rule is 2^LEVEL + 1, the region is [-1,1]^DIM_NUM. For this kind of rule, there is complete nesting, that is, a sparse grid of a given level includes ALL the points on grids of lower levels. DIM: 1 2 3 4 5 LEVEL_MAX 0 1 1 1 1 1 1 3 5 7 9 11 2 5 13 25 41 61 3 9 29 69 137 241 4 17 65 177 401 801 5 33 145 441 1105 2433 6 65 321 1073 2929 6993 7 129 705 2561 7537 19313 8 257 1537 6017 18945 51713 9 513 3329 13953 46721 135073 10 1025 7169 32001 113409 345665 TEST01 SPARSE_GRID_CFN_SIZE returns the number of distinct points in a sparse grid, made up of product grids formed from closed fully nested quadrature rules. The sparse grid is the sum of all product grids of order LEVEL, with 0 <= LEVEL <= LEVEL_MAX. LEVEL is the sum of the levels of the 1D rules, the order of the 1D rule is 2^LEVEL + 1, the region is [-1,1]^DIM_NUM. For this kind of rule, there is complete nesting, that is, a sparse grid of a given level includes ALL the points on grids of lower levels. DIM: 6 7 8 9 10 LEVEL_MAX 0 1 1 1 1 1 1 13 15 17 19 21 2 85 113 145 181 221 3 389 589 849 1177 1581 4 1457 2465 3937 6001 8801 5 4865 9017 15713 26017 41265 6 15121 30241 56737 100897 171425 7 44689 95441 190881 361249 652065 8 127105 287745 609025 1218049 2320385 9 350657 836769 1863937 3918273 7836545 10 943553 2362881 5515265 12133761 25370753 TEST02: LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. LEVEL_MAX = 3 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 29 Grid index: 1 4 4 2 0 4 3 8 4 4 4 0 5 4 8 6 2 4 7 6 4 8 0 0 9 8 0 10 0 8 11 8 8 12 4 2 13 4 6 14 1 4 15 3 4 16 5 4 17 7 4 18 2 0 19 6 0 20 2 8 21 6 8 22 0 2 23 8 2 24 0 6 25 8 6 26 4 1 27 4 3 28 4 5 29 4 7 TEST02: LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. LEVEL_MAX = 4 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 65 Grid index: 1 8 8 2 0 8 3 16 8 4 8 0 5 8 16 6 4 8 7 12 8 8 0 0 9 16 0 10 0 16 11 16 16 12 8 4 13 8 12 14 2 8 15 6 8 16 10 8 17 14 8 18 4 0 19 12 0 20 4 16 21 12 16 22 0 4 23 16 4 24 0 12 25 16 12 26 8 2 27 8 6 28 8 10 29 8 14 30 1 8 31 3 8 32 5 8 33 7 8 34 9 8 35 11 8 36 13 8 37 15 8 38 2 0 39 6 0 40 10 0 41 14 0 42 2 16 43 6 16 44 10 16 45 14 16 46 4 4 47 12 4 48 4 12 49 12 12 50 0 2 51 16 2 52 0 6 53 16 6 54 0 10 55 16 10 56 0 14 57 16 14 58 8 1 59 8 3 60 8 5 61 8 7 62 8 9 63 8 11 64 8 13 65 8 15 TEST02: LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. LEVEL_MAX = 2 Spatial dimension DIM_NUM = 3 Number of unique points in the grid = 25 Grid index: 1 2 2 2 2 0 2 2 3 4 2 2 4 2 0 2 5 2 4 2 6 2 2 0 7 2 2 4 8 1 2 2 9 3 2 2 10 0 0 2 11 4 0 2 12 0 4 2 13 4 4 2 14 2 1 2 15 2 3 2 16 0 2 0 17 4 2 0 18 0 2 4 19 4 2 4 20 2 0 0 21 2 4 0 22 2 0 4 23 2 4 4 24 2 2 1 25 2 2 3 TEST02: LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. LEVEL_MAX = 2 Spatial dimension DIM_NUM = 6 Number of unique points in the grid = 85 Grid index: 1 2 2 2 2 2 2 2 0 2 2 2 2 2 3 4 2 2 2 2 2 4 2 0 2 2 2 2 5 2 4 2 2 2 2 6 2 2 0 2 2 2 7 2 2 4 2 2 2 8 2 2 2 0 2 2 9 2 2 2 4 2 2 10 2 2 2 2 0 2 11 2 2 2 2 4 2 12 2 2 2 2 2 0 13 2 2 2 2 2 4 14 1 2 2 2 2 2 15 3 2 2 2 2 2 16 0 0 2 2 2 2 17 4 0 2 2 2 2 18 0 4 2 2 2 2 19 4 4 2 2 2 2 20 2 1 2 2 2 2 21 2 3 2 2 2 2 22 0 2 0 2 2 2 23 4 2 0 2 2 2 24 0 2 4 2 2 2 25 4 2 4 2 2 2 26 2 0 0 2 2 2 27 2 4 0 2 2 2 28 2 0 4 2 2 2 29 2 4 4 2 2 2 30 2 2 1 2 2 2 31 2 2 3 2 2 2 32 0 2 2 0 2 2 33 4 2 2 0 2 2 34 0 2 2 4 2 2 35 4 2 2 4 2 2 36 2 0 2 0 2 2 37 2 4 2 0 2 2 38 2 0 2 4 2 2 39 2 4 2 4 2 2 40 2 2 0 0 2 2 41 2 2 4 0 2 2 42 2 2 0 4 2 2 43 2 2 4 4 2 2 44 2 2 2 1 2 2 45 2 2 2 3 2 2 46 0 2 2 2 0 2 47 4 2 2 2 0 2 48 0 2 2 2 4 2 49 4 2 2 2 4 2 50 2 0 2 2 0 2 51 2 4 2 2 0 2 52 2 0 2 2 4 2 53 2 4 2 2 4 2 54 2 2 0 2 0 2 55 2 2 4 2 0 2 56 2 2 0 2 4 2 57 2 2 4 2 4 2 58 2 2 2 0 0 2 59 2 2 2 4 0 2 60 2 2 2 0 4 2 61 2 2 2 4 4 2 62 2 2 2 2 1 2 63 2 2 2 2 3 2 64 0 2 2 2 2 0 65 4 2 2 2 2 0 66 0 2 2 2 2 4 67 4 2 2 2 2 4 68 2 0 2 2 2 0 69 2 4 2 2 2 0 70 2 0 2 2 2 4 71 2 4 2 2 2 4 72 2 2 0 2 2 0 73 2 2 4 2 2 0 74 2 2 0 2 2 4 75 2 2 4 2 2 4 76 2 2 2 0 2 0 77 2 2 2 4 2 0 78 2 2 2 0 2 4 79 2 2 2 4 2 4 80 2 2 2 2 0 0 81 2 2 2 2 4 0 82 2 2 2 2 0 4 83 2 2 2 2 4 4 84 2 2 2 2 2 1 85 2 2 2 2 2 3 TEST03: Make a Clenshaw-Curtis sparse grid. LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. Now we demonstrate how to convert grid indices into physical grid points. In this case, we want points on [-1,+1]^DIM_NUM. LEVEL_MAX = 3 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 29 Grid index: 1 4 4 2 0 4 3 8 4 4 4 0 5 4 8 6 2 4 7 6 4 8 0 0 9 8 0 10 0 8 11 8 8 12 4 2 13 4 6 14 1 4 15 3 4 16 5 4 17 7 4 18 2 0 19 6 0 20 2 8 21 6 8 22 0 2 23 8 2 24 0 6 25 8 6 26 4 1 27 4 3 28 4 5 29 4 7 Grid points: 1 0.000000 0.000000 2 -1.000000 0.000000 3 1.000000 0.000000 4 0.000000 -1.000000 5 0.000000 1.000000 6 -0.707107 0.000000 7 0.707107 0.000000 8 -1.000000 -1.000000 9 1.000000 -1.000000 10 -1.000000 1.000000 11 1.000000 1.000000 12 0.000000 -0.707107 13 0.000000 0.707107 14 -0.923880 0.000000 15 -0.382683 0.000000 16 0.382683 0.000000 17 0.923880 0.000000 18 -0.707107 -1.000000 19 0.707107 -1.000000 20 -0.707107 1.000000 21 0.707107 1.000000 22 -1.000000 -0.707107 23 1.000000 -0.707107 24 -1.000000 0.707107 25 1.000000 0.707107 26 0.000000 -0.923880 27 0.000000 -0.382683 28 0.000000 0.382683 29 0.000000 0.923880 TEST04: Make a Newton Cotes Closed sparse grid. LEVELS_CLOSED_INDEX returns all grid indexes whose level value satisfies 0 <= LEVEL <= LEVEL_MAX. Here, LEVEL is the sum of the levels of the 1D rules, and the order of the rule is 2^LEVEL + 1. Now we demonstrate how to convert grid indices into physical grid points. In this case, we want points on [0,+1]^DIM_NUM. LEVEL_MAX = 4 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 65 Grid index: 1 8 8 2 0 8 3 16 8 4 8 0 5 8 16 6 4 8 7 12 8 8 0 0 9 16 0 10 0 16 11 16 16 12 8 4 13 8 12 14 2 8 15 6 8 16 10 8 17 14 8 18 4 0 19 12 0 20 4 16 21 12 16 22 0 4 23 16 4 24 0 12 25 16 12 26 8 2 27 8 6 28 8 10 29 8 14 30 1 8 31 3 8 32 5 8 33 7 8 34 9 8 35 11 8 36 13 8 37 15 8 38 2 0 39 6 0 40 10 0 41 14 0 42 2 16 43 6 16 44 10 16 45 14 16 46 4 4 47 12 4 48 4 12 49 12 12 50 0 2 51 16 2 52 0 6 53 16 6 54 0 10 55 16 10 56 0 14 57 16 14 58 8 1 59 8 3 60 8 5 61 8 7 62 8 9 63 8 11 64 8 13 65 8 15 Grid points: 1 0.000000 0.000000 2 -1.000000 0.000000 3 1.000000 0.000000 4 0.000000 -1.000000 5 0.000000 1.000000 6 -0.500000 0.000000 7 0.500000 0.000000 8 -1.000000 -1.000000 9 1.000000 -1.000000 10 -1.000000 1.000000 11 1.000000 1.000000 12 0.000000 -0.500000 13 0.000000 0.500000 14 -0.750000 0.000000 15 -0.250000 0.000000 16 0.250000 0.000000 17 0.750000 0.000000 18 -0.500000 -1.000000 19 0.500000 -1.000000 20 -0.500000 1.000000 21 0.500000 1.000000 22 -1.000000 -0.500000 23 1.000000 -0.500000 24 -1.000000 0.500000 25 1.000000 0.500000 26 0.000000 -0.750000 27 0.000000 -0.250000 28 0.000000 0.250000 29 0.000000 0.750000 30 -0.875000 0.000000 31 -0.625000 0.000000 32 -0.375000 0.000000 33 -0.125000 0.000000 34 0.125000 0.000000 35 0.375000 0.000000 36 0.625000 0.000000 37 0.875000 0.000000 38 -0.750000 -1.000000 39 -0.250000 -1.000000 40 0.250000 -1.000000 41 0.750000 -1.000000 42 -0.750000 1.000000 43 -0.250000 1.000000 44 0.250000 1.000000 45 0.750000 1.000000 46 -0.500000 -0.500000 47 0.500000 -0.500000 48 -0.500000 0.500000 49 0.500000 0.500000 50 -1.000000 -0.750000 51 1.000000 -0.750000 52 -1.000000 -0.250000 53 1.000000 -0.250000 54 -1.000000 0.250000 55 1.000000 0.250000 56 -1.000000 0.750000 57 1.000000 0.750000 58 0.000000 -0.875000 59 0.000000 -0.625000 60 0.000000 -0.375000 61 0.000000 -0.125000 62 0.000000 0.125000 63 0.000000 0.375000 64 0.000000 0.625000 65 0.000000 0.875000 TEST05: Make sparse grids and write to files. LEVEL_MAX = 2 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 13 Grid index: 1 2 2 2 0 2 3 4 2 4 2 0 5 2 4 6 1 2 7 3 2 8 0 0 9 4 0 10 0 4 11 4 4 12 2 1 13 2 3 Wrote file "cc_d2_level2.txt". Wrote file "ncc_d2_level2.txt". TEST05: Make sparse grids and write to files. LEVEL_MAX = 3 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 29 Grid index: 1 4 4 2 0 4 3 8 4 4 4 0 5 4 8 6 2 4 7 6 4 8 0 0 9 8 0 10 0 8 11 8 8 12 4 2 13 4 6 14 1 4 15 3 4 16 5 4 17 7 4 18 2 0 19 6 0 20 2 8 21 6 8 22 0 2 23 8 2 24 0 6 25 8 6 26 4 1 27 4 3 28 4 5 29 4 7 Wrote file "cc_d2_level3.txt". Wrote file "ncc_d2_level3.txt". TEST05: Make sparse grids and write to files. LEVEL_MAX = 4 Spatial dimension DIM_NUM = 2 Number of unique points in the grid = 65 Grid index: 1 8 8 2 0 8 3 16 8 4 8 0 5 8 16 6 4 8 7 12 8 8 0 0 9 16 0 10 0 16 11 16 16 12 8 4 13 8 12 14 2 8 15 6 8 16 10 8 17 14 8 18 4 0 19 12 0 20 4 16 21 12 16 22 0 4 23 16 4 24 0 12 25 16 12 26 8 2 27 8 6 28 8 10 29 8 14 30 1 8 31 3 8 32 5 8 33 7 8 34 9 8 35 11 8 36 13 8 37 15 8 38 2 0 39 6 0 40 10 0 41 14 0 42 2 16 43 6 16 44 10 16 45 14 16 46 4 4 47 12 4 48 4 12 49 12 12 50 0 2 51 16 2 52 0 6 53 16 6 54 0 10 55 16 10 56 0 14 57 16 14 58 8 1 59 8 3 60 8 5 61 8 7 62 8 9 63 8 11 64 8 13 65 8 15 Wrote file "cc_d2_level4.txt". Wrote file "ncc_d2_level4.txt". SPARSE_GRID_CLOSED_PRB: Normal end of execution. 12 January 2010 11:12:05.880 PM