Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
msg_simix alpha. All functions implemented.
[simgrid.git] / src / simix / smx_environment.c
1 /*      $Id$     */
2
3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
4    All rights reserved.                                          */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include "private.h"
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix,
13                                 "Logging specific to SIMIX (environment)");
14 /** \defgroup msg_easier_life      Platform and Application management
15  *  \brief This section describes functions to manage the platform creation
16  *  and the application deployment. You should also have a look at 
17  *  \ref MSG_examples  to have an overview of their usage.
18  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
19  * 
20  */
21
22 /********************************* SIMIX **************************************/
23
24
25
26 /** \ingroup msg_easier_life
27  * \brief A platform constructor.
28  *
29  * Creates a new platform, including hosts, links and the
30  * routing_table. 
31  * \param file a filename of a xml description of a platform. This file 
32  * follows this DTD :
33  *
34  *     \include surfxml.dtd
35  *
36  * Here is a small example of such a platform 
37  *
38  *     \include small_platform.xml
39  *
40  * Have a look in the directory examples/msg/ to have a big example.
41  */
42 void SIMIX_create_environment(const char *file) 
43 {
44   xbt_dict_cursor_t cursor = NULL;
45   char *name = NULL;
46   void *workstation = NULL;
47   char *workstation_model_name;
48
49   simix_config_init(); /* make sure that our configuration set is created */
50   surf_timer_resource_init(file);
51
52   /* which model do you want today? */
53   workstation_model_name = xbt_cfg_get_string (_simix_cfg_set, "surf_workstation_model");
54
55   DEBUG1("Model : %s", workstation_model_name);
56   if (!strcmp(workstation_model_name,"KCCFLN05")) {
57     surf_workstation_resource_init_KCCFLN05(file);
58   } else if (!strcmp(workstation_model_name,"KCCFLN05_proportionnal")) {
59     surf_workstation_resource_init_KCCFLN05_proportionnal(file);
60   } else if (!strcmp(workstation_model_name,"CLM03")) {
61     surf_workstation_resource_init_CLM03(file);
62   } else {
63     xbt_assert0(0,"The impossible happened (once again)");
64   }
65   _simix_init_status = 2; /* inited; don't change settings now */
66
67   xbt_dict_foreach(workstation_set, cursor, name, workstation) {
68     __SIMIX_host_create(name, workstation, NULL);
69   }
70
71   return;
72 }
73