Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old $Id$ command dating from CVS
[simgrid.git] / src / msg / environment.c
1 /* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
2 /* Copyright (c) 2007 Bruno Donassolo.                                      */
3 /* All rights reserved.                                                     */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "msg/private.h"
9 #include "xbt/sysdep.h"
10 #include "xbt/log.h"
11 #include "xbt/dict.h"
12
13 /** \defgroup msg_easier_life      Platform and Application management
14  *  \brief This section describes functions to manage the platform creation
15  *  and the application deployment. You should also have a look at 
16  *  \ref MSG_examples  to have an overview of their usage.
17  */
18 /** @addtogroup msg_easier_life
19  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
20  * 
21  */
22
23 /********************************* MSG **************************************/
24
25 /** \ingroup msg_easier_life
26  * \brief A name directory service...
27  *
28  * Finds a m_host_t using its name.
29  * \param name the name of an host.
30  * \return the corresponding host
31  */
32 m_host_t MSG_get_host_by_name(const char *name)
33 {
34   smx_host_t simix_h = NULL;
35   simix_h = SIMIX_host_get_by_name(name);
36   
37   if (simix_h == NULL)
38     return NULL;
39
40   return (m_host_t)SIMIX_host_get_data(simix_h);
41 }
42
43 /** \ingroup msg_easier_life
44  * \brief A platform constructor.
45  *
46  * Creates a new platform, including hosts, links and the
47  * routing_table. 
48  * \param file a filename of a xml description of a platform. This file 
49  * follows this DTD :
50  *
51  *     \include simgrid.dtd
52  *
53  * Here is a small example of such a platform 
54  *
55  *     \include small_platform.xml
56  *
57  * Have a look in the directory examples/msg/ to have a big example.
58  */
59 void MSG_create_environment(const char *file)
60 {
61   xbt_dict_cursor_t c;
62   smx_host_t h;
63   char *name;
64
65   SIMIX_create_environment(file);
66   SIMIX_init();
67
68   /* Initialize MSG hosts */
69   xbt_dict_foreach(SIMIX_host_get_dict(), c, name, h) {
70     __MSG_host_create(h, NULL);
71   }
72   return;
73 }