Minor modification for documentation and not changing topology if not necessary
This commit is contained in:
parent
085530ab36
commit
9b46377062
5 changed files with 54 additions and 45 deletions
|
|
@ -32,15 +32,18 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
matrix.clear();
|
if(nbNode!=matrix.size())
|
||||||
|
{
|
||||||
|
matrix.clear();
|
||||||
|
|
||||||
matrix.resize(nbNode);
|
matrix.resize(nbNode);
|
||||||
for(auto& line : matrix)
|
for(auto& line : matrix)
|
||||||
line.resize(nbNode);
|
line.resize(nbNode);
|
||||||
|
|
||||||
std::vector<bool> line;
|
std::vector<bool> line;
|
||||||
line.assign(nbNode,true);
|
line.assign(nbNode,true);
|
||||||
matrix.assign(nbNode, line);
|
matrix.assign(nbNode, line);
|
||||||
for(int i=0;i<nbNode;i++)
|
for(int i=0;i<nbNode;i++)
|
||||||
matrix[i][i]=false;
|
matrix[i][i]=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace smp
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Complete: Inherit from TopologyBuilder. Reprents a builder for a complete topology : each node has every other node for neighor.
|
*Complete: Inherit from TopologyBuilder. Represents a builder for a complete topology : each node has every other node for neighor.
|
||||||
*/
|
*/
|
||||||
class Complete: public TopologyBuilder
|
class Complete: public TopologyBuilder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,29 +34,32 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
//Check if the number of node is coherent with an hypercube
|
if(nbNode!=matrix.size())
|
||||||
assert((nbNode & (nbNode-1)) == 0);
|
{
|
||||||
|
//Check if the number of node is coherent with an hypercube
|
||||||
|
assert((nbNode & (nbNode-1)) == 0);
|
||||||
|
|
||||||
unsigned power=0,i,j;
|
unsigned power=0,i,j;
|
||||||
while((nbNode & 1<<power) == 0)
|
while((nbNode & 1<<power) == 0)
|
||||||
power++;
|
power++;
|
||||||
|
|
||||||
matrix.clear();
|
matrix.clear();
|
||||||
matrix.resize(nbNode);
|
matrix.resize(nbNode);
|
||||||
|
|
||||||
for(auto& line : matrix)
|
for(auto& line : matrix)
|
||||||
line.resize(nbNode);
|
line.resize(nbNode);
|
||||||
|
|
||||||
//Construction
|
//Construction
|
||||||
matrix[0][0] = false;
|
matrix[0][0] = false;
|
||||||
for (unsigned dim = 1; dim <= power; dim ++)
|
for (unsigned dim = 1; dim <= power; dim ++)
|
||||||
{
|
{
|
||||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
||||||
for(i=0; i <stepNbNode; i++)
|
for(i=0; i <stepNbNode; i++)
|
||||||
for(j=0; j< stepNbNode;j++)
|
for(j=0; j< stepNbNode;j++)
|
||||||
{
|
{
|
||||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
||||||
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,19 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
matrix.clear();
|
if(nbNode!=matrix.size())
|
||||||
|
{
|
||||||
|
matrix.clear();
|
||||||
|
|
||||||
matrix.resize(nbNode);
|
matrix.resize(nbNode);
|
||||||
for(auto& line : matrix)
|
for(auto& line : matrix)
|
||||||
line.resize(nbNode);
|
line.resize(nbNode);
|
||||||
|
|
||||||
std::vector<bool> line;
|
std::vector<bool> line;
|
||||||
line.assign(nbNode, false);
|
line.assign(nbNode, false);
|
||||||
matrix.assign(nbNode, line);
|
matrix.assign(nbNode, line);
|
||||||
|
|
||||||
for(int i=0; i<nbNode;i++)
|
for(int i=0; i<nbNode;i++)
|
||||||
matrix[i][(i+1)%nbNode]=true;
|
matrix[i][(i+1)%nbNode]=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ 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.
|
*Ring: Inherit from TopologyBuilder. Represents a builder for a ring topology : each node has the next node for neighor. The last node is connected to the first.
|
||||||
*/
|
*/
|
||||||
class Ring : public TopologyBuilder
|
class Ring : public TopologyBuilder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue