aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-12-20 13:53:30 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:42 +0100
commit27fa902d7b7875de89e8eb1536812000f0a45889 (patch)
tree0ff370e6518839c57df52302872ee24b431f2c4c
parent6a305fecf59ef6471fea2809c726c98497b908b6 (diff)
Pass serial number and verbosity level down
-rw-r--r--src/partialator.c2
-rw-r--r--src/post-refinement.c19
-rw-r--r--src/post-refinement.h3
3 files changed, 15 insertions, 9 deletions
diff --git a/src/partialator.c b/src/partialator.c
index ced67edb..fa9c3ee9 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -1246,7 +1246,7 @@ int main(int argc, char *argv[])
STATUS("Scaling and refinement cycle %i of %i\n", i+1, n_iter);
if ( !no_pr ) {
- refine_all(crystals, n_crystals, full, nthreads, pmodel);
+ refine_all(crystals, n_crystals, full, nthreads, pmodel, 0);
} else if ( !no_scale ) {
scale_all_to_reference(crystals, n_crystals, full, nthreads);
}
diff --git a/src/post-refinement.c b/src/post-refinement.c
index ccaee00d..be69b36e 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -215,6 +215,7 @@ struct rf_priv {
const RefList *full;
enum gparam *rv;
int verbose;
+ int serial;
const gsl_vector *initial;
};
@@ -368,7 +369,7 @@ static int check_angle_shifts(gsl_vector *cur, gsl_vector *initial,
static void do_pr_refine(Crystal *cr, const RefList *full,
- PartialityModel pmodel, int verbose)
+ PartialityModel pmodel, int verbose, int serial)
{
int i;
gsl_multimin_fminimizer *min;
@@ -402,7 +403,8 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
residual_f_priv.cr = cr;
residual_f_priv.full = full;
residual_f_priv.rv = rv;
- residual_f_priv.verbose = 1;
+ residual_f_priv.verbose = verbose;
+ residual_f_priv.serial = serial;
f.f = residual_f;
f.n = n_params;
f.params = &residual_f_priv;
@@ -479,14 +481,13 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
static struct prdata pr_refine(Crystal *cr, const RefList *full,
- PartialityModel pmodel)
+ PartialityModel pmodel, int verbose, int serial)
{
- int verbose = 0;
struct prdata prdata;
prdata.refined = 0;
- do_pr_refine(cr, full, pmodel, verbose);
+ do_pr_refine(cr, full, pmodel, verbose, serial);
if ( crystal_get_user_flag(cr) == 0 ) {
prdata.refined = 1;
@@ -501,7 +502,9 @@ struct refine_args
RefList *full;
Crystal *crystal;
PartialityModel pmodel;
+ int serial;
struct prdata prdata;
+ int verbose;
};
@@ -520,7 +523,7 @@ 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->prdata = pr_refine(cr, pargs->full, pargs->pmodel, pargs->verbose, pargs->serial);
}
@@ -533,6 +536,7 @@ static void *get_image(void *vqargs)
memcpy(task, &qargs->task_defaults, sizeof(struct refine_args));
task->crystal = qargs->crystals[qargs->n_started];
+ task->serial = qargs->n_started;
qargs->n_started++;
@@ -552,7 +556,7 @@ static void done_image(void *vqargs, void *task)
void refine_all(Crystal **crystals, int n_crystals,
- RefList *full, int nthreads, PartialityModel pmodel)
+ RefList *full, int nthreads, PartialityModel pmodel, int verbose)
{
struct refine_args task_defaults;
struct queue_args qargs;
@@ -561,6 +565,7 @@ void refine_all(Crystal **crystals, int n_crystals,
task_defaults.crystal = NULL;
task_defaults.pmodel = pmodel;
task_defaults.prdata.refined = 0;
+ task_defaults.verbose = verbose;
qargs.task_defaults = task_defaults;
qargs.n_started = 0;
diff --git a/src/post-refinement.h b/src/post-refinement.h
index 3487ebac..0db2ae42 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -57,7 +57,8 @@ enum prflag
extern const char *str_prflag(enum prflag flag);
extern void refine_all(Crystal **crystals, int n_crystals,
- RefList *full, int nthreads, PartialityModel pmodel);
+ RefList *full, int nthreads, PartialityModel pmodel,
+ int verbose);
/* Exported so it can be poked by tests/pr_p_gradient_check */
extern double gradient(Crystal *cr, int k, Reflection *refl,