}
}
+int platf_graph_is_connected(void) {
+ xbt_dynar_t dynar_nodes = NULL;
+ xbt_node_t graph_node = NULL;
+ context_node_t node_data = NULL;
+ unsigned int i;
+ dynar_nodes = xbt_graph_get_nodes(platform_graph);
+ xbt_dynar_foreach(dynar_nodes, i, graph_node) {
+ node_data = xbt_graph_node_get_data(graph_node);
+ if(node_data->degree==0) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
void platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters) {
node->kind = HOST;
memcpy(&(node->host_parameters), parameters, sizeof(s_sg_platf_host_cbarg_t));
unsigned int last_host = 0;
unsigned int last_router = 0;
- //unsigned int last_cluster = 0;
+ unsigned int last_cluster = 0;
sg_platf_host_cbarg_t host_parameters;
s_sg_platf_router_cbarg_t router_parameters; /* This one is not a pointer! */
nodes = xbt_graph_get_nodes(platform_graph);
- sg_platf_init();
sg_platf_begin();
surf_parse_init_callbacks();
routing_register_callbacks();
switch(node_data->kind) {
case HOST:
host_parameters = &node_data->host_parameters;
+ last_host++;
if(host_parameters->id == NULL) {
- host_parameters->id = bprintf("host-%d", ++last_host);
+ host_parameters->id = bprintf("host-%d", last_host);
}
sg_platf_new_host(host_parameters);
break;
case CLUSTER:
cluster_parameters = &node_data->cluster_parameters;
- //TODO: handle NULL IDs for clusters
+ last_cluster++;
+ if(cluster_parameters->prefix == NULL) {
+ cluster_parameters->prefix = "host-";
+ }
+ if(cluster_parameters->suffix == NULL) {
+ cluster_parameters->suffix = bprintf(".cluster-%d", last_cluster);
+ }
+ if(cluster_parameters->id == NULL) {
+ cluster_parameters->id = bprintf("cluster-%d", last_cluster);
+ }
sg_platf_new_cluster(cluster_parameters);
break;
case ROUTER: