+void NetworkCm02Model::comm_action_set_bounds(const s4u::Host* src, const s4u::Host* dst, double size,
+ NetworkCm02Action* action, const std::vector<LinkImpl*>& route,
+ const std::unordered_set<kernel::routing::NetZoneImpl*>& netzones)
+{
+ std::vector<s4u::Link*> s4u_route;
+ std::unordered_set<s4u::NetZone*> s4u_netzones;
+
+ /* transform data to user structures if necessary */
+ if (lat_factor_cb_ || bw_factor_cb_) {
+ std::for_each(route.begin(), route.end(), [&s4u_route](LinkImpl* 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()); });
+ }
+ double bw_factor;
+ if (bw_factor_cb_) {
+ bw_factor = bw_factor_cb_(size, src, dst, s4u_route, s4u_netzones);
+ } else {
+ bw_factor = get_bandwidth_factor(size);
+ }
+ /* get mininum bandwidth among links in the route and multiply by correct factor
+ * ignore wi-fi links, they're not considered for bw_factors */
+ double bandwidth_bound = -1.0;
+ for (const auto* l : route) {
+ if (l->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI)
+ continue;
+ if (bandwidth_bound == -1.0 || l->get_bandwidth() < bandwidth_bound)
+ bandwidth_bound = l->get_bandwidth();
+ }
+ bandwidth_bound *= bw_factor;