aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/reax.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-01-16 18:00:31 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:43 +0100
commit694ff56d0632214a5e4d6df0849e6b1a48aa43bd (patch)
tree5f88610b7f64eb4f366229e1bfea33ed0c7c5a47 /libcrystfel/src/reax.c
parent26d0823dccd4767dd287505f5d6a2ce71581a5f2 (diff)
Don't generate too many cells when doing ReAx cell reduction
Diffstat (limited to 'libcrystfel/src/reax.c')
-rw-r--r--libcrystfel/src/reax.c11
1 files changed, 5 insertions, 6 deletions
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; i<ncells; i++ ) {
image->candidate_cells[i] = cells[i];
}