コード例 #1
0
ファイル: rmf_info.cpp プロジェクト: j-ma-bu-l-l-ock/imp
int main(int argc, char** argv) {
  try {
    options.add_options()("frame,f",
                          boost::program_options::value<unsigned int>(&frame),
                          "Frame to use");
    RMF_ADD_INPUT_FILE("rmf");
    process_options(argc, argv);

    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    if (!rh.get_description().empty()) {
      std::cout << "description: " << rh.get_description() << std::endl;
    }
    if (!rh.get_producer().empty()) {
      std::cout << "producer: " << rh.get_producer() << std::endl;
    }
    rh.set_current_frame(RMF::FrameID(frame));
    std::cout << "frames: " << rh.get_number_of_frames() << std::endl;
    RMF::show_info(rh, std::cout);
    RMF::decorator::AlternativesFactory af(rh);
    using RMF::operator<<;
    std::cout << "resolutions: " << RMF::decorator::get_resolutions(
                                        rh.get_root_node(), RMF::PARTICLE, 0)
              << std::endl;
    std::cout << "gaussian resolutions: "
              << RMF::decorator::get_resolutions(rh.get_root_node(),
                                                 RMF::GAUSSIAN_PARTICLE, 0)
              << std::endl;
    return 0;
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}
コード例 #2
0
ファイル: rmf_xml.cpp プロジェクト: salilab/rmf
int main(int argc, char** argv) {
  try {
    RMF_ADD_INPUT_FILE("rmf");
    RMF_ADD_OUTPUT_FILE("xml");
    int frame = 0;
    options.add_options()("frame,f", boost::program_options::value<int>(&frame),
                          "Frame to use, if -1 just show static data")(
        "verbose,v", "Show the attribute values for each node.");

    process_options(argc, argv);

    RMF::FileConstHandle rh = RMF::open_rmf_file_read_only(input);
    std::ostream* out;
    std::ofstream fout;
    if (!output.empty()) {
      fout.open(output.c_str());
      if (!fout) {
        std::cerr << "Error opening file " << output << std::endl;
        return 1;
      }
      out = &fout;
    } else {
      out = &std::cout;
    }
    RMF::Categories cs = rh.get_categories();
    *out << "<?xml version=\"1.0\"?>\n";
    *out << "<rmf>\n";
    *out << "<description>\n";
    *out << rh.get_description() << std::endl;
    *out << "</description>\n";
    *out << "<path>\n";
    *out << input << std::endl;
    *out << "</path>\n";
    std::set<RMF::NodeConstHandle> seen;
    rh.set_current_frame(RMF::FrameID(frame));
    show_hierarchy(rh.get_root_node(), cs, seen, *out);
    *out << "</rmf>\n";
    return 0;
  }
  catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
  }
}