#define SG_PLATF_GEN_H
#include <xbt.h>
+#include <xbt/graph.h> //Only for platf_graph_get()
typedef enum {
ROUTER,
XBT_PUBLIC(void) platf_graph_interconnect_star(void);
+// WARNING : Only for debbugging ; should be removed when platform
+// generation works correctly
+XBT_PUBLIC(xbt_graph_t) platf_graph_get(void);
+
#endif /* SG_PLATF_GEN_H */
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) {
}
}
-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);
for(i=0 ; i<node_count ; i++) {
context_node_t node_data = NULL;
node_data = xbt_new(s_context_node_t, 1);
+ node_data->id = 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) {
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;