35 |
|
printf("\n" |
36 |
|
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); |
37 |
|
printf("\n"); |
38 |
< |
printf(" -h, --help Print help and exit\n"); |
39 |
< |
printf(" -V, --version Print version and exit\n"); |
40 |
< |
printf(" -i, --input=filename input dump file\n"); |
41 |
< |
printf(" -o, --output=STRING output file prefix (default=`hydro')\n"); |
42 |
< |
printf(" --viscosity=DOUBLE viscosity of solvent\n"); |
43 |
< |
printf(" --sigma=DOUBLE diameter of beads(use with rough shell model)\n"); |
44 |
< |
printf(" --model=STRING hydrodynamics model (support RoughShell and \n BeadModel)\n"); |
38 |
> |
printf(" -h, --help Print help and exit\n"); |
39 |
> |
printf(" -V, --version Print version and exit\n"); |
40 |
> |
printf(" -i, --input=filename input dump file\n"); |
41 |
> |
printf(" -o, --output=STRING output file prefix (default=`hydro')\n"); |
42 |
> |
printf(" --model=STRING hydrodynamics model (support RoughShell and BeadModel)\n"); |
43 |
|
} |
44 |
|
|
45 |
|
|
67 |
|
args_info->version_given = 0 ; |
68 |
|
args_info->input_given = 0 ; |
69 |
|
args_info->output_given = 0 ; |
72 |
– |
args_info->viscosity_given = 0 ; |
73 |
– |
args_info->sigma_given = 0 ; |
70 |
|
args_info->model_given = 0 ; |
71 |
|
#define clear_args() { \ |
72 |
|
args_info->input_arg = NULL; \ |
91 |
|
{ "version", 0, NULL, 'V' }, |
92 |
|
{ "input", 1, NULL, 'i' }, |
93 |
|
{ "output", 1, NULL, 'o' }, |
98 |
– |
{ "viscosity", 1, NULL, 0 }, |
99 |
– |
{ "sigma", 1, NULL, 0 }, |
94 |
|
{ "model", 1, NULL, 0 }, |
95 |
|
{ NULL, 0, NULL, 0 } |
96 |
|
}; |
138 |
|
|
139 |
|
|
140 |
|
case 0: /* Long option with no short option */ |
147 |
– |
/* viscosity of solvent. */ |
148 |
– |
if (strcmp (long_options[option_index].name, "viscosity") == 0) |
149 |
– |
{ |
150 |
– |
if (args_info->viscosity_given) |
151 |
– |
{ |
152 |
– |
fprintf (stderr, "%s: `--viscosity' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
153 |
– |
clear_args (); |
154 |
– |
exit (EXIT_FAILURE); |
155 |
– |
} |
156 |
– |
args_info->viscosity_given = 1; |
157 |
– |
args_info->viscosity_arg = strtod (optarg, NULL); |
158 |
– |
break; |
159 |
– |
} |
160 |
– |
|
161 |
– |
/* diameter of beads(use with rough shell model). */ |
162 |
– |
else if (strcmp (long_options[option_index].name, "sigma") == 0) |
163 |
– |
{ |
164 |
– |
if (args_info->sigma_given) |
165 |
– |
{ |
166 |
– |
fprintf (stderr, "%s: `--sigma' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
167 |
– |
clear_args (); |
168 |
– |
exit (EXIT_FAILURE); |
169 |
– |
} |
170 |
– |
args_info->sigma_given = 1; |
171 |
– |
args_info->sigma_arg = strtod (optarg, NULL); |
172 |
– |
break; |
173 |
– |
} |
174 |
– |
|
141 |
|
/* hydrodynamics model (support RoughShell and BeadModel). */ |
142 |
< |
else if (strcmp (long_options[option_index].name, "model") == 0) |
142 |
> |
if (strcmp (long_options[option_index].name, "model") == 0) |
143 |
|
{ |
144 |
|
if (args_info->model_given) |
145 |
|
{ |
169 |
|
fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE); |
170 |
|
missing_required_options = 1; |
171 |
|
} |
206 |
– |
if (! args_info->viscosity_given) |
207 |
– |
{ |
208 |
– |
fprintf (stderr, "%s: '--viscosity' option required\n", CMDLINE_PARSER_PACKAGE); |
209 |
– |
missing_required_options = 1; |
210 |
– |
} |
172 |
|
if (! args_info->model_given) |
173 |
|
{ |
174 |
|
fprintf (stderr, "%s: '--model' option required\n", CMDLINE_PARSER_PACKAGE); |