schiff

Estimate the radiative properties of soft particless
git clone git://git.meso-star.com/schiff.git
Log | Files | Refs | README | LICENSE

commit 2bfb5407854d613eb01e7a7b7ec5f2de7a9cbcfc
parent 05f060f5c27ff4fe9b690eda69c991dc88593844
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 13 Nov 2015 11:11:11 +0100

Improve the CLI interface and add the -q option

Print an helper message when no optical property FILE is submitted,
excepted if the "-q" option is defined ("q" means for quiet).

Diffstat:
Msrc/schiff_args.c | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/schiff_args.c b/src/schiff_args.c @@ -86,14 +86,16 @@ printf( printf( " -G NUM sampled `NUM' geometries with respect to the defined\n" " distribution, dump their data and exit. The data are written\n" -" to OUTPUT or stdout whether the `-o' option is defined or not,\n" -" respectively. The outputted data followed the Alias Wavefront\n" -" obj file format.\n"); +" to OUTPUT or the standard output whether the `-o' option is\n" +" defined or not, respectively. The outputted data followed the\n" +" Alias Wavefront obj file format.\n"); printf( " -h display this help and exit.\n"); printf( " -o OUTPUT write results to OUTPUT. If not defined, write results to\n" -" stdout.\n"); +" standard output.\n"); + printf( +" -q do not print the helper message when no FILE is submitted.\n"); printf( " -s R:S[:N] the micro organisms are spherical meshes discretized in N\n" " slices along 2PI. By default N is %u. Their radius `r' is\n" @@ -298,12 +300,13 @@ schiff_args_init const int argc, char** argv) { + int quiet = 0; int opt; res_T res = RES_OK; ASSERT(argc && argv && args); *args = SCHIFF_ARGS_NULL; - while((opt = getopt(argc, argv, "c:d:g:G:ho:s:u:w:")) != -1) { + while((opt = getopt(argc, argv, "c:d:g:G:ho:qs:u:w:")) != -1) { switch(opt) { case 'c': res = parse_cylinder_distribution(optarg, args); break; case 'd': res = cstr_to_uint(optarg, &args->ndirs); break; @@ -314,6 +317,7 @@ schiff_args_init schiff_args_release(args); return RES_OK; case 'o': args->output_filename = optarg; break; + case 'q': quiet = 1; break; case 's': res = parse_sphere_distribution(optarg, args); break; case 'u': res = parse_super_shape_distribution(optarg, args); break; case 'w': res = parse_wavelengths(optarg, args); break; @@ -347,6 +351,10 @@ schiff_args_init } if(optind == argc) { + if(!quiet) { + fprintf(stderr, + "Enter the optical properties. Type ^D (i.e. CTRL+d) to stop:\n"); + } res = schiff_optical_properties_load_stream(&args->properties, stdin, "stdin"); } else { res = schiff_optical_properties_load(&args->properties, argv[optind]);