ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/hydrodynamics/HydroCmd.c
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/hydrodynamics/HydroCmd.c (file contents):
Revision 2597 by tim, Thu Feb 23 23:16:43 2006 UTC vs.
Revision 2675 by tim, Wed Mar 29 18:09:26 2006 UTC

# Line 35 | Line 35 | cmdline_parser_print_help (void)
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("      --temperature=DOUBLE  temperature of the system\n");
44 <  printf("      --sigma=DOUBLE        diameter of beads(use with rough shell model)\n");
45 <  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 >  printf("  -b, --beads           generate the beads only, hydrodynamics will be \n                          performed  (default=off)\n");
44   }
45  
46  
# Line 70 | Line 68 | cmdline_parser (int argc, char * const *argv, struct g
68    args_info->version_given = 0 ;
69    args_info->input_given = 0 ;
70    args_info->output_given = 0 ;
73  args_info->viscosity_given = 0 ;
74  args_info->temperature_given = 0 ;
75  args_info->sigma_given = 0 ;
71    args_info->model_given = 0 ;
72 +  args_info->beads_given = 0 ;
73   #define clear_args() { \
74    args_info->input_arg = NULL; \
75    args_info->output_arg = gengetopt_strdup("hydro") ;\
76    args_info->model_arg = NULL; \
77 +  args_info->beads_flag = 0;\
78   }
79  
80    clear_args();
# Line 97 | Line 94 | cmdline_parser (int argc, char * const *argv, struct g
94          { "version",    0, NULL, 'V' },
95          { "input",      1, NULL, 'i' },
96          { "output",     1, NULL, 'o' },
100        { "viscosity",  1, NULL, 0 },
101        { "temperature",        1, NULL, 0 },
102        { "sigma",      1, NULL, 0 },
97          { "model",      1, NULL, 0 },
98 +        { "beads",      0, NULL, 'b' },
99          { NULL, 0, NULL, 0 }
100        };
101  
102        stop_char = 0;
103 <      c = getopt_long (argc, argv, "hVi:o:", long_options, &option_index);
103 >      c = getopt_long (argc, argv, "hVi:o:b", long_options, &option_index);
104  
105        if (c == -1) break;       /* Exit from `while (1)' loop.  */
106  
# Line 145 | Line 140 | cmdline_parser (int argc, char * const *argv, struct g
140            args_info->output_arg = gengetopt_strdup (optarg);
141            break;
142  
143 +        case 'b':       /* generate the beads only, hydrodynamics will be performed.  */
144 +          if (args_info->beads_given)
145 +            {
146 +              fprintf (stderr, "%s: `--beads' (`-b') option given more than once\n", CMDLINE_PARSER_PACKAGE);
147 +              clear_args ();
148 +              exit (EXIT_FAILURE);
149 +            }
150 +          args_info->beads_given = 1;
151 +          args_info->beads_flag = !(args_info->beads_flag);
152 +          break;
153  
154 +
155          case 0: /* Long option with no short option */
150          /* viscosity of solvent.  */
151          if (strcmp (long_options[option_index].name, "viscosity") == 0)
152          {
153            if (args_info->viscosity_given)
154              {
155                fprintf (stderr, "%s: `--viscosity' option given more than once\n", CMDLINE_PARSER_PACKAGE);
156                clear_args ();
157                exit (EXIT_FAILURE);
158              }
159            args_info->viscosity_given = 1;
160            args_info->viscosity_arg = strtod (optarg, NULL);
161            break;
162          }
163          
164          /* temperature of the system.  */
165          else if (strcmp (long_options[option_index].name, "temperature") == 0)
166          {
167            if (args_info->temperature_given)
168              {
169                fprintf (stderr, "%s: `--temperature' option given more than once\n", CMDLINE_PARSER_PACKAGE);
170                clear_args ();
171                exit (EXIT_FAILURE);
172              }
173            args_info->temperature_given = 1;
174            args_info->temperature_arg = strtod (optarg, NULL);
175            break;
176          }
177          
178          /* diameter of beads(use with rough shell model).  */
179          else if (strcmp (long_options[option_index].name, "sigma") == 0)
180          {
181            if (args_info->sigma_given)
182              {
183                fprintf (stderr, "%s: `--sigma' option given more than once\n", CMDLINE_PARSER_PACKAGE);
184                clear_args ();
185                exit (EXIT_FAILURE);
186              }
187            args_info->sigma_given = 1;
188            args_info->sigma_arg = strtod (optarg, NULL);
189            break;
190          }
191          
156            /* hydrodynamics model (support RoughShell and BeadModel).  */
157 <          else if (strcmp (long_options[option_index].name, "model") == 0)
157 >          if (strcmp (long_options[option_index].name, "model") == 0)
158            {
159              if (args_info->model_given)
160                {
# Line 220 | Line 184 | cmdline_parser (int argc, char * const *argv, struct g
184        fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE);
185        missing_required_options = 1;
186      }
223  if (! args_info->viscosity_given)
224    {
225      fprintf (stderr, "%s: '--viscosity' option required\n", CMDLINE_PARSER_PACKAGE);
226      missing_required_options = 1;
227    }
228  if (! args_info->temperature_given)
229    {
230      fprintf (stderr, "%s: '--temperature' option required\n", CMDLINE_PARSER_PACKAGE);
231      missing_required_options = 1;
232    }
187    if (! args_info->model_given)
188      {
189        fprintf (stderr, "%s: '--model' option required\n", CMDLINE_PARSER_PACKAGE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines