} s_surf_model_description_t, *surf_model_description_t;
XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *table,
- int table_size,
- const char* name,
- surf_model_t model
- );
+ const char* name,
+ surf_model_t model
+ );
XBT_PUBLIC(int) find_model_description(s_surf_model_description_t *table,
- int table_size,
- const char* name);
+ const char* name);
/** \brief Action structure
* \ingroup SURF_actions
*/
XBT_PUBLIC(void) surf_cpu_model_init_Cas01(const char *filename);
-#define surf_cpu_model_description_size 1
/** \brief The list of all available cpu model models
* \ingroup SURF_models
*/
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[surf_cpu_model_description_size];
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
/* Network model */
XBT_PUBLIC(void) surf_network_model_init_SDP(const char *filename);
#endif
-#if (HAVE_GTNETS)
-# define inc_GT 1
-#else
-# define inc_GT 0
-#endif
-#if (HAVE_SDP)
-# define inc_SDP 1
-#else
-# define inc_SDP 0
-#endif
-
-#define surf_network_model_description_size 5+inc_SDP+inc_GT
-
/** \brief The list of all available network model models
* \ingroup SURF_models
*/
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_network_model_description[surf_network_model_description_size];
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_network_model_description[];
/** \brief Workstation model extension public
* \ingroup SURF_models
*/
XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char *filename);
-#define surf_workstation_model_description_size 4
/** \brief The list of all available workstation model models
* \ingroup SURF_models
*/
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_workstation_model_description[surf_workstation_model_description_size];
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_workstation_model_description[];
/** \brief The network links
* \ingroup SURF_models
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sd_cfg_set, name);
- find_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- val);
+ find_model_description(surf_workstation_model_description, val);
}
/* callback of the cpu_model variable */
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sd_cfg_set, name);
- find_model_description(surf_cpu_model_description,
- surf_cpu_model_description_size, val);
+ find_model_description(surf_cpu_model_description, val);
}
/* callback of the workstation_model variable */
"Cannot change the model after the initialization");
val = xbt_cfg_get_string(_sd_cfg_set, name);
- find_model_description(surf_network_model_description,
- surf_network_model_description_size, val);
+ find_model_description(surf_network_model_description, val);
}
XBT_LOG_EXTERNAL_CATEGORY(sd_kernel);
DEBUG1("Model : %s", workstation_model_name);
workstation_id =
find_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- workstation_model_name);
+ workstation_model_name);
if (!strcmp(workstation_model_name, "compound")) {
xbt_ex_t e;
char *network_model_name = NULL;
network_id =
find_model_description(surf_network_model_description,
- surf_network_model_description_size,
- network_model_name);
+ network_model_name);
cpu_id =
find_model_description(surf_cpu_model_description,
- surf_cpu_model_description_size,
- cpu_model_name);
+ cpu_model_name);
surf_cpu_model_description[cpu_id].model_init(platform_file);
surf_network_model_description[network_id].model_init(platform_file);
val = xbt_cfg_get_string(_simix_cfg_set, name);
/* New Module missing */
- find_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- val);
+ find_model_description(surf_workstation_model_description,val);
}
/* callback of the cpu_model variable */
val = xbt_cfg_get_string(_simix_cfg_set, name);
/* New Module missing */
- find_model_description(surf_cpu_model_description,
- surf_cpu_model_description_size, val);
+ find_model_description(surf_cpu_model_description, val);
}
/* callback of the workstation_model variable */
val = xbt_cfg_get_string(_simix_cfg_set, name);
/* New Module missing */
- find_model_description(surf_network_model_description,
- surf_network_model_description_size, val);
+ find_model_description(surf_network_model_description, val);
}
XBT_LOG_EXTERNAL_CATEGORY(simix);
DEBUG1("Model : %s", workstation_model_name);
workstation_id =
find_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- workstation_model_name);
+ workstation_model_name);
if (!strcmp(workstation_model_name, "compound")) {
xbt_ex_t e;
char *network_model_name = NULL;
network_id =
find_model_description(surf_network_model_description,
- surf_network_model_description_size,
- network_model_name);
+ network_model_name);
cpu_id =
find_model_description(surf_cpu_model_description,
- surf_cpu_model_description_size,
- cpu_model_name);
+ cpu_model_name);
surf_cpu_model_description[cpu_id].model_init(file);
surf_network_model_description[network_id].model_init(file);
network_solve = lmm_solve;
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "CM02",
- (surf_model_t) surf_network_model);
+ "CM02",
+ (surf_model_t) surf_network_model);
}
void surf_network_model_init_Reno(const char *filename)
network_solve = lagrange_solve;
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "Reno",
- (surf_model_t) surf_network_model);
+ "Reno",
+ (surf_model_t) surf_network_model);
}
network_solve = lagrange_solve;
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "Reno2",
- (surf_model_t) surf_network_model);
+ "Reno2",
+ (surf_model_t) surf_network_model);
}
void surf_network_model_init_Vegas(const char *filename)
network_solve = lagrange_solve;
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "Vegas",
- (surf_model_t) surf_network_model);
+ "Vegas",
+ (surf_model_t) surf_network_model);
}
#ifdef HAVE_SDP
network_solve = sdp_solve;
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "SDP",
- (surf_model_t) surf_network_model);
+ "SDP",
+ (surf_model_t) surf_network_model);
}
#endif
xbt_dynar_push(model_list, &surf_network_model);
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "GTNets",
- (surf_model_t) surf_network_model);
+ "GTNets",
+ (surf_model_t) surf_network_model);
}
#endif
xbt_dynar_push(model_list, &surf_network_model);
update_model_description(surf_network_model_description,
- surf_network_model_description_size,
- "Constant",
- (surf_model_t) surf_network_model);
+ "Constant",
+ (surf_model_t) surf_network_model);
}
};
-s_surf_model_description_t surf_network_model_description[surf_network_model_description_size] = {
+s_surf_model_description_t surf_network_model_description[] = {
{"Constant", NULL, surf_network_model_init_Constant},
{"CM02", NULL, surf_network_model_init_CM02},
#ifdef HAVE_GTNETS
#endif
{"Reno", NULL, surf_network_model_init_Reno},
{"Reno2", NULL, surf_network_model_init_Reno2},
- {"Vegas", NULL, surf_network_model_init_Vegas}
+ {"Vegas", NULL, surf_network_model_init_Vegas},
+ { NULL,NULL,NULL} /* this array must be NULL terminated */
};
-s_surf_model_description_t surf_cpu_model_description[surf_cpu_model_description_size] = {
+s_surf_model_description_t surf_cpu_model_description[] = {
{"Cas01", NULL, surf_cpu_model_init_Cas01},
+ { NULL,NULL,NULL} /* this array must be NULL terminated */
};
-s_surf_model_description_t surf_workstation_model_description[surf_workstation_model_description_size] = {
+s_surf_model_description_t surf_workstation_model_description[] = {
{"CLM03", NULL, surf_workstation_model_init_CLM03, create_workstations},
{"compound", NULL, surf_workstation_model_init_compound, create_workstations},
- {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL}
+ {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL},
+ { NULL,NULL,NULL} /* this array must be NULL terminated */
};
void update_model_description(s_surf_model_description_t * table,
- int table_size,
- const char *name,
- surf_model_t model)
+ const char *name,
+ surf_model_t model)
{
- int i = find_model_description(table, table_size, name);
+ int i = find_model_description(table, name);
table[i].model = model;
}
int find_model_description(s_surf_model_description_t * table,
- int table_size, const char *name)
+ const char *name)
{
int i;
char *name_list = NULL;
- for (i = 0; i < table_size; i++)
+ for (i = 0; table[i].name; i++)
if (!strcmp(name, table[i].name)) {
return i;
}
name_list = strdup(table[0].name);
- for (i = 1; i < table_size; i++) {
+ for (i = 1; table[i].name; i++) {
name_list =
xbt_realloc(name_list,
strlen(name_list) + strlen(table[i].name) + 2);
surf_cpu_model_init_Cas01(filename);
surf_network_model_init_CM02(filename);
update_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- "CLM03",
- (surf_model_t) surf_workstation_model);
+ "CLM03",
+ (surf_model_t) surf_workstation_model);
xbt_dynar_push(model_list, &surf_workstation_model);
}
surf_workstation_model_init_internal();
update_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- "compound",
- (surf_model_t) surf_workstation_model);
+ "compound",
+ (surf_model_t) surf_workstation_model);
xbt_dynar_push(model_list, &surf_workstation_model);
}
define_callbacks(filename);
update_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- "ptask_L07",
- (surf_model_t) surf_workstation_model);
+ "ptask_L07",
+ (surf_model_t) surf_workstation_model);
xbt_dynar_push(model_list, &surf_workstation_model);
}