1 /* Copyright (c) 2009, 2010, 2011. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "surf_routing_private.h"
9 extern routing_global_t global_routing;
10 extern routing_component_t current_routing;
11 extern model_type_t current_routing_model;
12 extern xbt_dynar_t link_list;
13 extern xbt_dict_t cluster_host_link;
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
17 /* This routing is specifically setup to represent clusters, aka homogeneous sets of machines
18 * Note that a router is created, easing the interconnexion with the rest of the world.
22 s_routing_component_t generic_routing;
23 xbt_dict_t dict_processing_units;
24 xbt_dict_t dict_autonomous_systems;
25 } s_routing_component_cluster_t, *routing_component_cluster_t;
27 /* Business methods */
28 static route_extended_t cluster_get_route(routing_component_t rc,
32 xbt_dynar_t links_list = xbt_dynar_new(global_routing->size_of_link, NULL);
34 surf_parsing_link_up_down_t info;
36 info = xbt_dict_get_or_null(cluster_host_link,src);
37 if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_up
39 info = xbt_dict_get_or_null(cluster_host_link,rc->name);
40 if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_bb
42 info = xbt_dict_get_or_null(cluster_host_link,dst);
43 if(info) xbt_dynar_push_as(links_list,void*,info->link_down); //link_down
45 route_extended_t new_e_route = NULL;
46 new_e_route = xbt_new0(s_route_extended_t, 1);
47 new_e_route->generic_route.link_list = links_list;
52 /* Creation routing model functions */
53 void *model_cluster_create(void)
55 routing_component_cluster_t new_component = model_rulebased_create();
56 new_component->generic_routing.get_route = cluster_get_route;