Documentation, add the method construct in AbstractTopology
This commit is contained in:
parent
631d693bef
commit
1c79ce0948
15 changed files with 90 additions and 392 deletions
|
|
@ -35,10 +35,28 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/** AbstractTopology: The Abstract Topology defines what is necessary to any topology.
|
||||
In order to know a topology, we just need to know how to construct it and what are the neighbors of each node, regardless of the type of topology (boolean or stochastic).
|
||||
|
||||
@see smp::topology::Topology, smp::topology::TopologyBuilder
|
||||
|
||||
*/
|
||||
|
||||
class AbstractTopology
|
||||
{
|
||||
public :
|
||||
public :
|
||||
|
||||
/**
|
||||
* Return a vector containing the index of nearby nodes according to the topology
|
||||
* @param idIsland index of the node of which you want the neighbors.
|
||||
*/
|
||||
virtual std::vector<unsigned> getIdNeighbors(unsigned idIsland) const =0;
|
||||
|
||||
/**
|
||||
* Construct or re-construct a topology with the given number of nodes.
|
||||
* @param nbIsland number of nodes for the topology
|
||||
*/
|
||||
virtual void construct(unsigned nbIsland) =0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
<booleanTopology.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
template <class TopologyType>
|
||||
paradiseo::smp::BooleanTopology<TopologyType>::BooleanTopology(unsigned nbIsland)
|
||||
{
|
||||
TopologyType builder;
|
||||
builder(nbIsland, _matrix);
|
||||
}
|
||||
template <class TopologyType>
|
||||
std::vector<unsigned> paradiseo::smp::BooleanTopology<TopologyType>::getIdNeighbours(unsigned idIsland) const
|
||||
{
|
||||
std::vector<unsigned> neighbours;
|
||||
for(unsigned j=0; j<_matrix.size();j++)
|
||||
if(_matrix[idIsland][j]) neighbours.push_back(j);
|
||||
|
||||
return neighbours;
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
<booleanTopology.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <topology/abstractTopology.h>
|
||||
|
||||
namespace paradiseo
|
||||
{
|
||||
namespace smp
|
||||
{
|
||||
|
||||
template<class T>
|
||||
class BooleanTopology : public AbstractTopology
|
||||
{
|
||||
|
||||
public :
|
||||
BooleanTopology(unsigned nbIsland);
|
||||
|
||||
std::vector<unsigned> getIdNeighbours(unsigned idIsland) const;
|
||||
|
||||
private :
|
||||
std::vector<std::vector<bool>> _matrix;
|
||||
};
|
||||
|
||||
#include<topology/booleanTopology.cpp>
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,9 +37,15 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/**
|
||||
*Complete: Inherit from TopologyBuilder. Reprents a builder for a complete topology : each node has every other node for neighor.
|
||||
*/
|
||||
class Complete: public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
/**
|
||||
*Fills the given matrix for a complete topology with the specified number of nodes.
|
||||
*/
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
<completeTopologyBuilder.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <topology/completeTopologyBuilder.h>
|
||||
#include <vector>
|
||||
|
||||
void paradiseo::smp::CompleteTopologyBuilder::operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const
|
||||
{
|
||||
matrix.clear();
|
||||
std::vector<bool> line;
|
||||
line.assign(nbIsland,true);
|
||||
matrix.assign(nbIsland, line);
|
||||
for(int i=0;i<nbIsland;i++)
|
||||
matrix[i][i]=false;
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
<completeTopologyBuilder.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
#ifndef COMPLETE_TOPO_BUILDER_H_
|
||||
#define COMPLETE_TOPO_BUILDER_H_
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
|
||||
namespace paradiseo
|
||||
{
|
||||
namespace smp
|
||||
{
|
||||
|
||||
class CompleteTopologyBuilder: public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -38,10 +38,16 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/**
|
||||
*Ring: Inherit from TopologyBuilder. Reprents a builder for a complete topology : each node has the next node for neighor. The last node is connected to the first.
|
||||
*/
|
||||
class Ring : public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
/**
|
||||
*Fills the given matrix for a ring topology with the specified number of nodes.
|
||||
*/
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
<ringTopologyBuilder.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
#include <topology/ringTopologyBuilder.h>
|
||||
|
||||
void paradiseo::smp::RingTopologyBuilder::operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const
|
||||
{
|
||||
matrix.clear();
|
||||
std::vector<bool> line;
|
||||
line.assign(nbIsland, false);
|
||||
matrix.assign(nbIsland, line);
|
||||
|
||||
for(int i=0; i<nbIsland;i++)
|
||||
matrix[i][(i+1)%nbIsland]=true;
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
<ringTopologyBuilder.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef RING_TOPO_BUILDER_H_
|
||||
#define RING_TOPO_BUILDER_H_
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
|
||||
namespace paradiseo
|
||||
{
|
||||
namespace smp
|
||||
{
|
||||
|
||||
class RingTopologyBuilder : public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -38,9 +38,15 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/**
|
||||
*Star: Inherit from TopologyBuilder. Reprents a builder for a star topology : each node excepted the first has every other node for neighor. The first node doesn't have any neighbor.
|
||||
*/
|
||||
class Star : public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
/**
|
||||
*Fills the given matrix for a star topology with the specified number of nodes.
|
||||
*/
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
<starTopologyBuilder.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
#include <topology/starTopologyBuilder.h>
|
||||
|
||||
void paradiseo::smp::StarTopologyBuilder::operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const
|
||||
{
|
||||
matrix.clear();
|
||||
std::vector<bool> line (nbIsland,false);
|
||||
|
||||
line[0]=true;
|
||||
matrix.assign(nbIsland-1,line);
|
||||
|
||||
line.clear();
|
||||
line.assign(nbIsland, false);
|
||||
std::vector<std::vector<bool>>::iterator it = matrix.begin();
|
||||
matrix.insert(it, line);
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
<starTopologyBuilder.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
Alexandre Quemy, Thibault Lasnier - INSA Rouen
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef STAR_TOPO_BUILDER_H_
|
||||
#define STAR_TOPO_BUILDER_H_
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
|
||||
namespace paradiseo
|
||||
{
|
||||
namespace smp
|
||||
{
|
||||
|
||||
class StarTopologyBuilder : public TopologyBuilder
|
||||
{
|
||||
public :
|
||||
void operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -35,16 +35,38 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/**
|
||||
Topology : Inherit from AbstractTopology and must be templated with the type of Topology (e.g : Ring, Star...)
|
||||
It represents the boolean topology, and cannot be used for Stochastic topology.
|
||||
|
||||
@see smp::topology::AbstractTopology
|
||||
*/
|
||||
|
||||
template<class TopologyType>
|
||||
class Topology : public AbstractTopology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
Topology() = default;
|
||||
|
||||
/**
|
||||
* Inherited from AbstractTopology
|
||||
* @see smp::topology::AbstractTopology::getIdNeighbors
|
||||
*/
|
||||
std::vector<unsigned> getIdNeighbors(unsigned idIsland) const;
|
||||
|
||||
/**
|
||||
* Inherited from AbstractTopology : construct or re-construct a topology with the given number of nodes
|
||||
* @param nbIsland number of nodes for the topology
|
||||
*/
|
||||
void construct(unsigned nbIsland);
|
||||
|
||||
private :
|
||||
|
||||
TopologyType _builder;
|
||||
std::vector<std::vector<bool>> _matrix;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,9 +37,17 @@ namespace paradiseo
|
|||
namespace smp
|
||||
{
|
||||
|
||||
/** TopologyBuilder: abstract class to build any boolean topology with a particular structure.
|
||||
*/
|
||||
|
||||
class TopologyBuilder
|
||||
{
|
||||
public :
|
||||
|
||||
/**
|
||||
*Build th topology with the given number of nodes in the matrix.
|
||||
*@see smp::topology::Ring, smp::topology::Star, smp::topology::Complete
|
||||
**/
|
||||
virtual void operator()(unsigned _nbIsland, std::vector<std::vector<bool>>& _matrix) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ using namespace paradiseo::smp;
|
|||
|
||||
int main()
|
||||
{
|
||||
//Test of Complete Topology
|
||||
Topology<Complete> topo_comp;
|
||||
topo_comp.construct(5);
|
||||
int n;
|
||||
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology" << std::endl;
|
||||
//Test of Complete Topology
|
||||
n=5;
|
||||
Topology<Complete> topo_comp;
|
||||
topo_comp.construct(n);
|
||||
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology (" << n <<" islands) :"<<std::endl;
|
||||
|
||||
std::vector<unsigned> neighbors=topo_comp.getIdNeighbors(1);
|
||||
std::cout << "neighbors of Island 1 : "<<std::endl;
|
||||
|
|
@ -25,12 +28,24 @@ int main()
|
|||
for (int i=0; i < neighbors.size(); i++)
|
||||
std::cout << " " << neighbors[i];
|
||||
std::cout << std::endl;
|
||||
|
||||
//Re-construct Topology with different number of islands
|
||||
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 << " " << neighbors[i];
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
//Test of Star Topology
|
||||
n=4;
|
||||
Topology<Star> topo_star;
|
||||
topo_star.construct(4);
|
||||
topo_star.construct(n);
|
||||
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Star Topology" << std::endl;
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Star Topology (" << n <<" islands) :" << std::endl;
|
||||
|
||||
neighbors=topo_star.getIdNeighbors(0);
|
||||
std::cout <<std::endl << "Neighbors of Island 0 : "<<std::endl;
|
||||
|
|
@ -45,10 +60,11 @@ int main()
|
|||
std::cout << std::endl;
|
||||
|
||||
//Test of Ring Topology
|
||||
n=8;
|
||||
Topology<Ring> topo_ring;
|
||||
topo_ring.construct(8);
|
||||
topo_ring.construct(n);
|
||||
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Ring Topology" << std::endl;
|
||||
std::cout << std::endl << "---------------" << std::endl << "Test of Ring Topology (" << n <<" islands) :" << std::endl;
|
||||
|
||||
neighbors=topo_ring.getIdNeighbors(4);
|
||||
std::cout <<std::endl << "Neighbors of Island 4 : "<<std::endl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue