Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement symetrical for route.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 27 Oct 2010 10:42:07 +0000 (10:42 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 27 Oct 2010 10:42:07 +0000 (10:42 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8459 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/surf_routing.c
teshsuite/simdag/platforms/two_hosts_one_link.xml

index 8907c71..99c0d19 100644 (file)
@@ -330,8 +330,8 @@ static void parse_E_route_store_route(void)
 {
   route_t route = xbt_new0(s_route_t, 1);
   route->link_list = link_list;
 {
   route_t route = xbt_new0(s_route_t, 1);
   route->link_list = link_list;
-//   xbt_assert1(generic_processing_units_exist(current_routing,src),"the \"%s\" processing units gateway does not exist",src);
-//   xbt_assert1(generic_processing_units_exist(current_routing,dst),"the \"%s\" processing units gateway does not exist",dst);
+  xbt_assert1(generic_processing_units_exist(current_routing,src),"the \"%s\" processing units gateway does not exist",src);
+  xbt_assert1(generic_processing_units_exist(current_routing,dst),"the \"%s\" processing units gateway does not exist",dst);
   xbt_assert1(current_routing->set_route,
               "no defined method \"set_route\" in \"%s\"",
               current_routing->name);
   xbt_assert1(current_routing->set_route,
               "no defined method \"set_route\" in \"%s\"",
               current_routing->name);
@@ -2486,6 +2486,8 @@ static void generic_set_route(routing_component_t rc, const char *src,
   xbt_dict_t _to_index;
   char *route_name;
   int *src_id, *dst_id;
   xbt_dict_t _to_index;
   char *route_name;
   int *src_id, *dst_id;
+  unsigned long nb_links = xbt_dynar_length(route->link_list);
+
   _to_index = current_routing->to_index;
   //TODO
   _parse_routes = current_routing->parse_routes;
   _to_index = current_routing->to_index;
   //TODO
   _parse_routes = current_routing->parse_routes;
@@ -2506,6 +2508,21 @@ static void generic_set_route(routing_component_t rc, const char *src,
 
   xbt_dict_set(_parse_routes, route_name, route, NULL);
   xbt_free(route_name);
 
   xbt_dict_set(_parse_routes, route_name, route, NULL);
   xbt_free(route_name);
+
+  if(A_surfxml_route_symetrical == A_surfxml_route_symetrical_YES)
+  {
+         int i;
+         route_t route_sym = xbt_new0(s_route_t, 1);
+         route_sym->link_list = xbt_dynar_new(sizeof(char *),NULL);
+         for(i=nb_links ; i>0 ; i--)
+         {
+                char *link_name = xbt_new0(char,strlen(xbt_dynar_get_as(route->link_list, i-1, char *)));
+                link_name = bprintf("%s",xbt_dynar_get_as(route->link_list, i-1, char *));
+                xbt_dynar_push_as(route_sym->link_list ,char *, link_name);
+         }
+         DEBUG2("Load Route from \"%s\" to \"%s\"", dst, src);
+         xbt_dict_set(_parse_routes, bprintf("%d#%d",*dst_id, *src_id), route_sym, NULL);
+   }
 }
 
 static void generic_set_ASroute(routing_component_t rc, const char *src,
 }
 
 static void generic_set_ASroute(routing_component_t rc, const char *src,
index 976d28d..372e7bc 100644 (file)
@@ -6,13 +6,14 @@
    <host id="alice" power="500000000"/>
  
    <link id="link1" bandwidth="125000000" latency="5E-5"/>
    <host id="alice" power="500000000"/>
  
    <link id="link1" bandwidth="125000000" latency="5E-5"/>
-   <route src="bob" dst="alice">
-     <link_ctn id="link1"/>
-   </route>
-   <route src="alice" dst="bob">
+   <link id="link2" bandwidth="125000000" latency="5E-5"/>
+   <link id="link3" bandwidth="125000000" latency="5E-5"/>
+   
+   <route src="bob" dst="alice" symetrical="YES">
      <link_ctn id="link1"/>
      <link_ctn id="link1"/>
+        <link_ctn id="link2"/>
+        <link_ctn id="link3"/>
    </route>
    </route>
+
  </AS>
  </platform>
  </AS>
  </platform>