From 6b2a6956222741db481be953e7592c0fcea8490c Mon Sep 17 00:00:00 2001 From: lasnier Date: Fri, 23 Nov 2012 20:20:07 +0100 Subject: [PATCH] Consistency of names and guard in topology.h --- smp/src/topology/abstractTopology.h | 8 ++++---- smp/src/topology/complete.cpp | 8 ++++---- smp/src/topology/complete.h | 2 +- smp/src/topology/ring.cpp | 10 +++++----- smp/src/topology/ring.h | 2 +- smp/src/topology/star.cpp | 8 ++++---- smp/src/topology/star.h | 2 +- smp/src/topology/topology.cpp | 8 ++++---- smp/src/topology/topology.h | 11 ++++++++--- smp/src/topology/topologyBuilder.h | 4 ++-- smp/test/t-smpTopo.cpp | 26 +++++++++++++------------- 11 files changed, 47 insertions(+), 42 deletions(-) diff --git a/smp/src/topology/abstractTopology.h b/smp/src/topology/abstractTopology.h index 0573097f5..bd20209ef 100644 --- a/smp/src/topology/abstractTopology.h +++ b/smp/src/topology/abstractTopology.h @@ -50,15 +50,15 @@ 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. + * @param idNode index of the node of which you want the neighbors. */ - virtual std::vector getIdNeighbors(unsigned idIsland) const =0; + virtual std::vector getIdNeighbors(unsigned idNode) const =0; /** * Construct or re-construct a topology with the given number of nodes. - * @param nbIsland number of nodes for the topology + * @param nbNode number of nodes for the topology */ - virtual void construct(unsigned nbIsland) =0; + virtual void construct(unsigned nbNode) =0; }; } diff --git a/smp/src/topology/complete.cpp b/smp/src/topology/complete.cpp index f52c2ab5d..378e034b2 100644 --- a/smp/src/topology/complete.cpp +++ b/smp/src/topology/complete.cpp @@ -30,12 +30,12 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -void paradiseo::smp::Complete::operator()(unsigned nbIsland, std::vector>& matrix) const +void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector>& matrix) const { matrix.clear(); std::vector line; - line.assign(nbIsland,true); - matrix.assign(nbIsland, line); - for(int i=0;i>& matrix) const; + void operator()(unsigned nbNode, std::vector>& matrix) const; }; } diff --git a/smp/src/topology/ring.cpp b/smp/src/topology/ring.cpp index 269a77ed3..78ccccf7a 100644 --- a/smp/src/topology/ring.cpp +++ b/smp/src/topology/ring.cpp @@ -30,13 +30,13 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -void paradiseo::smp::Ring::operator()(unsigned nbIsland, std::vector>& matrix) const +void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector>& matrix) const { matrix.clear(); std::vector line; - line.assign(nbIsland, false); - matrix.assign(nbIsland, line); + line.assign(nbNode, false); + matrix.assign(nbNode, line); - for(int i=0; i>& matrix) const; + void operator()(unsigned nbNode, std::vector>& matrix) const; }; } diff --git a/smp/src/topology/star.cpp b/smp/src/topology/star.cpp index e6d9cc389..50aff724b 100644 --- a/smp/src/topology/star.cpp +++ b/smp/src/topology/star.cpp @@ -30,16 +30,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -void paradiseo::smp::Star::operator()(unsigned nbIsland, std::vector>& matrix) const +void paradiseo::smp::Star::operator()(unsigned nbNode, std::vector>& matrix) const { matrix.clear(); - std::vector line (nbIsland,false); + std::vector line (nbNode,false); line[0]=true; - matrix.assign(nbIsland-1,line); + matrix.assign(nbNode-1,line); line.clear(); - line.assign(nbIsland, false); + line.assign(nbNode, false); std::vector>::iterator it = matrix.begin(); matrix.insert(it, line); } diff --git a/smp/src/topology/star.h b/smp/src/topology/star.h index d79bf091d..079573e70 100644 --- a/smp/src/topology/star.h +++ b/smp/src/topology/star.h @@ -47,7 +47,7 @@ public : /** *Fills the given matrix for a star topology with the specified number of nodes. */ - void operator()(unsigned nbIsland, std::vector>& matrix) const; + void operator()(unsigned nbNode, std::vector>& matrix) const; }; } diff --git a/smp/src/topology/topology.cpp b/smp/src/topology/topology.cpp index f40298566..70e876ae2 100644 --- a/smp/src/topology/topology.cpp +++ b/smp/src/topology/topology.cpp @@ -31,17 +31,17 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include template -std::vector paradiseo::smp::Topology::getIdNeighbors(unsigned idIsland) const +std::vector paradiseo::smp::Topology::getIdNeighbors(unsigned idNode) const { std::vector neighbors; for(unsigned j=0; j<_matrix.size();j++) - if(_matrix[idIsland][j]) neighbors.push_back(j); + if(_matrix[idNode][j]) neighbors.push_back(j); return neighbors; } template -void paradiseo::smp::Topology::construct(unsigned nbIsland) +void paradiseo::smp::Topology::construct(unsigned nbNode) { - _builder(nbIsland, _matrix); + _builder(nbNode, _matrix); } diff --git a/smp/src/topology/topology.h b/smp/src/topology/topology.h index d159a9309..d6f05296b 100644 --- a/smp/src/topology/topology.h +++ b/smp/src/topology/topology.h @@ -27,6 +27,9 @@ ParadisEO WebSite : http://paradiseo.gforge.inria.fr Contact: paradiseo-help@lists.gforge.inria.fr */ +#ifndef TOPOLOGY_H_ +#define TOPOLOGY_H_ + #include #include @@ -57,13 +60,13 @@ public : * Inherited from AbstractTopology * @see smp::topology::AbstractTopology::getIdNeighbors */ - std::vector getIdNeighbors(unsigned idIsland) const; + std::vector getIdNeighbors(unsigned idNode) const; /** * Inherited from AbstractTopology : construct or re-construct a topology with the given number of nodes - * @param nbIsland number of nodes for the topology + * @param nbNode number of nodes for the topology */ - void construct(unsigned nbIsland); + void construct(unsigned nbNode); private : @@ -76,3 +79,5 @@ private : } } + +#endif diff --git a/smp/src/topology/topologyBuilder.h b/smp/src/topology/topologyBuilder.h index cf91b2b01..d21482d87 100644 --- a/smp/src/topology/topologyBuilder.h +++ b/smp/src/topology/topologyBuilder.h @@ -1,5 +1,5 @@ /* - + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012 Alexandre Quemy, Thibault Lasnier - INSA Rouen @@ -48,7 +48,7 @@ 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>& _matrix) const = 0; + virtual void operator()(unsigned _nbNode, std::vector>& _matrix) const = 0; }; } diff --git a/smp/test/t-smpTopo.cpp b/smp/test/t-smpTopo.cpp index 68a52cc2a..e827f3386 100644 --- a/smp/test/t-smpTopo.cpp +++ b/smp/test/t-smpTopo.cpp @@ -16,25 +16,25 @@ int main() Topology topo_comp; topo_comp.construct(n); - std::cout << std::endl << "---------------" << std::endl << "Test of Complete Topology (" << n <<" islands) :"< neighbors=topo_comp.getIdNeighbors(1); - std::cout << "neighbors of Island 1 : "< 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 < 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 <