- /* Maybe should we get directly a char*, as open takes strings only beginning
- * with C++11...
- */
- file.open(filename.c_str(), std::ios::out | std::ios::trunc);
-
- if(file.is_open()) {
- file << "graph AsClusterFatTree {\n";
- 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
- << " -- "
- << this->links[i]->upNode->id
- << ";\n";
- }
- file << "}";
- file.close();
- }
- else {
- XBT_DEBUG("Unable to open file %s", filename.c_str());
- return;
- }
+ file.open(filename, std::ios::out | std::ios::trunc);
+ xbt_assert(file.is_open(), "Unable to open file %s", filename.c_str());
+
+ file << "graph AsClusterFatTree {\n";
+ 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
+ << " -- "
+ << this->links_[i]->upNode->id
+ << ";\n";
+ }
+ file << "}";
+ file.close();