- if (sg_weight_S_parameter > 0) {
- action->sharing_penalty_ =
- std::accumulate(route.begin(), route.end(), action->sharing_penalty_, [](double total, LinkImpl* const& link) {
- return total + sg_weight_S_parameter / link->get_bandwidth();
- });
+ return action;
+}
+
+bool NetworkCm02Model::comm_get_route_info(const s4u::Host* src, const s4u::Host* dst, double& latency,
+ std::vector<StandardLinkImpl*>& route,
+ std::vector<StandardLinkImpl*>& back_route,
+ std::unordered_set<kernel::routing::NetZoneImpl*>& netzones) const
+{
+ kernel::routing::NetZoneImpl::get_global_route_with_netzones(src->get_netpoint(), dst->get_netpoint(), route,
+ &latency, netzones);
+
+ xbt_assert(not route.empty() || latency > 0,
+ "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
+ src->get_cname(), dst->get_cname());
+
+ bool failed = std::any_of(route.begin(), route.end(), [](const StandardLinkImpl* link) { return not link->is_on(); });
+
+ if (not failed && cfg_crosstraffic) {
+ dst->route_to(src, back_route, nullptr);
+ failed = std::any_of(back_route.begin(), back_route.end(),
+ [](const StandardLinkImpl* link) { return not link->is_on(); });
+ }
+ return failed;
+}
+
+void NetworkCm02Model::comm_action_set_bounds(const s4u::Host* src, const s4u::Host* dst, double size,
+ NetworkCm02Action* action, const std::vector<StandardLinkImpl*>& route,
+ const std::unordered_set<kernel::routing::NetZoneImpl*>& netzones,
+ double rate) const
+{
+ std::vector<s4u::Link*> s4u_route;
+ std::unordered_set<s4u::NetZone*> s4u_netzones;
+
+ /* transform data to user structures if necessary */
+ if (has_network_factor_cb()) {
+ std::for_each(route.begin(), route.end(),
+ [&s4u_route](StandardLinkImpl* l) { s4u_route.push_back(l->get_iface()); });
+ std::for_each(netzones.begin(), netzones.end(),
+ [&s4u_netzones](kernel::routing::NetZoneImpl* n) { s4u_netzones.insert(n->get_iface()); });