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