Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Platform generation : add promotion functions
authorJean-Baptiste Hervé <jean-baptiste.herve@esial.net>
Tue, 31 Jul 2012 07:37:38 +0000 (09:37 +0200)
committerJean-Baptiste Hervé <jean-baptiste.herve@esial.net>
Tue, 31 Jul 2012 07:42:38 +0000 (09:42 +0200)
include/simgrid/platf_generator.h
src/surf/platf_generator.c
src/surf/platf_generator_private.h

index c831252..1a2843d 100644 (file)
@@ -9,8 +9,9 @@
 #ifndef SG_PLATF_GEN_H
 #define SG_PLATF_GEN_H
 
 #ifndef SG_PLATF_GEN_H
 #define SG_PLATF_GEN_H
 
-#include <xbt.h>
-#include <xbt/graph.h> //Only for platf_graph_get()
+#include "xbt.h"
+#include "xbt/graph.h" //Only for platf_graph_get()
+#include "platf.h"
 
 typedef enum {
   ROUTER,
 
 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_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);
 // WARNING : Only for debbugging ; should be removed when platform
 // generation works correctly
 XBT_PUBLIC(xbt_graph_t) platf_graph_get(void);
index 9d89091..6288b5b 100644 (file)
@@ -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) {
 /* Functions used to generate interesting random values */
 
 double random_pareto(double min, double max, double K, double P, double ALPHA) {
index 80a3390..0f3ab92 100644 (file)
@@ -1,13 +1,18 @@
 #ifndef SG_PLATF_GEN_PRIVATE_H
 #define SG_PLATF_GEN_PRIVATE_H
 
 #ifndef SG_PLATF_GEN_PRIVATE_H
 #define SG_PLATF_GEN_PRIVATE_H
 
-#include <xbt/graph.h>
+#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;
   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);
 } s_context_node_t, *context_node_t;
 
 void platf_graph_init(unsigned long node_count);