-static void IB_action_init_callback(NetworkActionPtr action,RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate){
- if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
- xbt_die("IB comm added, without any node connected !");
-
- IBNode* act_src= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, src->getName());
- if(act_src==NULL)
- xbt_die("could not find src node active comms !");
- //act_src->rate=rate;
-
- IBNode* act_dst= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, dst->getName());
- if(act_dst==NULL)
- xbt_die("could not find dst node active comms !");
- // act_dst->rate=rate;
-
- ((NetworkIBModel*)surf_network_model)->active_comms[action]=make_pair<IBNode*,IBNode*>(act_src, act_dst);
- //post the action in the second dist, to retrieve in the other callback
- XBT_DEBUG("IB callback - action %p init", action);
-
- ((NetworkIBModel*)surf_network_model)->updateIBfactors(action, act_src, act_dst, 0);
-
-}
+ auto adst = ibModel->active_nodes.find(dst->getName());
+ if (adst != ibModel->active_nodes.end()) {
+ act_dst = adst->second;
+ } else {
+ throw std::out_of_range(std::string("Could not find '") + dst->getCname() + "' active comms !");
+ }