Commit 92a2f13d authored by Neil McGlohon's avatar Neil McGlohon

Dragonfly Plus: Optimize get_groups_i_connect_to()

parent 317a956e
......@@ -70,7 +70,8 @@ class ConnectionManager {
map< int, Connection > _portMap; //Mapper for ports to connections
set< int > _other_groups_i_connect_to;
vector< int > _other_groups_i_connect_to;
set< int > _other_groups_i_connect_to_set;
// map< int, vector< Connection > > intermediateRouterToGroupMap; //maps group id to list of routers that connect to it.
// //ex: intermediateRouterToGroupMap[3] returns a vector
......@@ -200,6 +201,11 @@ public:
*/
vector< int > get_connected_group_ids();
/**
*
*/
void solidify_connections();
/**
* @brief prints out the state of the connection manager
*/
......@@ -265,7 +271,7 @@ void ConnectionManager::add_connection(int dest_gid, ConnectionType type)
}
if(conn.dest_group_id != conn.src_group_id)
_other_groups_i_connect_to.insert(conn.dest_group_id);
_other_groups_i_connect_to_set.insert(conn.dest_group_id);
_portMap[conn.port] = conn;
}
......@@ -449,15 +455,19 @@ vector< Connection > ConnectionManager::get_connections_by_type(ConnectionType t
vector< int > ConnectionManager::get_connected_group_ids()
{
vector< int > retVec;
return _other_groups_i_connect_to;
}
void ConnectionManager::solidify_connections()
{
set< int >::iterator it;
for(it = _other_groups_i_connect_to.begin(); it != _other_groups_i_connect_to.end(); it++)
for(it = _other_groups_i_connect_to_set.begin(); it != _other_groups_i_connect_to_set.end(); it++)
{
retVec.push_back(*it);
_other_groups_i_connect_to.push_back(*it);
}
return retVec;
}
void ConnectionManager::print_connections()
{
printf("Connections for Router: %d ---------------------------------------\n",_source_id_global);
......
......@@ -1261,6 +1261,9 @@ void router_plus_setup(router_state *r, tw_lp *lp)
}
}
if (r->dfp_router_type == SPINE)
r->connMan->solidify_connections();
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment