Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'hypervisor' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid into hypervisor
[simgrid.git] / src / surf / surf_routing_none.c
1 /* Copyright (c) 2009, 2010, 2011. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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
7 #include "surf_routing_private.h"
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
10
11 static xbt_dynar_t none_get_onelink_routes(AS_t rc) {
12   return NULL;
13 }
14
15 static void none_get_route_and_latency(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst,
16     sg_platf_route_cbarg_t res,double *lat)
17 {
18   *lat = 0.0;
19 }
20
21 static void none_get_graph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, AS_t rc)
22 {
23         XBT_INFO("No routing no graph");
24 }
25
26 static sg_platf_route_cbarg_t none_get_bypass_route(AS_t rc,
27     sg_routing_edge_t src,
28     sg_routing_edge_t dst, double *lat) {
29   return NULL;
30 }
31
32 static int none_parse_PU(AS_t rc, sg_routing_edge_t elm) {
33   XBT_DEBUG("Load process unit \"%s\"", elm->name);
34   xbt_dynar_push_as(rc->index_network_elm,sg_routing_edge_t,elm);
35   /* don't care about PUs */
36   return -1;
37 }
38
39 static int none_parse_AS(AS_t rc, sg_routing_edge_t elm) {
40   XBT_DEBUG("Load Autonomous system \"%s\"", elm->name);
41   xbt_dynar_push_as(rc->index_network_elm,sg_routing_edge_t,elm);
42   /* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
43   return -1;
44 }
45
46 /* Creation routing model functions */
47 AS_t model_none_create() {
48   return model_none_create_sized(sizeof(s_as_t));
49 }
50 AS_t model_none_create_sized(size_t childsize) {
51   AS_t new_component = xbt_malloc0(childsize);
52   new_component->parse_PU = none_parse_PU;
53   new_component->parse_AS = none_parse_AS;
54   new_component->parse_route = NULL;
55   new_component->parse_ASroute = NULL;
56   new_component->parse_bypassroute = NULL;
57   new_component->get_route_and_latency = none_get_route_and_latency;
58   new_component->get_onelink_routes = none_get_onelink_routes;
59   new_component->get_bypass_route = none_get_bypass_route;
60   new_component->finalize = model_none_finalize;
61   new_component->get_graph = none_get_graph;
62   new_component->routing_sons = xbt_dict_new_homogeneous(NULL);
63   new_component->index_network_elm = xbt_dynar_new(sizeof(char*),NULL);
64
65   return new_component;
66 }
67
68 void model_none_finalize(AS_t as) {
69   xbt_dict_free(&as->routing_sons);
70   xbt_dynar_free(&as->index_network_elm);
71   xbt_dynar_free(&as->link_up_down_list);
72   xbt_free(as);
73 }
74