21 January 2017 08:43:08 AM SIMPLEX_GRID_TEST: C version Test the SIMPLEX_GRID library. TEST01: SIMPLEX_GRID_SIZE counts the points in a regular grid with N+1 points on a side, in an M-dimensional simplex. M: 0 1 2 3 4 5 N: 0: 1 1 1 1 1 1 1: 1 2 3 4 5 6 2: 1 3 6 10 15 21 3: 1 4 10 20 35 56 4: 1 5 15 35 70 126 5: 1 6 21 56 126 252 6: 1 7 28 84 210 462 7: 1 8 36 120 330 792 8: 1 9 45 165 495 1287 9: 1 10 55 220 715 2002 10: 1 11 66 286 1001 3003 TEST02: SIMPLEX_GRID_INDEX_NEXT lists, one by one, the indices of a simplex grid that uses N+1 points on a side, in an M-dimensional simplex. #: 1 2 3 (*) 0: 0 0 0 ( 3) 1: 0 0 1 ( 2) 2: 0 0 2 ( 1) 3: 0 0 3 ( 0) 4: 0 1 0 ( 2) 5: 0 1 1 ( 1) 6: 0 1 2 ( 0) 7: 0 2 0 ( 1) 8: 0 2 1 ( 0) 9: 0 3 0 ( 0) 10: 1 0 0 ( 2) 11: 1 0 1 ( 1) 12: 1 0 2 ( 0) 13: 1 1 0 ( 1) 14: 1 1 1 ( 0) 15: 1 2 0 ( 0) 16: 2 0 0 ( 1) 17: 2 0 1 ( 0) 18: 2 1 0 ( 0) 19: 3 0 0 ( 0) TEST03: SIMPLEX_GRID_INDEX_SAMPLE returns a randomly selected index of a simplex grid that uses N+1 points on a side, in an M-dimensional simplex. #: 1 2 3 (*) 1: 0 1 1 ( 1) 2: 1 0 2 ( 0) 3: 0 1 2 ( 0) 4: 1 0 2 ( 0) 5: 3 0 0 ( 0) 6: 0 1 0 ( 2) 7: 0 0 3 ( 0) 8: 0 0 3 ( 0) 9: 2 0 0 ( 1) 10: 0 1 1 ( 1) 11: 0 0 0 ( 3) 12: 1 0 2 ( 0) 13: 2 1 0 ( 0) 14: 1 1 1 ( 0) 15: 2 0 0 ( 1) 16: 1 0 0 ( 2) 17: 0 0 2 ( 1) 18: 1 2 0 ( 0) 19: 1 0 0 ( 2) 20: 0 2 0 ( 1) TEST04: SIMPLEX_GRID_INDEX_TO_POINT returns the physical point corresponding to a grid index of a simplex grid that that uses N+1 points on a side, in an M-dimensional simplex. Simplex vertices: Row: 0 1 Col 0: 20 0 1: 30 40 2: 10 20 Choosing random simplex indices to convert: #: 1 2 3 X Y 1: 1 4 0 28.0000 32.0000 2: 0 0 5 10.0000 20.0000 3: 1 2 2 20.0000 24.0000 4: 3 2 0 24.0000 16.0000 5: 0 5 0 30.0000 40.0000 6: 0 1 4 14.0000 24.0000 7: 2 1 2 18.0000 16.0000 8: 4 1 0 22.0000 8.0000 9: 1 4 0 28.0000 32.0000 10: 1 2 2 20.0000 24.0000 TEST05: SIMPLEX_GRID_INDEX_ALL returns all the indices of a simplex grid that uses N+1 points on a side, in an M-dimensional simplex. Transposed Simplex Grid Index Matrix: Row: 0 1 2 3 Col 0: 0 0 0 3 1: 0 0 1 2 2: 0 0 2 1 3: 0 0 3 0 4: 0 1 0 2 5: 0 1 1 1 6: 0 1 2 0 7: 0 2 0 1 8: 0 2 1 0 9: 0 3 0 0 10: 1 0 0 2 11: 1 0 1 1 12: 1 0 2 0 13: 1 1 0 1 14: 1 1 1 0 15: 1 2 0 0 16: 2 0 0 1 17: 2 0 1 0 18: 2 1 0 0 19: 3 0 0 0