diff options
Diffstat (limited to 'src/solvers/h48/gendata_cocsep.h')
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index b46bcf3..291ae48 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -1,27 +1,16 @@ | |||
| 1 | STATIC_INLINE bool get_visited(const uint8_t *, int64_t); | 1 | STATIC_INLINE bool gendata_cocsep_get_visited(const uint8_t *, int64_t); |
| 2 | STATIC_INLINE void set_visited(uint8_t *, int64_t); | 2 | STATIC_INLINE void gendata_cocsep_set_visited(uint8_t *, int64_t); |
| 3 | 3 | ||
| 4 | STATIC size_t gendata_cocsep( | 4 | STATIC size_t gendata_cocsep( |
| 5 | char [static COCSEP_FULLSIZE+INFOSIZE], uint64_t *, cube_t *); | 5 | char [static COCSEP_FULLSIZE], uint64_t *, cube_t *); |
| 6 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *); | 6 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *); |
| 7 | STATIC void getdistribution_cocsep(const uint32_t *, uint64_t [static 21]); | 7 | STATIC void getdistribution_cocsep(const uint32_t *, uint64_t [static 21]); |
| 8 | 8 | ||
| 9 | STATIC_INLINE int8_t get_h48_cdata(cube_t, const uint32_t *, uint32_t *); | 9 | STATIC_INLINE int8_t get_h48_cdata(cube_t, const uint32_t *, uint32_t *); |
| 10 | 10 | ||
| 11 | /* | ||
| 12 | Each element of the cocsep table is a uint32_t used as follows: | ||
| 13 | - Lowest 8-bit block: pruning value | ||
| 14 | - Second-lowest 8-bit block: "ttrep" (transformation to representative) | ||
| 15 | - Top 16-bit block: symcoord value | ||
| 16 | After the data as described above, more auxiliary information is appended: | ||
| 17 | - A uint32_t representing the number of symmetry classes | ||
| 18 | - A uint32_t representing the highest value of the pruning table | ||
| 19 | - One uint32_t for each "line" of the pruning table, representing the number | ||
| 20 | of positions having that pruning value. | ||
| 21 | */ | ||
| 22 | STATIC size_t | 11 | STATIC size_t |
| 23 | gendata_cocsep( | 12 | gendata_cocsep( |
| 24 | char buf[static COCSEP_FULLSIZE+INFOSIZE], | 13 | char buf[static COCSEP_FULLSIZE], |
| 25 | uint64_t *selfsim, | 14 | uint64_t *selfsim, |
| 26 | cube_t *rep | 15 | cube_t *rep |
| 27 | ) | 16 | ) |
| @@ -36,7 +25,7 @@ gendata_cocsep( | |||
| 36 | goto gendata_cocsep_return_size; | 25 | goto gendata_cocsep_return_size; |
| 37 | 26 | ||
| 38 | memset(buf, 0xFF, COCSEP_FULLSIZE); | 27 | memset(buf, 0xFF, COCSEP_FULLSIZE); |
| 39 | buf32 = (uint32_t *)((char *)buf + INFOSIZE); | 28 | buf32 = (uint32_t *)(buf + INFOSIZE); |
| 40 | if (selfsim != NULL) | 29 | if (selfsim != NULL) |
| 41 | memset(selfsim, 0, sizeof(uint64_t) * COCSEP_CLASSES); | 30 | memset(selfsim, 0, sizeof(uint64_t) * COCSEP_CLASSES); |
| 42 | 31 | ||
| @@ -69,7 +58,7 @@ gendata_cocsep( | |||
| 69 | info.distribution[i] = cc; | 58 | info.distribution[i] = cc; |
| 70 | } | 59 | } |
| 71 | 60 | ||
| 72 | writetableinfo(&info, COCSEP_FULLSIZE+INFOSIZE, buf); | 61 | writetableinfo(&info, COCSEP_FULLSIZE, buf); |
| 73 | 62 | ||
| 74 | DBG_ASSERT(n == COCSEP_CLASSES, 0, | 63 | DBG_ASSERT(n == COCSEP_CLASSES, 0, |
| 75 | "cocsep: computed %" PRIu16 " symmetry classes, " | 64 | "cocsep: computed %" PRIu16 " symmetry classes, " |
| @@ -101,9 +90,10 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) | |||
| 101 | 90 | ||
| 102 | i = coord_cocsep(arg->cube); | 91 | i = coord_cocsep(arg->cube); |
| 103 | olddepth = (uint8_t)(arg->buf32[i] & 0xFF); | 92 | olddepth = (uint8_t)(arg->buf32[i] & 0xFF); |
| 104 | if (olddepth < arg->depth || get_visited(arg->visited, i)) | 93 | if (olddepth < arg->depth || |
| 94 | gendata_cocsep_get_visited(arg->visited, i)) | ||
| 105 | return 0; | 95 | return 0; |
| 106 | set_visited(arg->visited, i); | 96 | gendata_cocsep_set_visited(arg->visited, i); |
| 107 | 97 | ||
| 108 | if (arg->depth == arg->maxdepth) { | 98 | if (arg->depth == arg->maxdepth) { |
| 109 | if ((arg->buf32[i] & 0xFF) != 0xFF) | 99 | if ((arg->buf32[i] & 0xFF) != 0xFF) |
| @@ -118,7 +108,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) | |||
| 118 | arg->selfsim[*arg->n] |= UINT64_C(1) << t; | 108 | arg->selfsim[*arg->n] |= UINT64_C(1) << t; |
| 119 | if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) | 109 | if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) |
| 120 | continue; | 110 | continue; |
| 121 | set_visited(arg->visited, j); | 111 | gendata_cocsep_set_visited(arg->visited, j); |
| 122 | tinv = inverse_trans(t); | 112 | tinv = inverse_trans(t); |
| 123 | olddepth = arg->buf32[j] & 0xFF; | 113 | olddepth = arg->buf32[j] & 0xFF; |
| 124 | cc += olddepth == 0xFF; | 114 | cc += olddepth == 0xFF; |
| @@ -155,13 +145,13 @@ getdistribution_cocsep(const uint32_t *table, uint64_t distr[static 21]) | |||
| 155 | } | 145 | } |
| 156 | 146 | ||
| 157 | STATIC_INLINE bool | 147 | STATIC_INLINE bool |
| 158 | get_visited(const uint8_t *a, int64_t i) | 148 | gendata_cocsep_get_visited(const uint8_t *a, int64_t i) |
| 159 | { | 149 | { |
| 160 | return a[VISITED_IND(i)] & VISITED_MASK(i); | 150 | return a[VISITED_IND(i)] & VISITED_MASK(i); |
| 161 | } | 151 | } |
| 162 | 152 | ||
| 163 | STATIC_INLINE void | 153 | STATIC_INLINE void |
| 164 | set_visited(uint8_t *a, int64_t i) | 154 | gendata_cocsep_set_visited(uint8_t *a, int64_t i) |
| 165 | { | 155 | { |
| 166 | a[VISITED_IND(i)] |= VISITED_MASK(i); | 156 | a[VISITED_IND(i)] |= VISITED_MASK(i); |
| 167 | } | 157 | } |
