X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8648556e63e965fc3976fae86c4cb7c44b827280..d70aa4f0453eeef031df1154d0236ae7a28208e6:/src/surf/platf_generator.c diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index c8f49372c9..3a2e44b589 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -9,6 +9,14 @@ static xbt_graph_t platform_graph = NULL; static RngStream rng_stream = NULL; +static unsigned long last_link_id = 0; + +xbt_graph_t platf_graph_get(void) { + // We need some debug, so let's add this function + // WARNING : shold be removed when it becomes useless + return platform_graph; +} + void platf_random_seed(unsigned long seed[6]) { if(rng_stream == NULL) { @@ -20,8 +28,8 @@ void platf_random_seed(unsigned long seed[6]) { } } -void platf_graph_init(int node_count) { - int i; +void platf_graph_init(unsigned long node_count) { + unsigned long i; platform_graph = xbt_graph_new_graph(FALSE, NULL); if(rng_stream == NULL) { rng_stream = RngStream_CreateStream(NULL); @@ -30,12 +38,16 @@ void platf_graph_init(int node_count) { for(i=0 ; iid = i+1; node_data->x = 0; node_data->y = 0; node_data->degree = 0; node_data->kind = ROUTER; xbt_graph_new_node(platform_graph, (void*) node_data); } + + last_link_id = 0; + } void platf_node_connect(xbt_node_t node1, xbt_node_t node2) { @@ -45,10 +57,14 @@ void platf_node_connect(xbt_node_t node1, xbt_node_t node2) { node2_data = (context_node_t) xbt_graph_node_get_data(node2); node1_data->degree++; node2_data->degree++; - xbt_graph_new_edge(platform_graph, node1, node2, NULL); + + unsigned long *link_id = xbt_new(unsigned long, 1); + *link_id = ++last_link_id; + + xbt_graph_new_edge(platform_graph, node1, node2, (void*)link_id); } -void platf_graph_uniform(int node_count) { +void platf_graph_uniform(unsigned long node_count) { xbt_dynar_t dynar_nodes = NULL; xbt_node_t graph_node = NULL; context_node_t node_data = NULL;