- this->routers_[i]->myNodes_ = static_cast<surf::LinkImpl**>(
- xbt_malloc0(numLinksperLink_ * this->numNodesPerBlade_ * sizeof(surf::LinkImpl*)));
- this->routers_[i]->greenLinks_ =
- static_cast<surf::LinkImpl**>(xbt_malloc0(this->numBladesPerChassis_ * sizeof(surf::LinkImpl*)));
- this->routers_[i]->blackLinks_ =
- static_cast<surf::LinkImpl**>(xbt_malloc0(this->numChassisPerGroup_ * sizeof(surf::LinkImpl*)));
-
- for (unsigned int j = 0; j < numLinksperLink_ * this->numNodesPerBlade_; j += numLinksperLink_) {
- id = bprintf("local_link_from_router_%d_to_node_%d_%d", i, j / numLinksperLink_, uniqueId);
- this->createLink(id, 1, &linkup, &linkdown);
- if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX) {
- this->routers_[i]->myNodes_[j] = linkup;
- this->routers_[i]->myNodes_[j + 1] = linkdown;
- } else {
- this->routers_[i]->myNodes_[j] = linkup;
- }
+ this->routers_[i].my_nodes_.resize(num_links_per_link_ * this->num_nodes_per_blade_);
+ this->routers_[i].green_links_.resize(this->num_blades_per_chassis_);
+ this->routers_[i].black_links_.resize(this->num_chassis_per_group_);
+
+ for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
+ std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
+ std::to_string(j / num_links_per_link_) + "_" + std::to_string(uniqueId);
+ this->generate_link(id, 1, &linkup, &linkdown);
+
+ this->routers_[i].my_nodes_[j] = linkup;
+ if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX)
+ this->routers_[i].my_nodes_[j + 1] = linkdown;
+