From: Jean-Baptiste Hervé Date: Tue, 31 Jul 2012 09:43:54 +0000 (+0200) Subject: Platform generation : add a function to set link parameters X-Git-Tag: v3_8~249 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/532c36067df658d3d25d9997f8c43a54cfa32477 Platform generation : add a function to set link parameters --- diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index 1a2843d36b..f9ae7e982a 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -34,6 +34,8 @@ XBT_PUBLIC(void) platf_graph_interconnect_exponential(double alpha); XBT_PUBLIC(void) platf_graph_promote_to_host(xbt_node_t node, sg_platf_host_cbarg_t parameters); XBT_PUBLIC(void) platf_graph_promote_to_cluster(xbt_node_t node, sg_platf_cluster_cbarg_t parameters); +XBT_PUBLIC(void) platf_graph_link_label(xbt_edge_t edge, sg_platf_link_cbarg_t parameters); + // WARNING : Only for debbugging ; should be removed when platform // generation works correctly XBT_PUBLIC(xbt_graph_t) platf_graph_get(void); diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index 6288b5b508..bcbe34c7e2 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -38,7 +38,7 @@ void platf_graph_init(unsigned long node_count) { for(i=0 ; iid = i+1; node_data->x = 0; node_data->y = 0; @@ -59,10 +59,10 @@ void platf_node_connect(xbt_node_t node1, xbt_node_t node2) { node1_data->degree++; node2_data->degree++; - 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); + context_edge_t edge_data = NULL; + edge_data = xbt_new0(s_context_edge_t, 1); + edge_data->id = ++last_link_id; + xbt_graph_new_edge(platform_graph, node1, node2, (void*)edge_data); } double platf_node_distance(xbt_node_t node1, xbt_node_t node2) { @@ -233,6 +233,10 @@ void platf_graph_promote_to_cluster(xbt_node_t node, sg_platf_cluster_cbarg_t pa memcpy(&(node_data->cluster_parameters), parameters, sizeof(s_sg_platf_cluster_cbarg_t)); } +void platf_graph_link_label(xbt_edge_t edge, sg_platf_link_cbarg_t parameters) { + context_edge_t edge_data = (context_edge_t) xbt_graph_edge_get_data(edge); + memcpy(&(edge_data->link_parameters), parameters, sizeof(s_sg_platf_link_cbarg_t)); +} /* Functions used to generate interesting random values */ diff --git a/src/surf/platf_generator_private.h b/src/surf/platf_generator_private.h index 0f3ab92e3b..400583420f 100644 --- a/src/surf/platf_generator_private.h +++ b/src/surf/platf_generator_private.h @@ -15,6 +15,11 @@ typedef struct s_context_node_t { }; } s_context_node_t, *context_node_t; +typedef struct s_context_edge_t { + unsigned long id; + s_sg_platf_link_cbarg_t link_parameters; +} s_context_edge_t, *context_edge_t; + void platf_graph_init(unsigned long node_count); void platf_node_connect(xbt_node_t node1, xbt_node_t node2);