From 31de00691f8eb97279b37125b3e67e0599ac35fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Baptiste=20Herv=C3=A9?= Date: Fri, 27 Jul 2012 12:04:39 +0200 Subject: [PATCH] Platform generation : add the "ring" topology --- include/simgrid/platf_generator.h | 1 + src/surf/platf_generator.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index 3b89513ce1..178f61ae96 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -25,6 +25,7 @@ XBT_PUBLIC(void) platf_graph_heavytailed(unsigned long node_count); XBT_PUBLIC(void) platf_graph_interconnect_star(void); XBT_PUBLIC(void) platf_graph_interconnect_line(void); +XBT_PUBLIC(void) platf_graph_interconnect_ring(void); // WARNING : Only for debbugging ; should be removed when platform // generation works correctly diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index 693e169576..1612a80f2d 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -128,6 +128,29 @@ void platf_graph_interconnect_line(void) { } } +void platf_graph_interconnect_ring(void) { + /* Create a simple topology where all nodes are connected along a ring */ + xbt_dynar_t dynar_nodes = NULL; + xbt_node_t graph_node = NULL; + xbt_node_t old_node = NULL; + xbt_node_t first_node = NULL; + unsigned int i; + + dynar_nodes = xbt_graph_get_nodes(platform_graph); + xbt_dynar_foreach(dynar_nodes, i, graph_node) { + if(i == 0) { + // this is the first node, let's keep it somewhere + first_node = graph_node; + } else { + //connect each node to the previous one + platf_node_connect(graph_node, old_node); + } + old_node = graph_node; + } + //we still have to connect the first and the last node together + platf_node_connect(first_node, graph_node); +} + /* Functions used to generate interesting random values */ -- 2.20.1