--- trunk/src/applications/hydrodynamics/HydroCmd.c 2006/02/23 23:16:43 892 +++ trunk/src/applications/hydrodynamics/HydroCmd.c 2006/03/29 18:09:26 921 @@ -35,14 +35,12 @@ cmdline_parser_print_help (void) printf("\n" "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); printf("\n"); - printf(" -h, --help Print help and exit\n"); - printf(" -V, --version Print version and exit\n"); - printf(" -i, --input=filename input dump file\n"); - printf(" -o, --output=STRING output file prefix (default=`hydro')\n"); - printf(" --viscosity=DOUBLE viscosity of solvent\n"); - printf(" --temperature=DOUBLE temperature of the system\n"); - printf(" --sigma=DOUBLE diameter of beads(use with rough shell model)\n"); - printf(" --model=STRING hydrodynamics model (support RoughShell and \n BeadModel)\n"); + printf(" -h, --help Print help and exit\n"); + printf(" -V, --version Print version and exit\n"); + printf(" -i, --input=filename input dump file\n"); + printf(" -o, --output=STRING output file prefix (default=`hydro')\n"); + printf(" --model=STRING hydrodynamics model (support RoughShell and BeadModel)\n"); + printf(" -b, --beads generate the beads only, hydrodynamics will be \n performed (default=off)\n"); } @@ -70,14 +68,13 @@ cmdline_parser (int argc, char * const *argv, struct g args_info->version_given = 0 ; args_info->input_given = 0 ; args_info->output_given = 0 ; - args_info->viscosity_given = 0 ; - args_info->temperature_given = 0 ; - args_info->sigma_given = 0 ; args_info->model_given = 0 ; + args_info->beads_given = 0 ; #define clear_args() { \ args_info->input_arg = NULL; \ args_info->output_arg = gengetopt_strdup("hydro") ;\ args_info->model_arg = NULL; \ + args_info->beads_flag = 0;\ } clear_args(); @@ -97,15 +94,13 @@ cmdline_parser (int argc, char * const *argv, struct g { "version", 0, NULL, 'V' }, { "input", 1, NULL, 'i' }, { "output", 1, NULL, 'o' }, - { "viscosity", 1, NULL, 0 }, - { "temperature", 1, NULL, 0 }, - { "sigma", 1, NULL, 0 }, { "model", 1, NULL, 0 }, + { "beads", 0, NULL, 'b' }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVi:o:", long_options, &option_index); + c = getopt_long (argc, argv, "hVi:o:b", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -145,52 +140,21 @@ cmdline_parser (int argc, char * const *argv, struct g args_info->output_arg = gengetopt_strdup (optarg); break; + case 'b': /* generate the beads only, hydrodynamics will be performed. */ + if (args_info->beads_given) + { + fprintf (stderr, "%s: `--beads' (`-b') option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->beads_given = 1; + args_info->beads_flag = !(args_info->beads_flag); + break; + case 0: /* Long option with no short option */ - /* viscosity of solvent. */ - if (strcmp (long_options[option_index].name, "viscosity") == 0) - { - if (args_info->viscosity_given) - { - fprintf (stderr, "%s: `--viscosity' option given more than once\n", CMDLINE_PARSER_PACKAGE); - clear_args (); - exit (EXIT_FAILURE); - } - args_info->viscosity_given = 1; - args_info->viscosity_arg = strtod (optarg, NULL); - break; - } - - /* temperature of the system. */ - else if (strcmp (long_options[option_index].name, "temperature") == 0) - { - if (args_info->temperature_given) - { - fprintf (stderr, "%s: `--temperature' option given more than once\n", CMDLINE_PARSER_PACKAGE); - clear_args (); - exit (EXIT_FAILURE); - } - args_info->temperature_given = 1; - args_info->temperature_arg = strtod (optarg, NULL); - break; - } - - /* diameter of beads(use with rough shell model). */ - else if (strcmp (long_options[option_index].name, "sigma") == 0) - { - if (args_info->sigma_given) - { - fprintf (stderr, "%s: `--sigma' option given more than once\n", CMDLINE_PARSER_PACKAGE); - clear_args (); - exit (EXIT_FAILURE); - } - args_info->sigma_given = 1; - args_info->sigma_arg = strtod (optarg, NULL); - break; - } - /* hydrodynamics model (support RoughShell and BeadModel). */ - else if (strcmp (long_options[option_index].name, "model") == 0) + if (strcmp (long_options[option_index].name, "model") == 0) { if (args_info->model_given) { @@ -220,16 +184,6 @@ cmdline_parser (int argc, char * const *argv, struct g fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE); missing_required_options = 1; } - if (! args_info->viscosity_given) - { - fprintf (stderr, "%s: '--viscosity' option required\n", CMDLINE_PARSER_PACKAGE); - missing_required_options = 1; - } - if (! args_info->temperature_given) - { - fprintf (stderr, "%s: '--temperature' option required\n", CMDLINE_PARSER_PACKAGE); - missing_required_options = 1; - } if (! args_info->model_given) { fprintf (stderr, "%s: '--model' option required\n", CMDLINE_PARSER_PACKAGE);