diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/check_hkl.c | 17 | ||||
-rw-r--r-- | src/cl-utils.c | 87 | ||||
-rw-r--r-- | src/compare_hkl.c | 22 | ||||
-rw-r--r-- | src/get_hkl.c | 22 | ||||
-rw-r--r-- | src/hdfsee.c | 23 | ||||
-rw-r--r-- | src/partial_sim.c | 30 | ||||
-rw-r--r-- | src/partialator.c | 24 | ||||
-rw-r--r-- | src/pattern_sim.c | 34 | ||||
-rw-r--r-- | src/post-refinement.c | 24 | ||||
-rw-r--r-- | src/powder_plot.c | 57 | ||||
-rw-r--r-- | src/render_hkl.c | 58 |
11 files changed, 236 insertions, 162 deletions
diff --git a/src/check_hkl.c b/src/check_hkl.c index 649b86af..4927e60e 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -339,43 +339,44 @@ int main(int argc, char *argv[]) while ((c = getopt_long(argc, argv, "hy:p:", longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 0 : + case 0 : break; - case 2 : + case 2 : if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) { ERROR("Invalid value for --rmin\n"); return 1; } break; - case 3 : + case 3 : if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) { ERROR("Invalid value for --rmax\n"); return 1; } break; - case 4 : + case 4 : if ( sscanf(optarg, "%f", &sigma_cutoff) != 1 ) { ERROR("Invalid value for --sigma-cutoff\n"); return 1; } break; - default : + default : return 1; } diff --git a/src/cl-utils.c b/src/cl-utils.c index ae146ed0..71ff25b5 100644 --- a/src/cl-utils.c +++ b/src/cl-utils.c @@ -46,28 +46,71 @@ const char *clError(cl_int err) { switch ( err ) { - case CL_SUCCESS : return "no error"; - case CL_INVALID_PLATFORM : return "invalid platform"; - case CL_INVALID_KERNEL : return "invalid kernel"; - case CL_INVALID_ARG_INDEX : return "invalid argument index"; - case CL_INVALID_ARG_VALUE : return "invalid argument value"; - case CL_INVALID_MEM_OBJECT : return "invalid memory object"; - case CL_INVALID_SAMPLER : return "invalid sampler"; - case CL_INVALID_ARG_SIZE : return "invalid argument size"; - case CL_INVALID_COMMAND_QUEUE : return "invalid command queue"; - case CL_INVALID_CONTEXT : return "invalid context"; - case CL_INVALID_VALUE : return "invalid value"; - case CL_INVALID_EVENT_WAIT_LIST : return "invalid wait list"; - case CL_MAP_FAILURE : return "map failure"; - case CL_MEM_OBJECT_ALLOCATION_FAILURE : return "object allocation failure"; - case CL_OUT_OF_HOST_MEMORY : return "out of host memory"; - case CL_OUT_OF_RESOURCES : return "out of resources"; - case CL_INVALID_KERNEL_NAME : return "invalid kernel name"; - case CL_INVALID_KERNEL_ARGS : return "invalid kernel arguments"; - case CL_INVALID_WORK_GROUP_SIZE : return "invalid work group size"; - case CL_IMAGE_FORMAT_NOT_SUPPORTED : return "image format not supported"; - case CL_INVALID_WORK_DIMENSION : return "invalid work dimension"; - default : + + case CL_SUCCESS : + return "no error"; + + case CL_INVALID_PLATFORM : + return "invalid platform"; + + case CL_INVALID_KERNEL : + return "invalid kernel"; + + case CL_INVALID_ARG_INDEX : + return "invalid argument index"; + + case CL_INVALID_ARG_VALUE : + return "invalid argument value"; + + case CL_INVALID_MEM_OBJECT : + return "invalid memory object"; + + case CL_INVALID_SAMPLER : + return "invalid sampler"; + + case CL_INVALID_ARG_SIZE : + return "invalid argument size"; + + case CL_INVALID_COMMAND_QUEUE : + return "invalid command queue"; + + case CL_INVALID_CONTEXT : + return "invalid context"; + + case CL_INVALID_VALUE : + return "invalid value"; + + case CL_INVALID_EVENT_WAIT_LIST : + return "invalid wait list"; + + case CL_MAP_FAILURE : + return "map failure"; + + case CL_MEM_OBJECT_ALLOCATION_FAILURE : + return "object allocation failure"; + + case CL_OUT_OF_HOST_MEMORY : + return "out of host memory"; + + case CL_OUT_OF_RESOURCES : + return "out of resources"; + + case CL_INVALID_KERNEL_NAME : + return "invalid kernel name"; + + case CL_INVALID_KERNEL_ARGS : + return "invalid kernel arguments"; + + case CL_INVALID_WORK_GROUP_SIZE : + return "invalid work group size"; + + case CL_IMAGE_FORMAT_NOT_SUPPORTED : + return "image format not supported"; + + case CL_INVALID_WORK_DIMENSION : + return "invalid work dimension"; + + default : return "unknown error"; } } diff --git a/src/compare_hkl.c b/src/compare_hkl.c index 5846682f..b926c3ae 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -331,49 +331,51 @@ int main(int argc, char *argv[]) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'o' : + case 'o' : ratiofile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'u' : + case 'u' : config_unity = 1; break; - case 0 : + case 0 : break; - case 2 : + case 2 : if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) { ERROR("Invalid value for --rmin\n"); return 1; } break; - case 3 : + case 3 : if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) { ERROR("Invalid value for --rmax\n"); return 1; } break; - case 4 : + case 4 : config_shells = get_r_shell(optarg); break; - default : + default : return 1; + } } diff --git a/src/get_hkl.c b/src/get_hkl.c index 9f86f0f7..de5d74de 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -391,44 +391,46 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 't' : + case 't' : template = strdup(optarg); break; - case 'o' : + case 'o' : output = strdup(optarg); break; - case 'i' : + case 'i' : input_file = strdup(optarg); break; - case 'y' : + case 'y' : mero_str = strdup(optarg); break; - case 'w' : + case 'w' : holo_str = strdup(optarg); break; - case 'e' : + case 'e' : expand_str = strdup(optarg); break; - case 2 : + case 2 : adu_per_photon = strtof(optarg, NULL); have_adu_per_photon = 1; break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/hdfsee.c b/src/hdfsee.c index 22302ec8..613572a2 100644 --- a/src/hdfsee.c +++ b/src/hdfsee.c @@ -151,15 +151,16 @@ int main(int argc, char *argv[]) char *test; switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'p' : + case 'p' : peaks = strdup(optarg); break; - case 'i' : + case 'i' : boost = atoi(optarg); if ( boost < 1 ) { ERROR("Intensity boost must be a positive" @@ -168,7 +169,7 @@ int main(int argc, char *argv[]) } break; - case 'b' : + case 'b' : binning = atoi(optarg); if ( binning < 1 ) { ERROR("Binning must be a positive integer.\n"); @@ -176,19 +177,19 @@ int main(int argc, char *argv[]) } break; - case 'c' : + case 'c' : cscale = strdup(optarg); break; - case 'e' : + case 'e' : element = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 2 : + case 2 : ring_size = strtod(optarg, &test); if ( test == optarg ) { ERROR("Ring size must be numerical.\n"); @@ -196,7 +197,7 @@ int main(int argc, char *argv[]) } break; - case 'r' : + case 'r' : config_showrings = 1; reslist = strdup(optarg); int nchar = strlen(reslist); @@ -219,10 +220,10 @@ int main(int argc, char *argv[]) } break; - case 0 : + case 0 : break; - default : + default : return 1; } diff --git a/src/partial_sim.c b/src/partial_sim.c index 39621a6c..6b99864e 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -343,47 +343,48 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'o' : + case 'o' : output_file = strdup(optarg); break; - case 'i' : + case 'i' : input_file = strdup(optarg); break; - case 'b' : + case 'b' : beamfile = strdup(optarg); break; - case 'p' : + case 'p' : cellfile = strdup(optarg); break; - case 'g' : + case 'g' : geomfile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'n' : + case 'n' : n = atoi(optarg); break; - case 'r' : + case 'r' : save_file = strdup(optarg); break; - case 'j' : + case 'j' : n_threads = atoi(optarg); break; - case 'c' : + case 'c' : cnoise = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid cell noise value.\n"); @@ -391,15 +392,16 @@ int main(int argc, char *argv[]) } break; - case 2 : + case 2 : phist_file = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/partialator.c b/src/partialator.c index 91f2ff99..4fa8c2bd 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -325,35 +325,36 @@ int main(int argc, char *argv[]) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'i' : + case 'i' : infile = strdup(optarg); break; - case 'g' : + case 'g' : geomfile = strdup(optarg); break; - case 'j' : + case 'j' : nthreads = atoi(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 'n' : + case 'n' : n_iter = atoi(optarg); break; - case 'b' : + case 'b' : beam = get_beam_parameters(optarg); if ( beam == NULL ) { ERROR("Failed to load beam parameters" @@ -362,15 +363,16 @@ int main(int argc, char *argv[]) } break; - case 'r' : + case 'r' : reference_file = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/pattern_sim.c b/src/pattern_sim.c index c207e0dc..03b009b4 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -294,15 +294,16 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'r' : + case 'r' : config_randomquat = 1; break; - case 'n' : + case 'n' : n_images = strtol(optarg, &rval, 10); if ( *rval != '\0' ) { ERROR("Invalid number of images.\n"); @@ -310,43 +311,43 @@ int main(int argc, char *argv[]) } break; - case 'i' : + case 'i' : intfile = strdup(optarg); break; - case 't' : + case 't' : grad_str = strdup(optarg); break; - case 'p' : + case 'p' : filename = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 'w' : + case 'w' : powder_fn = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 'b' : + case 'b' : beamfile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 2 : + case 2 : gpu_dev = atoi(optarg); break; - case 3 : + case 3 : min_size = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid minimum size.\n"); @@ -355,7 +356,7 @@ int main(int argc, char *argv[]) random_size++; break; - case 4 : + case 4 : max_size = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid maximum size.\n"); @@ -364,11 +365,12 @@ int main(int argc, char *argv[]) random_size++; break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/post-refinement.c b/src/post-refinement.c index cf7b2576..78c47d07 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -241,7 +241,7 @@ static void apply_shift(struct image *image, int k, double shift) { switch ( k ) { - case REF_DIV : + case REF_DIV : if ( isnan(shift) ) { ERROR("NaN divergence shift\n"); } else { @@ -250,23 +250,23 @@ static void apply_shift(struct image *image, int k, double shift) } break; - case REF_R : + case REF_R : image->profile_radius += shift; break; - case REF_ASX : - case REF_ASY : - case REF_ASZ : - case REF_BSX : - case REF_BSY : - case REF_BSZ : - case REF_CSX : - case REF_CSY : - case REF_CSZ : + case REF_ASX : + case REF_ASY : + case REF_ASZ : + case REF_BSX : + case REF_BSY : + case REF_BSZ : + case REF_CSX : + case REF_CSY : + case REF_CSZ : apply_cell_shift(image->indexed_cell, k, shift); break; - default : + default : ERROR("No shift defined for parameter %i\n", k); abort(); diff --git a/src/powder_plot.c b/src/powder_plot.c index 3f49695a..049b9c0e 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -775,51 +775,51 @@ int main(int argc, char *argv[]) switch (c) { - case 'h' : + case 'h' : show_help(argv[0]); return 0; - case 'i' : + case 'i' : filename = strdup(optarg); break; - case 'o' : + case 'o' : output = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 'b' : + case 'b' : beamf = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 's' : + case 's' : hist_info.histsize = atoi(optarg); break; - case 'e' : + case 'e' : element = strdup(optarg); break; - case 1 : + case 1 : hist_info.q_max = atof(optarg); break; - case 2 : + case 2 : hist_info.q_min = atof(optarg); break; - case 3 : + case 3 : if (strcmp(optarg, "linear") == 0 ) { hist_info.spacing = LINEAR; } else if (strcmp(optarg, "wilson") == 0 ) { @@ -832,14 +832,14 @@ int main(int argc, char *argv[]) } break; - case 'd' : + case 'd' : datatype = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; } @@ -1096,45 +1096,50 @@ int main(int argc, char *argv[]) } /* Process reflections based on file type and data type */ - switch (file_type) { - case FILE_H5 : + switch ( file_type ) { + case FILE_H5 : n_patterns++; n_peaks = process_h5(&image, &hist_info, histdata); free(image.data); break; - case FILE_HKL : + case FILE_HKL : n_patterns++; //inc number of patterns used n_peaks = process_hkl(&image, sym, cell, &hist_info, histdata, q_scaling, use_redundancy); break; - case FILE_STREAM : - switch (data_type) { - case PLOT_REFL : + case FILE_STREAM : + switch ( data_type ) { + + case PLOT_REFL : n_peaks = process_stream_reflection(fh, &image, &hist_info, histdata, &n_patterns); break; - case PLOT_HKL : + + case PLOT_HKL : n_peaks = process_stream_hkl(fh, &image, &hist_info, + histdata, cell, &n_patterns); break; - case PLOT_PEAKS : + case PLOT_PEAKS : n_peaks = process_stream_peaks(fh, &image, &hist_info, histdata, &n_patterns, only_indexed); break; - case PLOT_H5 : + + case PLOT_H5 : n_peaks = process_stream_h5(fh, &image, &hist_info, histdata, config_satcorr, only_indexed, &n_patterns, element); break; - default : + + default : break; } fclose(fh); break; - default : + default : break; } diff --git a/src/render_hkl.c b/src/render_hkl.c index a63cbad3..a01e7609 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -118,23 +118,29 @@ static double max_value(RefList *list, int wght, const SymOpList *sym) n = num_equivs(sym, m); switch ( wght ) { - case WGHT_I : + + case WGHT_I : val = get_intensity(refl); break; - case WGHT_SQRTI : + + case WGHT_SQRTI : val = get_intensity(refl); val = (val>0.0) ? sqrt(val) : 0.0; break; - case WGHT_COUNTS : + + case WGHT_COUNTS : val = get_redundancy(refl); val /= (double)n; break; - case WGHT_RAWCOUNTS : + + case WGHT_RAWCOUNTS : val = get_redundancy(refl); break; - default : + + default : ERROR("Invalid weighting.\n"); abort(); + } if ( val > max ) max = val; @@ -192,23 +198,29 @@ static void draw_circles(double xh, double xk, double xl, yi = (h*yh + k*yk + l*yl) / ny; switch ( wght) { - case WGHT_I : + + case WGHT_I : val = get_intensity(refl); break; - case WGHT_SQRTI : + + case WGHT_SQRTI : val = get_intensity(refl); val = (val>0.0) ? sqrt(val) : 0.0; break; - case WGHT_COUNTS : + + case WGHT_COUNTS : val = get_redundancy(refl); val /= (double)n; break; - case WGHT_RAWCOUNTS : + + case WGHT_RAWCOUNTS : val = get_redundancy(refl); break; - default : + + default : ERROR("Invalid weighting.\n"); abort(); + } /* Absolute location in image based on 2D basis */ @@ -621,43 +633,44 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'b' : + case 'b' : boost = atof(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'w' : + case 'w' : weighting = strdup(optarg); break; - case 'c' : + case 'c' : cscale = strdup(optarg); break; - case 'd' : + case 'd' : down = strdup(optarg); break; - case 'r' : + case 'r' : right = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 2 : + case 2 : errno = 0; scale_top = strtod(optarg, &endptr); if ( !( (optarg[0] != '\0') && (endptr[0] == '\0') ) @@ -672,11 +685,12 @@ int main(int argc, char *argv[]) } break; - case 0 : + case 0 : break; - default : + default : return 1; + } } |