From 5739d122831f5726b67cbfa6427ab0a6dc092798 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 30 Nov 2009 14:23:39 +0100 Subject: Add --no-images option (and clean up --help) --- src/pattern_sim.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/pattern_sim.c') diff --git a/src/pattern_sim.c b/src/pattern_sim.c index e3c5ec8a..bdca6462 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -30,17 +30,20 @@ static void show_help(const char *s) { - printf("Syntax: %s\n\n", s); + printf("Syntax: %s [options]\n\n", s); printf( "Simulate diffraction patterns from small crystals probed with femosecond\n" "pulses of X-rays from a free electron laser.\n" "\n" -" -h, --help Display this help message\n" -" --simulation-details Show technical details of the simulation\n" -" --near-bragg Output h,k,l,I near Bragg conditions\n" +" -h, --help Display this help message.\n" +" --simulation-details Show technical details of the simulation.\n" +"\n" +" --near-bragg Output h,k,l,I near Bragg conditions.\n" +" -n, --number= Generate N images. Default 1.\n" +" --no-images Do not output any HDF5 files.\n" " -r, --random-orientation Use a randomly generated orientation\n" -" (a new orientation will be used for each image)\n" -" -n, --number= Generate N images. Default 1\n"); +" (a new orientation will be used for each image).\n" +); } @@ -133,10 +136,10 @@ int main(int argc, char *argv[]) { int c; struct image image; - char filename[1024]; int config_simdetails = 0; int config_nearbragg = 0; int config_randomquat = 0; + int config_noimages = 0; int number = 1; /* Index for the current image */ int n_images = 1; /* Generate one image by default */ int done = 0; @@ -148,6 +151,7 @@ int main(int argc, char *argv[]) {"near-bragg", 0, &config_nearbragg, 1}, {"random-orientation", 0, NULL, 'r'}, {"number", 1, NULL, 'n'}, + {"no-images", 0, &config_noimages, 1}, {0, 0, NULL, 0} }; @@ -229,11 +233,18 @@ int main(int argc, char *argv[]) output_intensities(&image); } - snprintf(filename, 1023, "results/sim-%i.h5", number); - number++; + if ( !config_noimages ) { + + char filename[1024]; + + snprintf(filename, 1023, "results/sim-%i.h5", number); + number++; - /* Write the output file */ - hdf5_write(filename, image.data, image.width, image.height); + /* Write the output file */ + hdf5_write(filename, image.data, + image.width, image.height); + + } /* Clean up */ free(image.data); -- cgit v1.2.3