Merge topology conflicts

This commit is contained in:
quemy 2012-11-24 15:28:28 +01:00
commit 56a72c2ff1
11 changed files with 105 additions and 46 deletions

View file

@ -16,70 +16,105 @@ int main()
Topology<Complete> topo_comp;
topo_comp.construct(n);
std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology (" << n <<" islands) :"<<std::endl;
std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology (" << n <<" nodes) :"<<std::endl;
std::vector<unsigned> neighbors=topo_comp.getIdNeighbors(1);
std::cout << "neighbors of Island 1 : "<<std::endl;
std::cout << "neighbors of Node 1 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
neighbors=topo_comp.getIdNeighbors(2);
std::cout <<std::endl << "Neighbors of Island 2 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 2 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
//Re-construct Topology with different number of islands
//Isolate an node
topo_comp.isolateNode(2);
neighbors=topo_comp.getIdNeighbors(2);
std::cout <<std::endl << "Neighbors of Node 2 after isolation : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_comp.getIdNeighbors(3);
std::cout <<"Neighbors of Node 3 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
//Re-construct Topology with different number of nodes
n=3;
topo_comp.construct(n);
neighbors=topo_comp.getIdNeighbors(2);
std::cout <<"Changing number of islands to "<< n <<" : "<<std::endl;
std::cout <<std::endl << "Neighbors of Island 2 : "<<std::endl;
for (int i=0; i < neighbors.size(); i++)
std::cout <<"Changing number of nodes to "<< n <<",";
std::cout <<"Neighbors of Node 2 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
/////////////////////////////////////////////////////////////////////////
//Test of Star Topology
n=4;
Topology<Star> topo_star;
topo_star.construct(n);
std::cout << std::endl << "---------------" << std::endl << "Test of Star Topology (" << n <<" islands) :" << std::endl;
std::cout << std::endl << "---------------" << std::endl << "Test of Star Topology (" << n <<" nodes) :" << std::endl;
neighbors=topo_star.getIdNeighbors(0);
std::cout <<std::endl << "Neighbors of Island 0 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 0 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_star.getIdNeighbors(1);
std::cout <<std::endl << "Neighbors of Island 1 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 1 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
/////////////////////////////////////////////////////////////////////////
//Test of Ring Topology
n=8;
Topology<Ring> topo_ring;
topo_ring.construct(n);
std::cout << std::endl << "---------------" << std::endl << "Test of Ring Topology (" << n <<" islands) :" << std::endl;
std::cout << std::endl << "---------------" << std::endl << "Test of Ring Topology (" << n <<" nodes) :" << std::endl;
neighbors=topo_ring.getIdNeighbors(4);
std::cout <<std::endl << "Neighbors of Island 4 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 4 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_ring.getIdNeighbors(7);
std::cout <<std::endl << "Neighbors of Island 7 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 7 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;
neighbors=topo_ring.getIdNeighbors(0);
std::cout <<std::endl << "Neighbors of Island 0 : "<<std::endl;
std::cout <<std::endl << "Neighbors of Node 0 : "<<std::endl;
if(neighbors.empty())
std::cout <<"None";
for (int i=0; i < neighbors.size(); i++)
std::cout << " " << neighbors[i];
std::cout << std::endl;