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/xgandalf.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/xgandalf.c')
-rw-r--r-- | libcrystfel/src/indexers/xgandalf.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/libcrystfel/src/indexers/xgandalf.c b/libcrystfel/src/indexers/xgandalf.c index 2d2dca48..3a44bf04 100644 --- a/libcrystfel/src/indexers/xgandalf.c +++ b/libcrystfel/src/indexers/xgandalf.c @@ -382,23 +382,37 @@ static void xgandalf_show_help() } +int xgandalf_default_options(XGandalfOptions **opts_ptr) +{ + XGandalfOptions *opts; + + opts = malloc(sizeof(struct xgandalf_options)); + if ( opts == NULL ) return ENOMEM; + + opts->sampling_pitch = 6; + opts->grad_desc_iterations = 4; + opts->tolerance = 0.02; + opts->no_deviation_from_provided_cell = 0; + opts->minLatticeVectorLength_A = 30; + opts->maxLatticeVectorLength_A = 250; + opts->maxPeaksForIndexing = 250; + + *opts_ptr = opts; + return 0; +} + + static error_t xgandalf_parse_arg(int key, char *arg, struct argp_state *state) { struct xgandalf_options **opts_ptr = state->input; + int r; switch ( key ) { case ARGP_KEY_INIT : - *opts_ptr = malloc(sizeof(struct xgandalf_options)); - if ( *opts_ptr == NULL ) return ENOMEM; - (*opts_ptr)->sampling_pitch = 6; - (*opts_ptr)->grad_desc_iterations = 4; - (*opts_ptr)->tolerance = 0.02; - (*opts_ptr)->no_deviation_from_provided_cell = 0; - (*opts_ptr)->minLatticeVectorLength_A = 30; - (*opts_ptr)->maxLatticeVectorLength_A = 250; - (*opts_ptr)->maxPeaksForIndexing = 250; + r = xgandalf_default_options(opts_ptr); + if ( r ) return r; break; case 1 : |