AsClusterFatTree::AsClusterFatTree() : levels(0) {}
AsClusterFatTree::~AsClusterFatTree() {
- for (int i = 0 ; i < this->nodes.size() ; i++) {
+ for (unsigned int i = 0 ; i < this->nodes.size() ; i++) {
delete this->nodes[i];
}
}
void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
RoutingEdgePtr dst,
sg_platf_route_cbarg_t into,
- double *latency) const{
+ double *latency) {
// TODO
}
return;
}
this->nodesByLevel.resize(this->levels, 0);
- int nodesRequired = 0;
+ unsigned int nodesRequired = 0;
- for (int i = 0 ; i < this->levels ; i++) {
+ for (unsigned int i = 0 ; i < this->levels ; i++) {
int nodesInThisLevel = 1;
- for (int j = 0 ; j < i ; j++) {
+ for (unsigned int j = 0 ; j < i ; j++) {
nodesInThisLevel *= this->upperLevelNodesNumber[j];
}
- for (int j = i+1 ; j < this->levels ; j++) {
+ for (unsigned int j = i+1 ; j < this->levels ; j++) {
nodesInThisLevel *= this->lowerLevelNodesNumber[j];
}
// Nodes are totally ordered, by level and then by position, in this->nodes
int k = 0;
- for (int i = 0 ; i < this->levels ; i++) {
- for (int j = 0 ; j < this->nodesByLevel[i] ; j++) {
+ for (unsigned int i = 0 ; i < this->levels ; i++) {
+ for (unsigned int j = 0 ; j < this->nodesByLevel[i] ; j++) {
this->nodes[k]->level = i;
this->nodes[k]->position = j;
}
}
-
}
-void AsClusterFatTree::getLevelPosition(const int level, int &position, int &size) {
+void AsClusterFatTree::getLevelPosition(const unsigned int level, int &position, int &size) {
if (level > this->levels - 1) {
position = -1;
size = -1;
}
int tempPosition = 0;
- for (int i = 0 ; i < level ; i++) {
+ for (unsigned int i = 0 ; i < level ; i++) {
tempPosition += this->nodesByLevel[i];
}
position = tempPosition;
}
void AsClusterFatTree::addNodes(std::vector<int> const& id) {
- for (int i = 0 ; i < id.size() ; i++) {
+ for (unsigned int i = 0 ; i < id.size() ; i++) {
this->nodes.push_back(new FatTreeNode(id[i]));
}
}
if(file.is_open()) {
// That could also be greatly clarified with C++11
- // std::map<std::pair<int,int>,FatTreeLink*>::iterator iter;
- // file << "graph AsClusterFatTree {\n";
- // for (iter = this->links.begin() ; iter != this->links.end() ; iter++ ) {
- // for (int j = 0 ; j < iter->second->ports ; j++) {
- // file << iter->second->source->id
- // << " -- "
- // << iter->second->destination->id
- // << ";\n";
- // }
- //}
+ std::map<std::pair<int,int>,FatTreeLink*>::const_iterator iter;
+ file << "graph AsClusterFatTree {\n";
+ for (iter = this->links.begin() ; iter != this->links.end() ; iter++ ) {
+ for (unsigned int j = 0 ; j < iter->second->ports ; j++) {
+ file << iter->second->source->id
+ << " -- "
+ << iter->second->destination->id
+ << ";\n";
+ }
+ }
file << "}";
file.close();
}