X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6f0020b4128661d1e48c3313eac227f0b769ed0e..35e807ba0b8341d3d001560693ecb0be4ff8ca90:/src/surf/surf_routing_vivaldi.c diff --git a/src/surf/surf_routing_vivaldi.c b/src/surf/surf_routing_vivaldi.c index bffcb4f89a..fe92bb4961 100644 --- a/src/surf/surf_routing_vivaldi.c +++ b/src/surf/surf_routing_vivaldi.c @@ -26,6 +26,7 @@ static double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) { double src_coord, dst_coord; + // FIXME converting from string to float each time we need a coordinate is ... suboptimal src_coord = atof(xbt_dynar_get_as(src, index, char *)); dst_coord = atof(xbt_dynar_get_as(dst, index, char *)); @@ -48,13 +49,11 @@ static double base_vivaldi_get_latency (const char *src, const char *dst) euclidean_dist = sqrt (euclidean_dist_comp(0,src_ctn,dst_ctn)+euclidean_dist_comp(1,src_ctn,dst_ctn)) + fabs(atof(xbt_dynar_get_as(src_ctn, 2, char *)))+fabs(atof(xbt_dynar_get_as(dst_ctn, 2, char *))); - xbt_assert(euclidean_dist>=0, "Euclidean Dist is less than 0\"%s\" and \"%.2f\"", src, euclidean_dist); - //From .ms to .s return euclidean_dist / 1000; } -static double vivaldi_get_link_latency (AS_t rc,const char *src, const char *dst, route_t e_route) +static double vivaldi_get_latency (AS_t rc,const char *src, const char *dst, route_t e_route) { if(routing_get_network_element_type(src) == SURF_NETWORK_ELEMENT_AS) { int need_to_clean = e_route?0:1; @@ -73,6 +72,6 @@ AS_t model_vivaldi_create(void) { AS_t new_component = model_rulebased_create(); new_component->get_route = vivaldi_get_route; - new_component->get_latency = vivaldi_get_link_latency; + new_component->get_latency = vivaldi_get_latency; return new_component; }