diff options
author | Thomas White <taw@physics.org> | 2015-07-17 11:34:49 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-07-17 14:38:47 +0200 |
commit | eed34caa5fa7208cd63da88ceb987f027d650ee9 (patch) | |
tree | 24e7c9b72e026a893d2fd3ceee0365d3e1a7f3ec /src/partialator.c | |
parent | e80578dd35e486666390baf7a557f1605c06f004 (diff) |
Move post refinement multiprocessing stuff to post-refinement.c
Diffstat (limited to 'src/partialator.c')
-rw-r--r-- | src/partialator.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/partialator.c b/src/partialator.c index 46353c25..4398c9f8 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -84,111 +84,6 @@ static void show_help(const char *s) } -struct refine_args -{ - RefList *full; - Crystal *crystal; - PartialityModel pmodel; - int no_scale; - struct prdata prdata; -}; - - -struct queue_args -{ - int n_started; - int n_done; - Crystal **crystals; - int n_crystals; - struct refine_args task_defaults; - double initial_residual; - double initial_free_residual; - double final_residual; - double final_free_residual; -}; - - -static void refine_image(void *task, int id) -{ - struct refine_args *pargs = task; - Crystal *cr = pargs->crystal; - - pargs->prdata = pr_refine(cr, pargs->full, pargs->pmodel, - pargs->no_scale); -} - - -static void *get_image(void *vqargs) -{ - struct refine_args *task; - struct queue_args *qargs = vqargs; - - task = malloc(sizeof(struct refine_args)); - memcpy(task, &qargs->task_defaults, sizeof(struct refine_args)); - - task->crystal = qargs->crystals[qargs->n_started]; - - qargs->n_started++; - - return task; -} - - -static void done_image(void *vqargs, void *task) -{ - struct queue_args *qargs = vqargs; - struct refine_args *pargs = task; - - qargs->n_done++; - qargs->initial_residual += pargs->prdata.initial_residual; - qargs->initial_free_residual += pargs->prdata.initial_free_residual; - qargs->final_residual += pargs->prdata.final_residual; - qargs->final_free_residual += pargs->prdata.final_free_residual; - - progress_bar(qargs->n_done, qargs->n_crystals, "Refining"); - free(task); -} - - -static void refine_all(Crystal **crystals, int n_crystals, - RefList *full, int nthreads, PartialityModel pmodel, - int no_scale, - double *initial_residual, double *initial_free_residual, - double *final_residual, double *final_free_residual) -{ - struct refine_args task_defaults; - struct queue_args qargs; - - task_defaults.full = full; - task_defaults.crystal = NULL; - task_defaults.pmodel = pmodel; - task_defaults.prdata.refined = 0; - task_defaults.prdata.n_filtered = 0; - task_defaults.no_scale = no_scale; - - qargs.task_defaults = task_defaults; - qargs.n_started = 0; - qargs.n_done = 0; - qargs.n_crystals = n_crystals; - qargs.crystals = crystals; - qargs.initial_residual = 0.0; - qargs.initial_free_residual = 0.0; - qargs.final_residual = 0.0; - qargs.final_free_residual = 0.0; - - /* Don't have threads which are doing nothing */ - if ( n_crystals < nthreads ) nthreads = n_crystals; - - run_threads(nthreads, refine_image, get_image, done_image, - &qargs, n_crystals, 0, 0, 0); - - *initial_residual = qargs.initial_residual; - *initial_free_residual = qargs.initial_free_residual; - *final_residual = qargs.final_residual; - *final_free_residual = qargs.final_free_residual; -} - - static void display_progress(int n_images, int n_crystals) { if ( !isatty(STDERR_FILENO) ) return; |