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
|
||||
{
|
||||
matrix.clear();
|
||||
if(nbNode!=matrix.size())
|
||||
{
|
||||
matrix.clear();
|
||||
|
||||
matrix.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
matrix.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
|
||||
std::vector<bool> line;
|
||||
line.assign(nbNode,true);
|
||||
matrix.assign(nbNode, line);
|
||||
for(int i=0;i<nbNode;i++)
|
||||
matrix[i][i]=false;
|
||||
std::vector<bool> line;
|
||||
line.assign(nbNode,true);
|
||||
matrix.assign(nbNode, line);
|
||||
for(int i=0;i<nbNode;i++)
|
||||
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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
//Check if the number of node is coherent with an hypercube
|
||||
assert((nbNode & (nbNode-1)) == 0);
|
||||
if(nbNode!=matrix.size())
|
||||
{
|
||||
//Check if the number of node is coherent with an hypercube
|
||||
assert((nbNode & (nbNode-1)) == 0);
|
||||
|
||||
unsigned power=0,i,j;
|
||||
while((nbNode & 1<<power) == 0)
|
||||
power++;
|
||||
|
||||
matrix.clear();
|
||||
matrix.resize(nbNode);
|
||||
unsigned power=0,i,j;
|
||||
while((nbNode & 1<<power) == 0)
|
||||
power++;
|
||||
|
||||
matrix.clear();
|
||||
matrix.resize(nbNode);
|
||||
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
|
||||
//Construction
|
||||
matrix[0][0] = false;
|
||||
for (unsigned dim = 1; dim <= power; dim ++)
|
||||
{
|
||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
||||
for(i=0; i <stepNbNode; i++)
|
||||
for(j=0; j< stepNbNode;j++)
|
||||
{
|
||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
||||
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
||||
}
|
||||
//Construction
|
||||
matrix[0][0] = false;
|
||||
for (unsigned dim = 1; dim <= power; dim ++)
|
||||
{
|
||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
||||
for(i=0; i <stepNbNode; i++)
|
||||
for(j=0; j< stepNbNode;j++)
|
||||
{
|
||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
||||
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
|
||||
{
|
||||
matrix.clear();
|
||||
if(nbNode!=matrix.size())
|
||||
{
|
||||
matrix.clear();
|
||||
|
||||
matrix.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
matrix.resize(nbNode);
|
||||
for(auto& line : matrix)
|
||||
line.resize(nbNode);
|
||||
|
||||
std::vector<bool> line;
|
||||
line.assign(nbNode, false);
|
||||
matrix.assign(nbNode, line);
|
||||
std::vector<bool> line;
|
||||
line.assign(nbNode, false);
|
||||
matrix.assign(nbNode, line);
|
||||
|
||||
for(int i=0; i<nbNode;i++)
|
||||
matrix[i][(i+1)%nbNode]=true;
|
||||
for(int i=0; i<nbNode;i++)
|
||||
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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue