X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7684e4c9202e5160859052de1d6ec9509abcf98c..6a2bdaec0bc0f5c8222cd7426692c0866bfadc45:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 78902504a8..e7bb83ac77 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -4,13 +4,11 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ - - #include #include "gras_config.h" #ifdef HAVE_PCRE_LIB -#include /* regular expresion library */ +#include /* regular expression library */ #endif #include "surf_private.h" #include "xbt/dynar.h" @@ -36,7 +34,7 @@ static void *model_full_create(void); /* create structures for full routing mo static void model_full_load(void); /* load parse functions for full routing model */ static void model_full_unload(void); /* unload parse functions for full routing model */ static void model_full_end(void); /* finalize the creation of full routing model */ -static void model_full_set_route( /* Set the route and ASroute between src and dst */ +static void model_full_set_route( /* Set the route and ASroute between src and dst */ routing_component_t rc, const char *src, const char *dst, name_route_extended_t route); static void *model_floyd_create(void); /* create structures for floyd routing model */ @@ -56,22 +54,22 @@ static void model_dijkstra_both_set_route (routing_component_t rc, const char *s const char *dst, name_route_extended_t route); static void *model_rulebased_create(void); /* create structures for rulebased routing model */ -static void model_rulebased_load(void); /* load parse functions for rulebased routing model */ +static void model_rulebased_load(void); /* load parse functions for rulebased routing model */ static void model_rulebased_unload(void); /* unload parse functions for rulebased routing model */ -static void model_rulebased_end(void); /* finalize the creation of rulebased routing model */ +static void model_rulebased_end(void); /* finalize the creation of rulebased routing model */ -static void *model_none_create(void); /* none routing model */ -static void model_none_load(void); /* none routing model */ -static void model_none_unload(void); /* none routing model */ -static void model_none_end(void); /* none routing model */ +static void *model_none_create(void); /* none routing model */ +static void model_none_load(void); /* none routing model */ +static void model_none_unload(void); /* none routing model */ +static void model_none_end(void); /* none routing model */ -static void routing_parse_Scluster(void); /*cluster bypass */ -static void routing_parse_Speer(void); /*peer bypass */ -static void routing_parse_Srandom(void); /*random bypass */ -static void routing_parse_Erandom(void); /*random bypass */ +static void routing_parse_Scluster(void); /* cluster bypass */ +static void routing_parse_Speer(void); /* peer bypass */ +static void routing_parse_Srandom(void); /* random bypass */ +static void routing_parse_Erandom(void); /* random bypass */ -static void routing_parse_Sconfig(void); /*config Tag */ -static void routing_parse_Econfig(void); /*config Tag */ +static void routing_parse_Sconfig(void); /* config Tag */ +static void routing_parse_Econfig(void); /* config Tag */ static char* replace_random_parameter(char * chaine); static void clean_dict_random(void); @@ -89,7 +87,7 @@ typedef enum { } e_routing_types; -/* must be finish with null and carefull if change de order */ +/* must finish with NULL and be careful if the order is changed */ struct s_model_type routing_models[] = { {"Full", "Full routing data (fast, large memory requirements, fully expressive)", model_full_create, @@ -171,7 +169,7 @@ static char *gw_dst = NULL; /* temporary store the gateway destination name static xbt_dynar_t link_list = NULL; /* temporary store of current list link of a route */ -static double eculidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) +static double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) { double src_coord, dst_coord; @@ -194,25 +192,12 @@ static double vivaldi_get_link_latency (routing_component_t rc,const char *src, if(dst_ctn == NULL || src_ctn == NULL) xbt_die("Coord src '%s' :%p dst '%s' :%p",src,src_ctn,dst,dst_ctn); - euclidean_dist = sqrt (eculidean_dist_comp(0,src_ctn,dst_ctn)+eculidean_dist_comp(1,src_ctn,dst_ctn)) + 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); return euclidean_dist; - - /* - x = atof(xbt_dynar_get_as(src_ctn, 0, char *))-atof(xbt_dynar_get_as(dst_ctn, 0, char *)); - y = atof(xbt_dynar_get_as(src_ctn, 1, char *)); - h = atof(xbt_dynar_get_as(ctn, 2, char *)); - sqrt((c1->x - c2->x) * (c1->x - c2->x) + (c1->y - c2->y) * (c1->y - c2->y)) + fabs(c1->h) + fabs(c2->h); - - if (strcmp(coord,"")) { - xbt_dynar_t ctn = xbt_str_split_str(coord, " "); - xbt_dynar_shrink(ctn,0); - xbt_lib_set(host_lib, host_id, COORD_HOST_LEVEL, ctn); - } - */ } /** @@ -734,8 +719,8 @@ static xbt_dynar_t elements_father(const char *src, const char *dst) * \param src the source host name * \param dst the destination host name * - * This fuction is call by "get_route". It allow to walk through the - * routing components tree. + * This function is called by "get_route". It allows to walk recursively + * through the routing components tree. */ static route_extended_t _get_route(const char *src, const char *dst) {