///\brief Parse le fichier de triplet afin d'affecter si oui ou non un AS(vertex) est un transit ///\param filename nom du fichier de triplet void Controler::load_triplet(std::string const & filename){ std::set<std::size_t> transit_as; std::set<std::size_t>::iterator it; Graph::vertex_descriptor v; boost::graph_traits<Graph>::vertex_iterator vit, vend; std::set<std::size_t>::const_iterator found; read_triplet(filename,transit_as); //Parcours du graph for( boost::tie ( vit,vend) = boost::vertices( graph ); vit != vend; ++vit) { //TODO Gestion des vrais numéros d'AS... v=*vit; // int asnumber=graph[].as found=transit_as.find(graph[v].asn); //Affectation de la propriété transit graph[v].is_transit=(found == transit_as.end())?false:true; std::cout << graph[v].asn << " : " << graph[v].is_transit << std::endl; } }
int calibrate(int file, int width, Triplet *bias, FTriplet *scale) { Triplet data = {0}; MagDistribution m_dist = {{0},{0},{0}}; Triplet diameters; int avg_diameter; while (1) { print_distribution (m_dist.min, m_dist.max, data, width, ' ', ' '); read_triplet (file, XM_ADDRESS, OUT_X_L_M, &data); update_mag_bias (data, &m_dist); print_distribution (m_dist.min, m_dist.max, data, width, '|', '*'); move (6, 0); refresh (); usleep (20000); if (getch () != ERR) break; } bias->x = m_dist.bias.x; bias->y = m_dist.bias.y; bias->z = m_dist.bias.z; /* Try to scale the axes (crude transform from ellipse to sphere) */ diameters.x = abs (m_dist.max.x - m_dist.min.x); diameters.y = abs (m_dist.max.y - m_dist.min.y); diameters.z = abs (m_dist.max.z - m_dist.min.z); avg_diameter = (diameters.x + diameters.y + diameters.z) / 3; scale->x = avg_diameter / (float)diameters.x; scale->y = avg_diameter / (float)diameters.y; scale->z = avg_diameter / (float)diameters.z; return 1; }