diff options
author | Thomas White <taw@physics.org> | 2014-11-14 16:23:20 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-11-14 16:23:20 +0100 |
commit | d545f4f23c7bb31b016ea5935dfd10c4e761b5ac (patch) | |
tree | 4c2c2d595a40be09ff5d49d32fc0addba4cdfd71 /src/pattern_sim.c | |
parent | d5fab594831e7884eb2dcf395995ec6d12a9cbfd (diff) |
pattern_sim: Better error trapping
Diffstat (limited to 'src/pattern_sim.c')
-rw-r--r-- | src/pattern_sim.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c index d7d9840d..0df09b75 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -792,19 +792,25 @@ int main(int argc, char *argv[]) na, nb, nc, na*a/1.0e-9, nb*b/1.0e-9, nc*c/1.0e-9); if ( config_gpu ) { + + int err; + if ( gctx == NULL ) { gctx = setup_gpu(config_nosfac, intensities, flags, sym_str, gpu_dev); } - get_diffraction_gpu(gctx, &image, na, nb, nc, cell, - no_fringes); + err = get_diffraction_gpu(gctx, &image, na, nb, nc, + cell, no_fringes); + if ( err ) image.data = NULL; + } else { get_diffraction(&image, na, nb, nc, intensities, phases, flags, cell, grad, sym, no_fringes); } if ( image.data == NULL ) { ERROR("Diffraction calculation failed.\n"); + done = 1; goto skip; } |