[MOAB-dev] r4254 - MOAB/trunk/tools/mbzoltan

Tim Tautges tautges at mcs.anl.gov
Fri Nov 5 11:15:52 CDT 2010


Thanks...

- tim

On 11/05/2010 11:13 AM, kraftche at cae.wisc.edu wrote:
> Author: kraftche
> Date: 2010-11-05 11:13:04 -0500 (Fri, 05 Nov 2010)
> New Revision: 4254
>
> Modified:
>     MOAB/trunk/tools/mbzoltan/mbpart.cpp
> Log:
> fix some CL argument parsing bugs
>
> Modified: MOAB/trunk/tools/mbzoltan/mbpart.cpp
> ===================================================================
> --- MOAB/trunk/tools/mbzoltan/mbpart.cpp	2010-11-05 16:01:03 UTC (rev 4253)
> +++ MOAB/trunk/tools/mbzoltan/mbpart.cpp	2010-11-05 16:13:04 UTC (rev 4254)
> @@ -49,17 +49,19 @@
>     Interface&  mb = moab;
>     MBZoltan tool(&mb, false, argc, argv);
>
> -  int num_args = 0;
> +  int num_args = 0; // number of non-flag arguments (e.g. input file, etc.)
>     const char* args[3] = {0}; // non-flag options (num parts, input_file, output_file)
>     const char* zoltan_method = DEFAULT_ZOLTAN_METHOD;
>     const char* other_method = 0;
> -  std::list<const char**>  expected;
> +  const char* imbal_tol_str = 0;
> +  std::list<const char**>  expected; // pointers to strings that should be set to arguments
>     int i, j, part_dim = -1;
>     long num_parts;
>     bool write_sets = true, write_tags = false;
>     bool no_more_flags = false;
>     double imbal_tol = 1.10;
>
> +    // Loop over each input argument
>     for (i = 1; i<  argc; ++i) {
>       if (!expected.empty()) {
>         if (!argv[i][0] || (!no_more_flags&&  argv[i][0] == '-')) {
> @@ -70,6 +72,9 @@
>         expected.pop_front();
>       }
>       else if (!no_more_flags&&  argv[i][0] == '-') {
> +        // Loop over each flag, allowing multiple flags to
> +        // be combined in  a single argument (e.g. "-i 1.0 -b"
> +        // can be specified as "-ib 1.0").
>         for (j = 1; argv[i][j]; ++j) switch (argv[i][j]) {
>           case 'h':
>             help(argv[0]);
> @@ -81,14 +86,20 @@
>             part_dim = argv[i][1] - '0';
>             break;
>           case 'z':
> +          // note that we expect the zotlan_method to point to
> +          // the next non-flag argument we encounter.
>             expected.push_back(&zoltan_method);
>             break;
>           case 'p':
>             zoltan_method = ZOLTAN_PARMETIS_METHOD;
> +          // note that we expect the other_method to point to
> +          // the next non-flag argument we encounter.
>             expected.push_back(&other_method);
>             break;
>           case 'o':
>

-- 
================================================================
"You will keep in perfect peace him whose mind is
   steadfast, because he trusts in you."               Isaiah 26:3

              Tim Tautges            Argonne National Laboratory
          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
          phone: (608) 263-8485      1500 Engineering Dr.
            fax: (608) 263-4499      Madison, WI 53706



More information about the moab-dev mailing list