int main (int argc, char* argv[]) { if( argc != 5){ std::cerr << "Usage: " << argv[ 0] << " filename.dat epsilon dimension option" << std::endl; return 0; } ctl::Timer clock; double epsilon = atof( argv[ 2]); std::size_t dimension = atoi( argv[ 3]); std::size_t option = atoi( argv[ 4]); if( option >= 2){ std::cerr << "Usage: please enter a valid option:" << std::endl << "0 for incremental construction," << std:: endl << "1 for inductive construstion." << std::endl; return 0; } Points points; std::ifstream in; ctl::open_file( in, argv[ 1]); Point point; double coordinate; std::size_t line_num = 0; while( true){ std::string line; ctl::get_line( in, line, line_num); if( in.eof() ) break; std::stringstream ss( line); while( ss.good()){ ss >> coordinate; point.push_back( coordinate); } points.push_back( point); point.clear(); } clock.start(); Graph graph; ctl::all_pairs::construct_graph(points, epsilon, graph); clock.stop(); std::cerr << "Graph: " << boost::num_vertices( graph) << ", " << boost:: num_edges( graph) << std::endl; std::cerr << "Graph construction: " << clock.elapsed() << std::endl; clock.start(); Complex complex; if( option == 0) { ctl::incremental_vr(graph, complex, dimension);} else if( option == 1) { ctl::inductive_vr(graph, complex, dimension);} clock.stop(); std::cerr << "Complex construction: " << clock.elapsed() << std::endl; std::cerr << "Number of simplices: " << complex.size() << std::endl; std::cerr << "dimension of complex: " << complex.dimension() << std::endl; return 0; }
int main(int argc, char *argv[]){ std::string full_complex_name, filtration_file; process_args(argc, argv, full_complex_name, filtration_file); std::string barcode_file_name( full_complex_name); std::size_t pos = barcode_file_name.rfind( '.'); if( pos != std::string::npos){ barcode_file_name.replace(pos, barcode_file_name.length(), ".bcs"); } std::ofstream out; ctl::open_file( out, barcode_file_name.c_str()); //Create some data structures Timer timer; timer.start(); if( can_read_weights( filtration_file)){ ctl::Weight_data_functor< Weighted_complex> weight_functor; typedef typename ctl::Barcodes< double> Barcodes; Barcodes barcodes; Weighted_complex complex; ctl::read_complex_and_data( full_complex_name, filtration_file, complex, weight_functor); timer.stop(); std::cout << "I/O Time: " << timer.elapsed() << std::endl; std::cout << "complex size: " << complex.size() << std::endl; std::cout << "complex dimension: " << complex.dimension() << std::endl; Complex_weight_less less; run_persistence( complex, less, barcodes, timer, ctl::detail::weighted_tag()); out << barcodes << std::endl; }else{ typedef typename ctl::Barcodes< double> Barcodes; Barcodes barcodes; Complex complex; ctl::read_complex( full_complex_name, complex); timer.stop(); std::cout << "I/O Time: " << timer.elapsed() << std::endl; std::cout << "complex size: " << complex.size() << std::endl; std::cout << "complex dimension: " << complex.dimension() << std::endl; Complex_cell_less less; run_persistence( complex, less, barcodes, timer, ctl::detail::non_weighted_tag()); out << barcodes << std::endl; } return 0; }