From f239a990c44ac2444eb45ecdae352e5d6b71a23a Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Castelli?= Date: Thu, 22 May 2014 16:53:21 +0200 Subject: [PATCH] small cosmetics to AsClusterFatTree::generateDotFile() --- src/surf/surf_routing_cluster_fat_tree.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/surf/surf_routing_cluster_fat_tree.cpp b/src/surf/surf_routing_cluster_fat_tree.cpp index 1fcab7ed87..f4d1433ef9 100644 --- a/src/surf/surf_routing_cluster_fat_tree.cpp +++ b/src/surf/surf_routing_cluster_fat_tree.cpp @@ -424,13 +424,21 @@ void AsClusterFatTree::generateDotFile(const string& filename) const { file.open(filename.c_str(), ios::out | ios::trunc); if(file.is_open()) { - // That could also be greatly clarified with C++11 - std::vector::const_iterator iter; file << "graph AsClusterFatTree {\n"; - for (iter = this->links.begin() ; iter != this->links.end() ; iter++ ) { - file << (*iter)->downNode->id + for (unsigned int i = 0 ; i < this->nodes.size() ; i++) { + file << this->nodes[i]->id; + if(this->nodes[i]->id < 0) { + file << " [shape=circle];\n"; + } + else { + file << " [shape=hexagon];\n"; + } + } + + for (unsigned int i = 0 ; i < this->links.size() ; i++ ) { + file << this->links[i]->downNode->id << " -- " - << (*iter)->upNode->id + << this->links[i]->upNode->id << ";\n"; } file << "}"; -- 2.20.1