/*! * \file main.cpp * \brief Main application file * * \author * Christos Choutouridis AEM:8997 * */ #include #include #include #include #include // Global session data session_t session; /*! * A small command line argument parser * \return The status of the operation */ bool get_options(int argc, char* argv[]){ bool status =true; // iterate over the passed arguments for (int i=1 ; i (session.mtxFile)) throw std::runtime_error("Error: Matrix is not strictly upper or lower"); if (!Mtx::load (A, session.mtxFile)) { throw std::runtime_error("Error: fail to load matrix"); } timer.stop(); std::cout << "Matrix size: " << A.size() << " and capacity: " << A.capacity() <<'\n'; if (session.timing) timer.print_dt(); } if (session.print) { std::cout << "Array A:\n"; print_ER_graph (A); } std::cout << "count triangles\n"; timer.start(); std::cout << "There are " << triang_count(A) << " triangles\n"; timer.stop(); if (session.timing) timer.print_dt(); return 0; } catch (std::exception& e) { //we probably pollute the user's screen. Comment `cerr << ...` if you don't like it. std::cerr << e.what() << '\n'; exit(1); }