Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename RoutingEdge into NetCard
[simgrid.git] / teshsuite / simdag / platforms / flatifier.c
index 5c33f70..462f159 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2014. The SimGrid Team.
+/* Copyright (c) 2008-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 #include <math.h>
 
 
-#include "simdag/simdag.h"
+#include "simgrid/simdag.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
 #include "xbt/ex.h"
 #include "xbt/xbt_os_time.h"
 #include "surf/surf.h"
-#include "surf/surf_private.h"
+#include "src/surf/surf_private.h"
 
 static const char link_ctn_v2[] =  "link:ctn";
 static const char link_ctn_v3[] = "link_ctn";
@@ -97,8 +97,8 @@ int main(int argc, char **argv)
   xbt_lib_cursor_t cursor_src = NULL;
   xbt_lib_cursor_t cursor_dst = NULL;
   char *src,*dst,*key,*data;
-  sg_routing_edge_t value1;
-  sg_routing_edge_t value2;
+  sg_netcard_t value1;
+  sg_netcard_t value2;
 
   const SD_workstation_t *hosts;
   const SD_link_t *links;
@@ -183,25 +183,25 @@ int main(int argc, char **argv)
           SD_link_get_name(links[i]),
           SD_link_get_current_bandwidth(links[i]),
           SD_link_get_current_latency(links[i]));
-      if (SD_link_get_sharing_policy(links[i]) == SD_LINK_SHARED) {
+      if (SD_link_is_shared(links[i])) {
         printf("/>\n");
       } else {
         printf(" sharing_policy=\"FATPIPE\"/>\n");
       }
     }
 
-
-    xbt_lib_foreach(host_lib, cursor_src, src, value1) // Routes from host
+    sg_host_t host1, host2;
+    xbt_dict_foreach(host_list, cursor_src, src, host1) // Routes from host
     {
-      value1 = xbt_lib_get_or_null(host_lib,src,ROUTING_HOST_LEVEL);
-      xbt_lib_foreach(host_lib, cursor_dst, dst, value2) //to host
+      value1 = sg_host_edge(sg_host_by_name(src));
+      xbt_dict_foreach(host_list, cursor_dst, dst, host2) //to host
       {
         printf("  <route src=\"%s\" dst=\"%s\">\n  "
             ,src
             ,dst);
         xbt_dynar_t route=NULL;
-        value2 = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
-        routing_get_route_and_latency(value1,value2,&route,NULL);
+        value2 = sg_host_edge(sg_host_by_name(dst));
+        routing_get_route_and_latency(value1, value2, &route,NULL);
         for(i=0;i<xbt_dynar_length(route) ;i++)
         {
           void *link = xbt_dynar_get_as(route,i,void *);
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
               ,dst);
           xbt_dynar_t route=NULL;
           value2 = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
-          routing_get_route_and_latency((sg_routing_edge_t)value1,(sg_routing_edge_t)value2,&route,NULL);
+          routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route,NULL);
           for(i=0;i<xbt_dynar_length(route) ;i++)
           {
             void *link = xbt_dynar_get_as(route,i,void *);
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
                 ,dst);
             xbt_dynar_t route=NULL;
             value2 = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
-            routing_get_route_and_latency((sg_routing_edge_t)value1,(sg_routing_edge_t)value2,&route,NULL);
+            routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route,NULL);
             for(i=0;i<xbt_dynar_length(route) ;i++)
             {
               void *link = xbt_dynar_get_as(route,i,void *);
@@ -258,13 +258,13 @@ int main(int argc, char **argv)
             printf("\n  </route>\n");
           }
           }
-        xbt_lib_foreach(host_lib, cursor_dst, dst, value2) //to host
+        xbt_dict_foreach(host_list, cursor_dst, dst, value2) //to host
         {
           printf("  <route src=\"%s\" dst=\"%s\">\n  "
               ,src, dst);
           xbt_dynar_t route=NULL;
-          value2 = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
-          routing_get_route_and_latency((sg_routing_edge_t)value1,(sg_routing_edge_t)value2,&route, NULL);
+          value2 = sg_host_edge(sg_host_by_name(dst));
+          routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route, NULL);
           for(i=0;i<xbt_dynar_length(route) ;i++)
           {
             void *link = xbt_dynar_get_as(route,i,void *);