diff options
Diffstat (limited to 'src/solvers/twostep/twostep.h')
| -rw-r--r-- | src/solvers/twostep/twostep.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/solvers/twostep/twostep.h b/src/solvers/twostep/twostep.h new file mode 100644 index 0000000..8947a50 --- /dev/null +++ b/src/solvers/twostep/twostep.h | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | #include "../coord/coord.h" | ||
| 2 | |||
| 3 | STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); | ||
| 4 | STATIC long long gendata_twostep( | ||
| 5 | const char *, unsigned long long, unsigned char *); | ||
| 6 | STATIC long long checkdata_twostep( | ||
| 7 | const char *, unsigned long long, const unsigned char *); | ||
| 8 | STATIC long long solve_twostep(oriented_cube_t, const char *, unsigned, | ||
| 9 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long, | ||
| 10 | const unsigned char *, unsigned, char *, | ||
| 11 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); | ||
| 12 | |||
| 13 | STATIC long long | ||
| 14 | dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) | ||
| 15 | { | ||
| 16 | strcpy(dataid, "DR_DRFIN"); | ||
| 17 | return NISSY_OK; | ||
| 18 | } | ||
| 19 | |||
| 20 | STATIC long long | ||
| 21 | gendata_twostep( | ||
| 22 | const char *s, | ||
| 23 | unsigned long long bufsize, | ||
| 24 | unsigned char *buf | ||
| 25 | ) | ||
| 26 | { | ||
| 27 | size_t r, s1, s2; | ||
| 28 | |||
| 29 | s1 = gendata_coord(&coordinate_dr, NULL); | ||
| 30 | s1 = DIV_ROUND_UP(s1, 8); /* Preserve 8-byte alignment */ | ||
| 31 | s2 = gendata_multicoord(&multicoordinate_drfin, NULL); | ||
| 32 | |||
| 33 | if (buf == NULL) | ||
| 34 | goto gendata_twostep_return_size; | ||
| 35 | |||
| 36 | if (bufsize < s1 + s2) | ||
| 37 | return NISSY_ERROR_BUFFER_SIZE; | ||
| 38 | |||
| 39 | r = gendata_coord(&coordinate_dr, buf); | ||
| 40 | if (r == 0) | ||
| 41 | return NISSY_ERROR_UNKNOWN; | ||
| 42 | |||
| 43 | r = gendata_multicoord(&multicoordinate_drfin, buf + s1); | ||
| 44 | if (r != NISSY_OK) | ||
| 45 | return NISSY_ERROR_UNKNOWN; | ||
| 46 | |||
| 47 | gendata_twostep_return_size: | ||
| 48 | return s1 + s2; | ||
| 49 | } | ||
| 50 | |||
| 51 | STATIC long long | ||
| 52 | checkdata_twostep( | ||
| 53 | const char *s, | ||
| 54 | unsigned long long bufsize, | ||
| 55 | const unsigned char *buf | ||
| 56 | ) | ||
| 57 | { | ||
| 58 | long long r; | ||
| 59 | |||
| 60 | LOG("[checkdata] Checking double table for two step solver\n"); | ||
| 61 | |||
| 62 | r = checkdata_coord(&coordinate_dr, bufsize, buf); | ||
| 63 | if (r != NISSY_OK) | ||
| 64 | return r; | ||
| 65 | |||
| 66 | r = checkdata_multicoord(&multicoordinate_drfin, bufsize, buf); | ||
| 67 | if (r != NISSY_OK) | ||
| 68 | return r; | ||
| 69 | |||
| 70 | return NISSY_OK; | ||
| 71 | } | ||
| 72 | |||
| 73 | STATIC long long | ||
| 74 | solve_twostep( | ||
| 75 | oriented_cube_t oc, | ||
| 76 | const char *coord_and_trans, | ||
| 77 | unsigned nissflag, | ||
| 78 | unsigned minmoves, | ||
| 79 | unsigned maxmoves, | ||
| 80 | unsigned maxsolutions, | ||
| 81 | unsigned optimal, | ||
| 82 | unsigned threads, | ||
| 83 | unsigned long long data_size, | ||
| 84 | const unsigned char *data, | ||
| 85 | unsigned solutions_size, | ||
| 86 | char *sols, | ||
| 87 | long long stats[SIZE(NISSY_SIZE_SOLVE_STATS)], | ||
| 88 | int (*poll_status)(void *), | ||
| 89 | void *poll_status_data | ||
| 90 | ) | ||
| 91 | { | ||
| 92 | //TODO | ||
| 93 | } | ||
