Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix problem with get_route in Dijkstra.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 14 Dec 2010 16:16:34 +0000 (16:16 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 14 Dec 2010 16:16:34 +0000 (16:16 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9238 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/surf_routing.c

index 44a6e90..e675518 100644 (file)
@@ -2225,6 +2225,15 @@ static void model_dijkstra_both_end(void)
   unsigned int cursor2;
   xbt_dynar_t nodes = NULL;
 
+  /* Create the topology graph */
+  if(!routing->route_graph)
+  routing->route_graph = xbt_graph_new_graph(1, NULL);
+  if(!routing->graph_node_map)
+  routing->graph_node_map = xbt_dict_new();
+
+  if (routing->cached && !routing->route_cache)
+  routing->route_cache = xbt_dict_new();
+
   /* Add the loopback if needed */
   if (current_routing->hierarchy == SURF_ROUTING_BASE)
     add_loopback_dijkstra(routing);
@@ -2247,7 +2256,7 @@ static void model_dijkstra_both_set_route (routing_component_t rc, const char *s
        dst_id = xbt_dict_get_or_null(rc->to_index, dst);
 
     /* Create the topology graph */
-       if(!routing->route_cache)
+       if(!routing->route_graph)
        routing->route_graph = xbt_graph_new_graph(1, NULL);
        if(!routing->graph_node_map)
        routing->graph_node_map = xbt_dict_new();