diff options
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r-- | libcrystfel/src/index.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 97187655..6b36af3e 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -56,6 +56,19 @@ #include "grainspotter.h" +static int debug_index(struct image *image) +{ + Crystal *cr = crystal_new(); + UnitCell *cell = cell_new(); + cell_set_reciprocal(cell, +0.0000e9, +0.0000e9, +0.0000e9, + +0.0000e9, +0.0000e9, +0.0000e9, + +0.0000e9, +0.0000e9, +0.0000e9); + crystal_set_cell(cr, cell); + image_add_crystal(image, cr); + return 1; +} + + IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, struct detector *det, float *ltl) { @@ -101,6 +114,10 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, det, ltl); break; + case INDEXING_DEBUG : + iprivs[n] = (IndexingPrivate *)strdup("Hello!"); + break; + default : ERROR("Don't know how to prepare indexing method %i\n", indm[n]); @@ -175,6 +192,10 @@ void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs) grainspotter_cleanup(privs[n]); break; + case INDEXING_DEBUG : + free(privs[n]); + break; + default : ERROR("Don't know how to clean up indexing method %i\n", indms[n]); @@ -244,6 +265,9 @@ static int try_indexer(struct image *image, IndexingMethod indm, return grainspotter_index(image, ipriv); break; + case INDEXING_DEBUG : + return debug_index(image); + default : ERROR("Unrecognised indexing method: %i\n", indm); break; @@ -381,8 +405,12 @@ char *indexer_str(IndexingMethod indm) strcpy(str, "simulation"); break; + case INDEXING_DEBUG : + strcpy(str, "debug"); + break; + default : - ERROR("Unrecognised indexing method %i\n", + ERROR("No test description for indexing method %i\n", indm & INDEXING_METHOD_MASK); strcpy(str, "(unknown)"); break; @@ -457,6 +485,10 @@ IndexingMethod *build_indexer_list(const char *str) list[++nmeth] = INDEXING_SIMULATION; return list; + } else if ( strcmp(methods[i], "debug") == 0) { + list[++nmeth] = INDEXING_DEBUG; + return list; + } else if ( strcmp(methods[i], "raw") == 0) { list[nmeth] = set_raw(list[nmeth]); |