From 7d9499328361495146c5cea5a01dabe793e3d19d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 13 Apr 2016 10:27:15 +0200 Subject: Fix event enumeration I broke it. Sorry about that. --- libcrystfel/src/hdf5-file.c | 48 +++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c index 0fb388b4..29962aca 100644 --- a/libcrystfel/src/hdf5-file.c +++ b/libcrystfel/src/hdf5-file.c @@ -2592,8 +2592,8 @@ static int fill_paths(struct hdfile *hdfile, struct detector *det, int pi, } -static int fill_dims(struct hdfile *hdfile, struct panel *p, struct event *ev, - struct event_list *events) +static int check_dims(struct hdfile *hdfile, struct panel *p, struct event *ev, + struct event_list *events, int *global_path_dim) { char *full_panel_path; hid_t dh; @@ -2603,8 +2603,6 @@ static int fill_dims(struct hdfile *hdfile, struct panel *p, struct event *ev, hsize_t *max_size; int hsdi; int panel_path_dim = 0; - int global_path_dim = -1; - int mlwd; struct dim_structure *panel_dim_structure; /* Get the full path for this panel in this event */ @@ -2636,11 +2634,11 @@ static int fill_dims(struct hdfile *hdfile, struct panel *p, struct event *ev, } } - if ( global_path_dim == -1 ) { + if ( *global_path_dim == -1 ) { - global_path_dim = panel_path_dim; + *global_path_dim = panel_path_dim; - } else if ( panel_path_dim != global_path_dim ) { + } else if ( panel_path_dim != *global_path_dim ) { ERROR("Data blocks paths for panels must have the same number" " of placeholders\n"); @@ -2649,17 +2647,6 @@ static int fill_dims(struct hdfile *hdfile, struct panel *p, struct event *ev, return 1; } - - for ( mlwd=0; mlwdnum_events; evi++ ) { + int pi; + int global_path_dim = -1; + int mlwd; + + /* Check the dimensionality of each panel */ for ( pi=0; pin_panels; pi++ ) { - if ( fill_dims(hdfile, &det->panels[pi], - master_el->events[evi], - master_el_with_dims) ) + if ( check_dims(hdfile, &det->panels[pi], + master_el->events[evi], + master_el_with_dims, + &global_path_dim) ) { ERROR("Failed to enumerate dims.\n"); return NULL; } } + + /* Add this dimensionality to all events */ + for ( mlwd=0; mlwdevents[evi]); + push_dim_entry_to_event(mlwd_ev, mlwd); + append_event_to_event_list(master_el_with_dims, + mlwd_ev); + free_event(mlwd_ev); + } + } free_event_list(master_el); -- cgit v1.2.3