diff options
author | Thomas White <taw@physics.org> | 2020-08-20 11:16:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-08-20 11:16:15 +0200 |
commit | d9e011c9e3f877ed95482fd54a549c065ff9b8be (patch) | |
tree | 2983933be34814995b449fe78362bf4ea180e5b1 /libcrystfel/src/indexers/pinkindexer.c | |
parent | a0e9410fae73b1c91e21f8748a39164691895c6f (diff) |
Add default_method_options()
This allows the indexing method private options structures to be set up
easily.
Diffstat (limited to 'libcrystfel/src/indexers/pinkindexer.c')
-rw-r--r-- | libcrystfel/src/indexers/pinkindexer.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/libcrystfel/src/indexers/pinkindexer.c b/libcrystfel/src/indexers/pinkindexer.c index 3d23e158..ac4a42d2 100644 --- a/libcrystfel/src/indexers/pinkindexer.c +++ b/libcrystfel/src/indexers/pinkindexer.c @@ -475,30 +475,44 @@ static void pinkIndexer_show_help() } +int pinkIndexer_default_options(PinkIndexerOptions **opts_ptr) +{ + PinkIndexerOptions *opts; + + opts = malloc(sizeof(struct pinkIndexer_options)); + if ( opts == NULL ) return ENOMEM; + + opts->considered_peaks_count = 4; + opts->angle_resolution = 2; + opts->refinement_type = 1; + opts->tolerance = 0.06; + opts->maxResolutionForIndexing_1_per_A = +INFINITY; + opts->thread_count = 1; + opts->multi = 0; + opts->no_check_indexed = 0; + opts->min_peaks = 2; + opts->reflectionRadius = -1; + opts->customPhotonEnergy = -1; + opts->customBandwidth = -1; + opts->maxRefinementDisbalance = 0.4; + + *opts_ptr = opts; + return 0; +} + + static error_t pinkindexer_parse_arg(int key, char *arg, struct argp_state *state) { float tmp, tmp2; + int r; struct pinkIndexer_options **opts_ptr = state->input; switch ( key ) { case ARGP_KEY_INIT : - *opts_ptr = malloc(sizeof(struct pinkIndexer_options)); - if ( *opts_ptr == NULL ) return ENOMEM; - (*opts_ptr)->considered_peaks_count = 4; - (*opts_ptr)->angle_resolution = 2; - (*opts_ptr)->refinement_type = 1; - (*opts_ptr)->tolerance = 0.06; - (*opts_ptr)->maxResolutionForIndexing_1_per_A = +INFINITY; - (*opts_ptr)->thread_count = 1; - (*opts_ptr)->multi = 0; - (*opts_ptr)->no_check_indexed = 0; - (*opts_ptr)->min_peaks = 2; - (*opts_ptr)->reflectionRadius = -1; - (*opts_ptr)->customPhotonEnergy = -1; - (*opts_ptr)->customBandwidth = -1; - (*opts_ptr)->maxRefinementDisbalance = 0.4; + r = pinkIndexer_default_options(opts_ptr); + if ( r ) return r; break; case 1 : |