当前位置: 首页>>代码示例>>C++>>正文


C++ AnyOption::setFlag方法代码示例

本文整理汇总了C++中AnyOption::setFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ AnyOption::setFlag方法的具体用法?C++ AnyOption::setFlag怎么用?C++ AnyOption::setFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnyOption的用法示例。


在下文中一共展示了AnyOption::setFlag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: flag

/// parse the command line options for the program
AnyOption *parseOptions (int argc, char *argv[], algorithm_t &algorithm) {
        AnyOption *opt = new AnyOption;

        /* parse command line options */
        opt->setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt->setOption ("loglevel", 'l');
        opt->setOption ("sort", 's');
        opt->setFlag ("x", 'x'); /* special debugging flag */
        opt->setOption ("restart", 'r');
        opt->setOption ("oaconfig", 'c');    /* file that specifies the design */
        opt->setOption ("output", 'o');      /* prefix for output files */
        opt->setFlag ("generate", 'g');      /* only generate extensions, do not perform LMC check */
        opt->setFlag ("coptions");           /* print compile time options */
        opt->setOption ("format", 'f');      /* format to write to */
        opt->setOption ("mode", 'm');        /* algorithm method */
        opt->setOption ("maxk", 'K');        /* max number of columns to extend to */
        opt->setOption ("rowsymmetry", 'R'); /* max number of columns to extend to */

        opt->setFlag ("streaming"); /* operate in streaming mode */

        opt->setOption ("initcolprev", 'I'); /* algorithm method */

        opt->addUsage ("Orthonal Arrays: extend orthogonal arrays");
#ifdef OAEXTEND_SINGLECORE
        opt->addUsage ("Usage: oaextendmpi [OPTIONS]");
#else
        opt->addUsage ("Usage: oaextendsingle [OPTIONS]");
#endif

        opt->addUsage ("");
        opt->addUsage (" -h  --help  			Prints this help ");
        opt->addUsage (" --coptions			Show compile time options used ");
        opt->addUsage (" -r [FILE]  --restart [FILE]	Restart with results file ");
        opt->addUsage (" -l [LEVEL] --loglevel [LEVEL]	Set loglevel to number ");
        opt->addUsage (" -s [INTEGER] --sort [INTEGER]	Sort input and output arrays (default: 1) ");
        opt->addUsage (" -c [FILE]  --oaconfig [FILE]	Set file with design specification");
        opt->addUsage (" -g  --generate [FILE]		Only generate arrays, do not perform LMC check");
        opt->addUsage ("  --rowsymmetry [VALUE]		Use row symmetry in generation");
        opt->addUsage (" -o [STR]  --output [FILE]	Set prefix for output (default: result) ");
        opt->addUsage (" -f [FORMAT]			Output format (default: TEXT, or BINARY, D, Z). Format D is "
                       "binary difference, format Z is binary with zero-difference ");
        opt->addUsage (" --initcolprev [INTEGER]	Initialization method of new column (default: 1)");
        opt->addUsage (
            " --maxk [INTEGER] Maximum number of columns to exten to (default: extracted from config file) ");
        opt->addUsage (
            " --streaming			Operate in streaming mode. Generated arrays will be written to disk "
            "immediately. ");

        std::string ss = printfstring (" -m [MODE]			Algorithm (") + algorithm_t_list () + ")\n";
        opt->addUsage (ss.c_str ());
        // opt->printUsage();
        opt->addUsage ("");
        opt->addUsage ("Example: ./oaextendsingle -l 2");

        opt->processCommandArgs (argc, argv);

        if (opt->getValue ("mode") != NULL || opt->getValue ('m') != NULL) {
                int vv = atoi (opt->getValue ('m')); // set custom loglevel
                algorithm = (algorithm_t)vv;
        } else {
                algorithm = MODE_AUTOSELECT;
        }

        return opt;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:66,代码来源:oaextend.cpp

示例2: main

int main(int argc, char * argv[], MPI_Comm commWorld)
{
#else
int main(int argc, char * argv[])
{
 MPI_Comm commWorld;
#endif

  std::string fileName;
  int reduceDM    =  10;
  int reduceS=  1;
#ifndef PARTICLESRENDERER
  std::string fullScreenMode    = "";
  bool stereo     = false;
#endif
  int nmaxsample = 200000;
  std::string display;

  bool inSitu = false;
  bool quickSync = true;
  int sleeptime = 1;

  {
    AnyOption opt;

#define ADDUSAGE(line) {{std::stringstream oss; oss << line; opt.addUsage(oss.str());}}

    ADDUSAGE(" ");
    ADDUSAGE("Usage:");
    ADDUSAGE(" ");
    ADDUSAGE(" -h  --help             Prints this help ");
    ADDUSAGE(" -i  --infile #         Input snapshot filename ");
    ADDUSAGE(" -I  --insitu          Enable in-situ rendering ");
    ADDUSAGE("     --sleep  #        start up sleep in sec [1]  ");
    ADDUSAGE("     --noquicksync      disable syncing with simulation [enabled] ");
    ADDUSAGE("     --reduceDM    #    cut down DM dataset by # factor [10]. 0-disable DM");
    ADDUSAGE("     --reduceS     #    cut down stars dataset by # factor [1]. 0-disable S");
#ifndef PARTICLESRENDERER
    ADDUSAGE("     --fullscreen  #    set fullscreen mode string");
    ADDUSAGE("     --stereo           enable stereo rendering");
#endif
    ADDUSAGE(" -s  --nmaxsample   #   set max number of samples for DD [" << nmaxsample << "]");
    ADDUSAGE(" -D  --display      #   set DISPLAY=display, otherwise inherited from environment");


    opt.setFlag  ( "help" ,        'h');
    opt.setOption( "infile",       'i');
    opt.setFlag  ( "insitu",       'I');
    opt.setOption( "reduceDM");
    opt.setOption( "sleep");
    opt.setOption( "reduceS");
    opt.setOption( "fullscreen");
    opt.setFlag("stereo");
    opt.setOption("nmaxsample", 's');
    opt.setOption("display", 'D');
    opt.setFlag  ( "noquicksync");

    opt.processCommandArgs( argc, argv );


    if( ! opt.hasOptions() ||  opt.getFlag( "help" ) || opt.getFlag( 'h' ) )
    {
      /* print usage if no options or requested help */
      opt.printUsage();
      ::exit(0);
    }

    char *optarg = NULL;
    if (opt.getFlag("insitu"))  inSitu = true;
    if ((optarg = opt.getValue("infile")))       fileName           = std::string(optarg);
    if ((optarg = opt.getValue("reduceDM"))) reduceDM       = atoi(optarg);
    if ((optarg = opt.getValue("reduceS"))) reduceS       = atoi(optarg);
#ifndef PARTICLESRENDERER
    if ((optarg = opt.getValue("fullscreen")))	 fullScreenMode     = std::string(optarg);
    if (opt.getFlag("stereo"))  stereo = true;
#endif
    if ((optarg = opt.getValue("nmaxsample"))) nmaxsample = atoi(optarg);
    if ((optarg = opt.getValue("display"))) display = std::string(optarg);
    if ((optarg = opt.getValue("sleep"))) sleeptime = atoi(optarg);
    if (opt.getValue("noquicksync")) quickSync = false;

    if ((fileName.empty() && !inSitu) ||
        reduceDM < 0 || reduceS < 0)
    {
      opt.printUsage();
      ::exit(0);
    }

#undef ADDUSAGE
  }

  MPI_Comm comm = MPI_COMM_WORLD;
  int mpiInitialized = 0;
  MPI_Initialized(&mpiInitialized);
  if (!mpiInitialized)
    MPI_Init(&argc, &argv);
  else
    comm = commWorld;

  int nranks, rank;
//.........这里部分代码省略.........
开发者ID:treecode,项目名称:Bonsai,代码行数:101,代码来源:main.cpp

示例3: main

int main(int argc, char** argv)
#endif
/*
#else
int WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
#endif
*/
{
	string datapath;

	AnyOption *opt = new AnyOption();
	
    opt->addUsage( "" );
    opt->addUsage( "Usage: " );
    opt->addUsage( "" );
    opt->addUsage( " -h  --help  				Prints this help " );
    opt->addUsage( " -d  --data-path /dir		Data files path " );
    opt->addUsage( "" );

	opt->setFlag(  "help", 'h' );
	opt->setOption(  "data-path", 'd' );

	opt->processCommandArgs( argc, argv );

    if( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) 
	{
    	GWDBG_OUTPUT("Usage")
        opt->printUsage();
		delete opt;
		return 0;
	}
	if( opt->getValue( 'd' ) != NULL  || opt->getValue( "data-size" ) != NULL  )
		datapath = opt->getValue('d');

	delete opt;

    try
    {
#ifdef GP2X
        GW_PlatformGP2X platform;
#elif defined(GW_PLAT_PANDORA)
        GW_PlatformPandora platform;
#elif defined(GW_PLAT_S60)
        GW_PlatformS60 platform;
#elif defined(GW_PLAT_WIZ)
        GW_PlatformWIZ platform;
#elif defined(GW_PLAT_ANDROID)
        GW_PlatformAndroid platform;
#elif defined(GW_PLAT_IOS)
        GW_PlatformIOS platform;
#else
        GW_PlatformSDL platform(640, 480);
#endif
		if (!datapath.empty())
			platform.datapath_set(datapath);

        platform.initialize();

        GW_GameList gamelist(&platform);

        GW_Menu menu(&platform, &gamelist);
        menu.Run();

        platform.finalize();
    } catch (GW_Exception &e) {
    	GWDBG_OUTPUT(e.what().c_str())
        fprintf(stderr, "%s\n", e.what().c_str());
        return 1;
    }

    return 0;
}
开发者ID:RangelReale,项目名称:gameandwatch,代码行数:76,代码来源:gamewatch.cpp

示例4: parsecmd

/**
	Utilizing AnyOption class, take the command line and parse it for valid options. Handle usage printout as well.
	@param argc argc from main()
	@param char**argv array of char* directly from main()
	@returns If an error occurs, return false. Currently no errors. Always returns true.
 */
bool parsecmd(int argc, char**argv)
{
    stringstream str;
    // Setup all default values if not already set by simple strings and values above.

    if (getenv("WEBRTC_SERVER"))
        mainserver = xGetDefaultServerName();

    if (getenv("WEBRTC_CONNECT"))
    {
        stunserver = "STUN ";
        stunserver += xGetPeerConnectionString();
    }
    
    peername = xGetPeerName();
    
	AnyOption *opt = new AnyOption();

	opt->addUsage("Usage: ");
	opt->addUsage("");
	opt->addUsage(" -h  --help                    Prints this help ");
    opt->addUsage(" --server <servername|IP>[:<serverport>]      Main sever and optional port.");
	opt->addUsage(
			" --stun <stunserver|IP>[:<port>]      STUN server (and optionally port).\n   Default is " STUNSERVER_DEFAULT);
	opt->addUsage(
			" --peername <Name>     Use this name as my client/peer name online.");
	opt->addUsage("");
    opt->addUsage("Environment variables can be used as defaults as well.");
    opt->addUsage("  WEBRTC_SERVER - Main server name.");
    opt->addUsage("  WEBRTC_CONNECT - STUN server name with port.");
    opt->addUsage("  USERNAME - Peer user name.");
	opt->addUsage("");

	opt->setFlag("help", 'h');
	opt->setOption("server");
	opt->setOption("stun");
	opt->setOption("peername");

	opt->processCommandArgs(argc, argv);

	/* 6. GET THE VALUES */
	if (opt->getFlag("help") || opt->getFlag('h'))
	{
		opt->printUsage();
		exit(1);
	}

    if (opt->getValue("server"))
    {
        cout << "New main server is " << opt->getValue("server") << endl;
        
        string serverloc = opt->getValue("server");
        size_t colonpos = serverloc.find(':');
        mainserver = serverloc.substr(0,colonpos);
        
        if(colonpos != string::npos)
        {
            stringstream sstrm;
            sstrm << serverloc.substr(colonpos+1);
            sstrm >> mainserver_port;
        }
开发者ID:Bayerner,项目名称:webrtc_plugin,代码行数:67,代码来源:parsecmd.cpp

示例5: AnyOption


//.........这里部分代码省略.........
  opt->addUsage( "                          requested in the propagation. Note that underscores" );
  opt->addUsage( "                          are necessary to separate the numbers." );
  opt->addUsage( "                          Note also that these are requested ranges;" );
  opt->addUsage( "                          however the left-closest profile available" );
  opt->addUsage( "                          in the .env file will actually be used; " );
  opt->addUsage( "                          for instance we request the profile at 300 km " );
  opt->addUsage( "                          but in the .env file the left-closest profile" );
  opt->addUsage( "                          may be available at 290 km and it is the one used." );
  opt->addUsage( "    Example: >>  ../bin/ModessRD2WCM --atmosfile g2sgcp2011012606L.jordan.env ");
  opt->addUsage( "                 --atmosfileorder zuvwtdp --azimuth 90 --freq 0.01 ");
  opt->addUsage( "                 --use_profiles_ranges_km 100_200_250 --maxrange_km 500 ");
  opt->addUsage( "" ); 
  opt->addUsage( " --use_profiles_at_steps_km" );
  opt->addUsage( "                          e.g. --use_profiles_at_steps_km 100" );
  opt->addUsage( "                          The profiles are requested at equidistant intervals " );
  opt->addUsage( "                          specified by this option [1000]" );
  opt->addUsage( "" );
  opt->addUsage( " --use_1D_profiles_from_dir" );
  opt->addUsage( "                          e.g. --use_1D_profiles_from_dir myprofiles" );
  opt->addUsage( "                          This option allows to use the ascii profiles stored in" );
  opt->addUsage( "                          the specified directory. The profiles must have names" );
  opt->addUsage( "                          'profiles0001', 'profiles0002', etc. and will be" );
  opt->addUsage( "                          used in alphabetical order at the provided ranges" );
  opt->addUsage( "                          e.g. in conjunction with either" );
  opt->addUsage( "                          option  '--use_profile_ranges_km' " );
  opt->addUsage( "                          or option '--use_profiles_at_steps_km'" );
  opt->addUsage( "                          If there are more requested ranges than existing" );
  opt->addUsage( "                          profiles then the last profile is used repeatedly" );
  opt->addUsage( "                          as necessary." );  
  opt->addUsage( "    Example: >> ../bin/ModessRD2WCM --atmosfileorder zuvwtdp --skiplines 1" );
  opt->addUsage( "                --azimuth 90 --freq 0.1 --use_1D_profiles_from_dir myprofiles" );
  opt->addUsage( "                --use_profile_ranges_km 0_100_300_500 " );                        
  opt->addUsage( "" );  
  opt->addUsage( "FLAGS (no value required):" );
  opt->addUsage( " --write_2D_TLoss         Outputs the 2D transmission loss to" );
  opt->addUsage( "                          default file: tloss_rd2wcm_2d.nm" );	
  opt->addUsage( "" );
  opt->addUsage( "" );
  opt->addUsage( " The format of the output files are as follows (column order):" );
  opt->addUsage( "  tloss_rd2wcm_1d.nm:           r, 4*PI*Re(P), 4*PI*Im(P), (incoherent TL)" );
  opt->addUsage( "  tloss_rd2wcm_1d.lossless.nm:" );
  opt->addUsage( "  tloss_rd2wcm_2d.nm:           r, z, 4*PI*Re(P), 4*PI*Im(P)" );   
  opt->addUsage( "" );
  opt->addUsage( "  Examples to run (in the 'samples' directory):" );
  opt->addUsage( "" );
  opt->addUsage( "    ../bin/ModessRD2WCM --use_1D_profiles_from_dir profiles --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --use_profile_ranges_km 0_100_200_300 --maxrange_km 500" );
  opt->addUsage( "" );  
  opt->addUsage( "    ../bin/ModessRD2WCM --g2senvfile g2sgcp2011012606L.jordan.env --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --use_profile_ranges_km 0_100_200_250 --maxrange_km 500" );
  opt->addUsage( "" );
  opt->addUsage( "    ../bin/ModessRD2WCM --use_1D_profiles_from_dir profiles --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --maxrange_km 500" );
  opt->addUsage( "" ); 
  opt->addUsage( "    Note: if options --use_profile_ranges_km/--use_profiles_at_steps_km are not used then we fall back on the range-independent case using the first available atm. profile." );
  opt->addUsage( "" );

  // Set up the actual flags, etc.
  opt->setFlag( "help", 'h' );
  opt->setFlag( "write_2D_TLoss" );
  opt->setFlag( "plot" );

  opt->setOption( "atmosfile" );
  opt->setOption( "atmosfileorder" );
  opt->setOption( "g2senvfile" );
  opt->setOption( "wind_units" );  
  opt->setOption( "use_1D_profiles_from_dir" );
  opt->setOption( "slicefile" );  
  opt->setOption( "skiplines" );		
  opt->setOption( "azimuth" );
  opt->setOption( "freq" );
  opt->setOption( "maxrange_km" );
  opt->setOption( "sourceheight_km" );
  opt->setOption( "receiverheight_km" );
  opt->setOption( "maxheight_km" );
  opt->setOption( "zground_km" );  
  opt->setOption( "stepsize" );
  opt->setOption( "Nz_grid" );
  opt->setOption( "Nrng_steps" );
  opt->setOption( "ground_impedance_model" );
  opt->setOption( "Lamb_wave_BC" );
  opt->setOption( "use_profile_ranges_km" ); 
  opt->setOption( "use_profiles_at_steps_km" );
  opt->setOption( "use_attn_file" );

  // Process the command-line arguments
  opt->processFile( "./ModessRD2WCM.options" );
  opt->processCommandArgs( argc, argv );

  if( ! opt->hasOptions()) { // print usage if no options
		  opt->printUsage();
		  delete opt;
		  exit( 1 );
  }

  // Check to see if help text was requested
  if ( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) {
	  opt->printUsage();
	  exit( 1 );
  }

  return opt;
}
开发者ID:chetzer-ncpa,项目名称:ncpaprop,代码行数:101,代码来源:ModessRDCM_main.cpp

示例6: main

/**
 * @brief Filter arrays in a file and write filtered arrays to output file
 * @param argc Number of command line arguments
 * @param argv Command line arguments
 * @return
 */
int main (int argc, char *argv[]) {
        AnyOption opt;

        /* parse command line options */
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("output", 'o');
        opt.setOption ("verbose", 'v');
        opt.setOption ("na", 'a');
        opt.setOption ("index", 'i');
        opt.setOption ("format", 'f');

        opt.addUsage ("Orthonal Array Filter: filter arrays");
        opt.addUsage ("Usage: oaanalyse [OPTIONS] [INPUTFILE] [VALUESFILE] [THRESHOLD] [OUTPUTFILE]");
        opt.addUsage ("  The VALUESFILE is a binary file with k*N double values. Here N is the number of arrays");
        opt.addUsage ("  and k the number of analysis values.");

        opt.addUsage ("");
        opt.addUsage (" -h --help  			Prints this help ");
        opt.addUsage (" -v --verbose  			Verbose level (default: 1) ");
        opt.addUsage (" -a 		 			Number of values in analysis file (default: 1) ");
        opt.addUsage (" --index 		 		Index of value to compare (default: 0) ");
        opt.addUsage (" -f [FORMAT]					Output format (default: TEXT, or BINARY; B) ");
        opt.processCommandArgs (argc, argv);

        print_copyright ();

        /* parse options */
        if (opt.getFlag ("help") || opt.getFlag ('h') || opt.getArgc () < 4) {
                opt.printUsage ();
                exit (0);
        }
        int verbose = opt.getIntValue ('v', 1);
        int na = opt.getIntValue ('a', 1);
        int index = opt.getIntValue ("index", 0);

        std::string format = opt.getStringValue ('f', "BINARY");
        arrayfile::arrayfilemode_t mode = arrayfile_t::parseModeString (format);

        /* read in the arrays */
        std::string infile = opt.getArgv (0);
        std::string anafile = opt.getArgv (1);
        double threshold = atof (opt.getArgv (2));
        std::string outfile = opt.getArgv (3);

        if (verbose)
                printf ("oafilter: input %s, threshold %f (analysisfile %d values, index %d)\n", infile.c_str (),
                        threshold, na, index);

        arraylist_t *arraylist = new arraylist_t;
        int n = readarrayfile (opt.getArgv (0), arraylist);

        if (verbose)
                printf ("oafilter: filtering %d arrays\n", n);

        // read analysis file
        FILE *afid = fopen (anafile.c_str (), "rb");
        if (afid == 0) {
                printf ("   could not read analysisfile %s\n", anafile.c_str ());
                exit (0);
        }

        double *a = new double[n * na];
        fread (a, sizeof (double), n * na, afid);
        fclose (afid);

        std::vector< int > gidx;
        ;
        for (int jj = 0; jj < n; jj++) {
                double val = a[jj * na + index];
                if (val >= threshold)
                        gidx.push_back (jj);
                if (verbose >= 2)
                        printf ("jj %d: val %f, threshold %f\n", val >= threshold, val, threshold);
        }

        // filter
        arraylist_t *filtered = new arraylist_t;
        selectArrays (*arraylist, gidx, *filtered);

        /* write arrays to file */
        if (verbose)
                cout << "Writing " << filtered->size () << " arrays (input " << arraylist->size () << ") to file "
                     << outfile << endl;
        writearrayfile (outfile.c_str (), *filtered, mode);

        /* free allocated structures */
        delete[] a;
        delete arraylist;
        delete filtered;

        return 0;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:98,代码来源:oafilter.cpp

示例7: AnyOption


//.........这里部分代码省略.........
  opt->addUsage( "                |  a 2D (width_km x height_km) grid   |" );
  opt->addUsage( "                |          'ntsteps' times            |" );
  opt->addUsage( "                |      every 'tmstep' seconds         |" );
  opt->addUsage( "                |                                     |" );  
  opt->addUsage( "                |                                     |" );	
  opt->addUsage( "   -------------x------------------------------------------------" );	
  opt->addUsage( "              R_start_km" );
  opt->addUsage( "" );
  opt->addUsage(" Additional parameters:" );
  opt->addUsage( " --R_start_km       The grid (viewing window) starts at R_start_km" );
  opt->addUsage( " --width_km         Grid width" );
  opt->addUsage( " --max_celerity     Reference speed [m/s]; in conjunction with R_start_km");
  opt->addUsage( "                    it is determining where inside the grid the field is at");
  opt->addUsage( "                    a time step; a value smaller than the speed of sound");
  opt->addUsage( "                    at the ground is suggested." );
  opt->addUsage( " --tmstep           2D pressure field is calculated at this specified time step." );
  opt->addUsage( " --ntsteps          Number of times the 2D pressure field is calculated");
  opt->addUsage( "                    'tmstep' seconds apart." );
  opt->addUsage( "" );
  opt->addUsage( " OPTIONAL [defaults]:" );
  opt->addUsage( " --height_km        The height of the 2D grid. [maximum height]" );
  opt->addUsage( " --frame_file_stub  Each 2D grid is saved into a file with the name");
  opt->addUsage( "                    frame_file_stub_<time_of_start>; Default:[Pressure2D]." );
  opt->addUsage( "" );
  opt->addUsage( " Example: >> ../bin/ModBB --pulse_prop_grid mydispersionFolder --R_start_km 220 --width_km 50 --height_km 25 --max_celerity 300 --tmstep 30 --ntsteps 5 --frame_file_stub myPressure --use_builtin_pulse" );  
  opt->addUsage( "" );
*/
  

    


  // Set up the actual flags, etc.
  opt->setFlag( "help", 'h' );
  opt->setFlag( "use_modess" );
  opt->setFlag( "use_wmod" );
  opt->setFlag( "get_impulse_resp" );
  opt->setFlag( "use_builtin_pulse1" );
  opt->setFlag( "use_builtin_pulse2" );
  opt->setFlag( "turnoff_WKB");
  opt->setFlag( "plot");
  opt->setFlag( "use_zero_attn");
  opt->setFlag( "wvnum_filter");
  
  opt->setOption( "atmosfile" );
  opt->setOption( "atmosfileorder" );
  opt->setOption( "wind_units" );
  opt->setOption( "skiplines" );		
  opt->setOption( "azimuth" );
  opt->setOption( "maxrange_km" );
  opt->setOption( "sourceheight_km" );
  opt->setOption( "receiverheight_km" );
  opt->setOption( "maxheight_km" );
  opt->setOption( "zground_km" );  
  opt->setOption( "stepsize" );
  opt->setOption( "Nz_grid" );
  opt->setOption( "Nrng_steps" );
  opt->setOption( "out_TL_2D" );
  opt->setOption( "ground_impedance_model" );
  opt->setOption( "Lamb_wave_BC" );
  opt->setOption( "f_min" );
  opt->setOption( "f_step" );	
  opt->setOption( "f_max" );
  opt->setOption( "f_center" );
  opt->setOption( "pulse_prop_grid" );
  opt->setOption( "pulse_prop_src2rcv" );
开发者ID:chetzer-ncpa,项目名称:ncpaprop,代码行数:67,代码来源:ModBB_main.cpp

示例8: main

int main(int argc, char **argv){
	// nekonstantni nastaveni generatoru nahodnych cisel
	srand((unsigned int)time(0));
	// server cast
	clock_t t1, t2;
	t1 = clock();	

	int NP = 50;
	double F = 0.7; 
	double CR = 0.6; 
	int Generations = 10; 
	int pocet_neuronu = 5; 
	char *nejlepsi_jedinec = "nejlepsi_jedinec.txt";
	char *data = "data.txt";
	int tichy = 0;

	// parsovani parametru
	AnyOption *opt = new AnyOption();
	opt->setVerbose(); /* print warnings about unknown options */
    opt->autoUsagePrint(true); /* print usage for bad options */

	opt->addUsage( "" );
	opt->addUsage( "NNSA (Neural Network Space Arcade) - Testovani rekuretni neuronove site na jednoduche arkade" );
    opt->addUsage( "" );
	opt->addUsage( "Pouziti: " );
    opt->addUsage( "" );
    opt->addUsage( " -h   --help		Zobrazi tuto napovedu " );    
	opt->addUsage( " -n jedinec.txt	Nejlepsi jedinec " ); 
	opt->addUsage( " -d data.txt		Udaje o jednotlivych generacich " ); 
	opt->addUsage( " " );
	opt->addUsage( "      --NP 60	Velikost populace " );
	opt->addUsage( "      --F 0.7	Mutacni konstanta " );
	opt->addUsage( "      --CR 0.8	Prah krizeni " );
	opt->addUsage( "      --generations 100	Pocet kol slechteni populace " );
	opt->addUsage( "      --neurons 4	Pocet neuronu v neuronove siti " );
	opt->addUsage( "      --quiet 1		Neukecany rezim " );
    opt->addUsage( "" );

	opt->setFlag( "help", 'h');   /* a flag (takes no argument), supporting long and short form */
	opt->setOption('n');
	opt->setOption('d');
	opt->setOption("NP");
	opt->setOption("F");
	opt->setOption("CR");
	opt->setOption("generations");
	opt->setOption("neurons");
	opt->setOption("quiet");
	
	opt->processCommandArgs(argc, argv);

	NP = atoi(opt->getValue("NP"));
	F = atof(opt->getValue("F"));
	CR = atof(opt->getValue("CR")); 
	Generations = atoi(opt->getValue("generations"));
	pocet_neuronu = atoi(opt->getValue("neurons"));
	nejlepsi_jedinec = opt->getValue('n');
	data = opt->getValue('d');
	tichy = atoi(opt->getValue("quiet"));

	cout << "Parametry diferencialni evoluce:" << endl;
	cout << " -> Velikost populace NP = " << NP << endl;
	cout << " -> Mutacni konstanta F = " << F  << endl;
	cout << " -> Prah krizeni CR = " << CR << endl;
	cout << " -> Pocet generaci = " << Generations << endl;
	cout << " -> Pocet neuronu = " << pocet_neuronu << endl;

	DiferencialniEvoluce *d1 = new DiferencialniEvoluce(NP, F, CR, Generations, pocet_neuronu, &ohodnoceni, tichy, data);
	d1->UlozNejlepsiJedinec(nejlepsi_jedinec);
	

	// 32bit - pretece cca po 36 minutach
	t2 = clock();
	cout << "Doba behu programu: " << ((double) (t2 - t1))/CLOCKS_PER_SEC << endl;


	return 0;
}
开发者ID:buresmi7,项目名称:NNSA,代码行数:77,代码来源:main.cpp


注:本文中的AnyOption::setFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。