Add a builder attribute to the topology and construct method
This commit is contained in:
parent
6159309ab2
commit
631d693bef
8 changed files with 86 additions and 18 deletions
|
|
@ -38,7 +38,7 @@ namespace smp
|
|||
class AbstractTopology
|
||||
{
|
||||
public :
|
||||
virtual std::vector<unsigned> getIdNeighbours(unsigned idIsland) const =0;
|
||||
virtual std::vector<unsigned> getIdNeighbors(unsigned idIsland) const =0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@ void paradiseo::smp::Complete::operator()(unsigned nbIsland, std::vector<std::ve
|
|||
matrix.assign(nbIsland, line);
|
||||
for(int i=0;i<nbIsland;i++)
|
||||
matrix[i][i]=false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
#include <topology/ring.h>
|
||||
|
||||
void paradiseo::smp::Ring::operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <topology/topologyBuilder.h>
|
||||
#include <topology/star.h>
|
||||
|
||||
void paradiseo::smp::Star::operator()(unsigned nbIsland, std::vector<std::vector<bool>>& matrix) const
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
#include <vector>
|
||||
|
||||
template <class TopologyType>
|
||||
paradiseo::smp::Topology<TopologyType>::Topology(unsigned nbIsland)
|
||||
{
|
||||
TopologyType builder;
|
||||
builder(nbIsland, _matrix);
|
||||
}
|
||||
template <class TopologyType>
|
||||
std::vector<unsigned> paradiseo::smp::Topology<TopologyType>::getIdNeighbours(unsigned idIsland) const
|
||||
std::vector<unsigned> paradiseo::smp::Topology<TopologyType>::getIdNeighbors(unsigned idIsland) const
|
||||
{
|
||||
std::vector<unsigned> neighbours;
|
||||
std::vector<unsigned> neighbors;
|
||||
for(unsigned j=0; j<_matrix.size();j++)
|
||||
if(_matrix[idIsland][j]) neighbours.push_back(j);
|
||||
if(_matrix[idIsland][j]) neighbors.push_back(j);
|
||||
|
||||
return neighbours;
|
||||
return neighbors;
|
||||
}
|
||||
|
||||
template <class TopologyType>
|
||||
void paradiseo::smp::Topology<TopologyType>::construct(unsigned nbIsland)
|
||||
{
|
||||
_builder(nbIsland, _matrix);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ class Topology : public AbstractTopology
|
|||
{
|
||||
|
||||
public :
|
||||
Topology(unsigned nbIsland);
|
||||
|
||||
std::vector<unsigned> getIdNeighbours(unsigned idIsland) const;
|
||||
Topology() = default;
|
||||
std::vector<unsigned> getIdNeighbors(unsigned idIsland) const;
|
||||
void construct(unsigned nbIsland);
|
||||
|
||||
private :
|
||||
TopologyType _builder;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue