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


C++ Array::GetArrayName方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
    }

    // And the image file we're going to use for the simulation:
    if ((strcmp(argv[i], "-i") == 0) && (i < argc - 1))
    {
      target.SetImage(string(argv[i + 1]));
      target.ParseImageOptions(argv, i + 2, argc);
      n_params += 1;
    }

    // And where we're going to write the output:
    if ((strcmp(argv[i], "-o") == 0) && (i < argc - 1))
    {
      try
      {
        output_fname = string(argv[i + 1]);
        n_params += 1;
      }
      catch (...)
      {
        throw std::runtime_error("Invalid Output File Definition");
      }
    }

    //
    // After this there are two cases:
    //

    // ################
    // (1) we use an existing OIFITS data file.  Really this has everything
    // needed to run the simulation, but I don't want to write a module to parse
    // the OIFITS array and wavelength tables.  So, we'll just require
    // that the array and spectral mode be specified too.
    if ((strcmp(argv[i], "-d") == 0) && (i < argc - 1))
    {
      observation_list = Obs_OIFITS::ReadObservation_OIFITS(string(argv[i + 1]));
      n_params += 1;
    }

    // ################
    // or (2) we are simulating something from scratch in which case we need
    // the array
    if ((strcmp(argv[i], "-a") == 0) && (i < argc - 1))
    {
      array.ImportFile(string(argv[i + 1]), comment_chars);
      array.ParseOptions(argv, i, argc);
      n_params += 1;
    }

    // the combiner
    if ((strcmp(argv[i], "-c") == 0) && (i < argc - 1))
    {
      combiner.ImportFile(string(argv[i + 1]), comment_chars);
      n_params += 1;
    }

    // the spectral mode.  Note, the combiner must be specified first so we can check that
    // the two are indeed to be used with eachother.
    if ((strcmp(argv[i], "-m") == 0) && (i < argc - 1))
    {
      if (combiner.name == "")
      {
        cout << "The combiner, -c, must be specified before the spectral mode, -m.\n";
        exit(0);
      }

      spec_mode.ImportFile(string(argv[i + 1]), combiner.GetName(), comment_chars);
      n_params += 1;

    }

    // Now for observation_list
    if ((strcmp(argv[i], "-obs") == 0) && (i < argc - 1))
    {
      // First ensure that the array has been defined.  If not, quit.
      if (array.GetArrayName() == "")
      {
        cout << "The array, -a, must be specified before the observation list, -obs.\n";
        exit(0);
      }

      // Observations are a little funny.  We permit both files and command line options.
      // Just pass things off to the observation class so it can decide what to do:
      observation_list = Observation::ParseCommandLine(&array, argv, i, argc, comment_chars);
      n_params += 1;
    }
  }

  // Check that all parameters were specified
  // TODO: Better checking here should be implemented
  if (n_params == 7)
    run_sim(&target, &array, &combiner, &spec_mode, noisemodel, observation_list, output_fname);
  else
    cout << "Something is missing on the command line, quitting!" << endl;

  // Clean up memory
  delete noisemodel;

  return 0;
}
开发者ID:bkloppenborg,项目名称:oifits-sim,代码行数:101,代码来源:oifits-sim.cpp


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