From: Jean-Baptiste Hervé Date: Tue, 31 Jul 2012 07:37:38 +0000 (+0200) Subject: Platform generation : add promotion functions X-Git-Tag: v3_8~251 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6d4992f55a13d3ac0133381d5d9779c08894db47 Platform generation : add promotion functions --- diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index c831252739..1a2843d36b 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -9,8 +9,9 @@ #ifndef SG_PLATF_GEN_H #define SG_PLATF_GEN_H -#include -#include //Only for platf_graph_get() +#include "xbt.h" +#include "xbt/graph.h" //Only for platf_graph_get() +#include "platf.h" typedef enum { ROUTER, @@ -30,6 +31,9 @@ XBT_PUBLIC(void) platf_graph_interconnect_clique(void); XBT_PUBLIC(void) platf_graph_interconnect_uniform(double alpha); 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); + // 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 9d890918fc..6288b5b508 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -221,6 +221,19 @@ void platf_graph_interconnect_exponential(double alpha) { } } +void platf_graph_promote_to_host(xbt_node_t node, sg_platf_host_cbarg_t parameters) { + context_node_t node_data = (context_node_t) xbt_graph_node_get_data(node); + node_data->kind = HOST; + memcpy(&(node_data->host_parameters), parameters, sizeof(s_sg_platf_host_cbarg_t)); +} + +void platf_graph_promote_to_cluster(xbt_node_t node, sg_platf_cluster_cbarg_t parameters) { + context_node_t node_data = (context_node_t) xbt_graph_node_get_data(node); + node_data->kind = CLUSTER; + memcpy(&(node_data->cluster_parameters), parameters, sizeof(s_sg_platf_cluster_cbarg_t)); +} + + /* Functions used to generate interesting random values */ double random_pareto(double min, double max, double K, double P, double ALPHA) { diff --git a/src/surf/platf_generator_private.h b/src/surf/platf_generator_private.h index 80a3390891..0f3ab92e3b 100644 --- a/src/surf/platf_generator_private.h +++ b/src/surf/platf_generator_private.h @@ -1,13 +1,18 @@ #ifndef SG_PLATF_GEN_PRIVATE_H #define SG_PLATF_GEN_PRIVATE_H -#include +#include "xbt/graph.h" +#include "simgrid/platf.h" -typedef struct { +typedef struct s_context_node_t { unsigned long id; double x, y; int degree; e_platf_node_kind kind; + union { + s_sg_platf_host_cbarg_t host_parameters; + s_sg_platf_cluster_cbarg_t cluster_parameters; + }; } s_context_node_t, *context_node_t; void platf_graph_init(unsigned long node_count);