X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1a1f5c6a6081df5233bc87e3c35f56e712c755c4..f089935bd7f01cce6409a827ffb06a46a151027e:/src/surf/platf_generator.c diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index 0726ae8e7e..1726e963b2 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -373,7 +373,7 @@ void platf_generate(void) { 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! */ @@ -395,14 +395,24 @@ void platf_generate(void) { 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: