From 694ff56d0632214a5e4d6df0849e6b1a48aa43bd Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 16 Jan 2012 18:00:31 +0100 Subject: Don't generate too many cells when doing ReAx cell reduction --- libcrystfel/src/reax.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'libcrystfel/src/reax.c') diff --git a/libcrystfel/src/reax.c b/libcrystfel/src/reax.c index b438e943..f675c8f7 100644 --- a/libcrystfel/src/reax.c +++ b/libcrystfel/src/reax.c @@ -45,10 +45,6 @@ #define INC_TOL_MULTIPLIER (3.0) -/* Maximum number of cells that can be found by the reduction */ -#define MAX_CELLS (48) - - struct dvec { double x; @@ -889,7 +885,7 @@ static void assemble_cells_from_candidates(struct image *image, { int i, j, k; signed int ti, tj, tk; - UnitCell *cells[MAX_CELLS]; + UnitCell *cells[MAX_CELL_CANDIDATES]; int ncells = 0; /* Find candidates for axes 0 and 1 which have the right angle */ @@ -929,7 +925,9 @@ static void assemble_cells_from_candidates(struct image *image, } refine_cell(image, cnew, image->features); - cells[ncells++] = cnew; + if ( ncells < MAX_CELL_CANDIDATES ) { + cells[ncells++] = cnew; + } } } @@ -939,6 +937,7 @@ static void assemble_cells_from_candidates(struct image *image, } image->ncells = ncells; + assert(ncells <= MAX_CELL_CANDIDATES); for ( i=0; icandidate_cells[i] = cells[i]; } -- cgit v1.2.3