Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c547d80758ee8fe1830cbb1e39158050a30be625
[simgrid.git] / src / msg_simix / environment.c
1
2 #include "private.h"
3 #include "xbt/sysdep.h"
4 #include "xbt/log.h"
5
6 /** \defgroup msg_easier_life      Platform and Application management
7  *  \brief This section describes functions to manage the platform creation
8  *  and the application deployment. You should also have a look at 
9  *  \ref MSG_examples  to have an overview of their usage.
10  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
11  * 
12  */
13
14 /********************************* MSG **************************************/
15
16 /** \ingroup msg_easier_life
17  * \brief A name directory service...
18  *
19  * Finds a m_host_t using its name.
20  * \param name the name of an host.
21  * \return the corresponding host
22  */
23 m_host_t MSG_get_host_by_name(const char *name)
24 {
25         smx_host_t simix_h = NULL;
26
27         simix_h = SIMIX_host_get_by_name(name);
28         if (simix_h == NULL) {
29                 return NULL;
30         }
31         else return (m_host_t)simix_h->data;
32 }
33
34 /** \ingroup msg_easier_life
35  * \brief A platform constructor.
36  *
37  * Creates a new platform, including hosts, links and the
38  * routing_table. 
39  * \param file a filename of a xml description of a platform. This file 
40  * follows this DTD :
41  *
42  *     \include surfxml.dtd
43  *
44  * Here is a small example of such a platform 
45  *
46  *     \include small_platform.xml
47  *
48  * Have a look in the directory examples/msg/ to have a big example.
49  */
50 void MSG_create_environment(const char *file) 
51 {
52   smx_host_t *workstation = NULL;
53         int i;
54
55         SIMIX_create_environment(file);
56
57         /* Initialize MSG hosts */
58         workstation = SIMIX_host_get_table();
59         for (i=0; i< SIMIX_host_get_number();i++) {
60                 __MSG_host_create(workstation[i], NULL);
61         }
62   return;
63 }
64