aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/solve_h48.h32
-rw-r--r--test/103_cocsep_ttrep/cocsep_ttrep_tests.c25
2 files changed, 28 insertions, 29 deletions
diff --git a/src/solve_h48.h b/src/solve_h48.h
index c3316e1..5054605 100644
--- a/src/solve_h48.h
+++ b/src/solve_h48.h
@@ -307,9 +307,9 @@ gendata_cocsep_return_size:
307_static uint32_t 307_static uint32_t
308gendata_cocsep_dfs(dfsarg_cocsep_t *arg) 308gendata_cocsep_dfs(dfsarg_cocsep_t *arg)
309{ 309{
310 uint8_t m, tinv; 310 uint8_t m;
311 uint32_t cc, class, ttrep, depth, olddepth; 311 uint32_t cc, class, ttrep, depth, olddepth, tinv;
312 uint64_t t, is; 312 uint64_t t;
313 int64_t i, j; 313 int64_t i, j;
314 cube_t d; 314 cube_t d;
315 dfsarg_cocsep_t nextarg; 315 dfsarg_cocsep_t nextarg;
@@ -324,24 +324,25 @@ gendata_cocsep_dfs(dfsarg_cocsep_t *arg)
324 if ((arg->buf32[i] & 0xFF) != 0xFF) 324 if ((arg->buf32[i] & 0xFF) != 0xFF)
325 return 0; 325 return 0;
326 326
327 if (arg->rep != NULL)
328 arg->rep[*arg->n] = arg->cube;
327 for (t = 0, cc = 0; t < 48; t++) { 329 for (t = 0, cc = 0; t < 48; t++) {
328 d = transform_corners(arg->cube, t); 330 d = transform_corners(arg->cube, t);
329 j = coord_cocsep(d); 331 j = coord_cocsep(d);
330 is = (i == j); 332 if (i == j && arg->selfsim != NULL)
331 if (arg->selfsim != NULL) 333 arg->selfsim[*arg->n] |= UINT64_C(1) << t;
332 arg->selfsim[*arg->n] |= is << t; 334 if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF))
335 continue;
333 set_visited(arg->visited, j); 336 set_visited(arg->visited, j);
334 tinv = inverse_trans(t) * (1-is); 337 tinv = inverse_trans(t);
335 olddepth = (uint8_t)(arg->buf32[j] & 0xFF); 338 olddepth = arg->buf32[j] & 0xFF;
336 cc += olddepth == 0xFF; 339 cc += olddepth == 0xFF;
337 340
338 class = (uint32_t)(*arg->n) << 16; 341 class = (uint32_t)(*arg->n) << UINT32_C(16);
339 ttrep = (uint32_t)tinv << 8; 342 ttrep = (uint32_t)tinv << UINT32_C(8);
340 depth = (uint32_t)arg->depth; 343 depth = (uint32_t)arg->depth;
341 arg->buf32[j] = class | ttrep | depth; 344 arg->buf32[j] = class | ttrep | depth;
342 } 345 }
343 if (arg->rep != NULL)
344 arg->rep[*arg->n] = arg->cube;
345 (*arg->n)++; 346 (*arg->n)++;
346 347
347 return cc; 348 return cc;
@@ -467,6 +468,7 @@ gendata_h48h0k4_bfs_fromdone(bfsarg_esep_t *arg)
467 transd = transform(moved, t); 468 transd = transform(moved, t);
468 k = coord_h48(transd, arg->cocsepdata, 0); 469 k = coord_h48(transd, arg->cocsepdata, 0);
469 if (k != j) { 470 if (k != j) {
471/*
470LOG("t=%" PRId64 ", tinv=%" PRIu8 "\n", t, inverse_trans(t)); 472LOG("t=%" PRId64 ", tinv=%" PRIu8 "\n", t, inverse_trans(t));
471int64_t ccm = coord_cocsep(moved); 473int64_t ccm = coord_cocsep(moved);
472int64_t repm = coord_cocsep(arg->crep[j/H48_ESIZE(0)]); 474int64_t repm = coord_cocsep(arg->crep[j/H48_ESIZE(0)]);
@@ -474,12 +476,6 @@ LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId
474int64_t cct = coord_cocsep(transd); 476int64_t cct = coord_cocsep(transd);
475int64_t rept = coord_cocsep(arg->crep[k/H48_ESIZE(0)]); 477int64_t rept = coord_cocsep(arg->crep[k/H48_ESIZE(0)]);
476LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, cct, rept, TTREP(arg->cocsepdata[cct])); 478LOG("moved: full %" PRId64 ", cocsep %" PRId64 ", rep %" PRId64 ", ttrep %" PRId32 "\n", j, cct, rept, TTREP(arg->cocsepdata[cct]));
477/*
478 char q[150];
479 writecube_H48(moved, q);
480 LOG("%s\n", q)
481 writecube_H48(transd, q);
482 LOG("%s\n", q)
483*/ 479*/
484 } 480 }
485 continue; 481 continue;
diff --git a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c
index 78f8014..f0da151 100644
--- a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c
+++ b/test/103_cocsep_ttrep/cocsep_ttrep_tests.c
@@ -1,17 +1,19 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCSEP_CLASSES 3393 3#define COCSEP_CLASSES 3393
4#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
5#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
4 6
5uint8_t inverse_trans(uint8_t); 7uint8_t inverse_trans(uint8_t);
6cube_t transform_corners(cube_t); 8cube_t transform_corners(cube_t, uint8_t);
7int64_t coord_cocsep(cube_t); 9int64_t coord_cocsep(cube_t);
8size_t gendata_cocsep(void *, uint64_t *, cube_t *); 10size_t gendata_cocsep(void *, uint64_t *, cube_t *);
9 11
10void run(void) { 12void run(void) {
11 uint8_t t, tinv; 13 uint8_t t;
12 uint32_t buf[300000], tt; 14 uint32_t buf[300000], tt;
13 uint64_t selfsim[COCSEP_CLASSES]; 15 uint64_t selfsim[COCSEP_CLASSES];
14 int64_t i, j; 16 int64_t i, j, k, l;
15 cube_t rep[COCSEP_CLASSES], c, d; 17 cube_t rep[COCSEP_CLASSES], c, d;
16 18
17 gendata_cocsep(buf, selfsim, rep); 19 gendata_cocsep(buf, selfsim, rep);
@@ -19,15 +21,16 @@ void run(void) {
19 for (i = 0; i < COCSEP_CLASSES; i++) { 21 for (i = 0; i < COCSEP_CLASSES; i++) {
20 c = rep[i]; 22 c = rep[i];
21 for (t = 0; t < 48; t++) { 23 for (t = 0; t < 48; t++) {
22 tinv = inverse_trans(t); 24 d = transform_corners(c, t);
23 d = transform_corners(c);
24 j = coord_cocsep(d); 25 j = coord_cocsep(d);
25 tt = (buf[j] & (0xFF << 8)) >> 8; 26 tt = TTREP(buf[j]);
26 if (tt != tinv) 27 d = transform_corners(d, tt);
27 printf("cocsep %" PRId64 " <- %" PRId64 ": " 28 k = coord_cocsep(d);
28 "expected t %" PRIu8 " (inverse of %" 29 l = coord_cocsep(c);
29 PRIu8 "), got %" PRIu32 "\n", 30 if (k != l)
30 i, j, tinv, t, tt); 31 printf("cocsep %" PRId64 " (%" PRId64 "): "
32 "%" PRId64 " ttrep %" PRIu8
33 " -> %" PRId64 "\n", i, l, j, tt, k);
31 } 34 }
32 } 35 }
33} 36}

Generated with cgit - Back to sebastiano.tronto.net