Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bug fix.
[simgrid.git] / src / msg / environment.c
1 /*     $Id$      */
2
3 /* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
4 /* Copyright (c) 2007 Bruno Donassolo.                                      */
5 /* All rights reserved.                                                     */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "msg/private.h"
11 #include "xbt/sysdep.h"
12 #include "xbt/log.h"
13
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  */
19 /** @addtogroup msg_easier_life
20  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
21  * 
22  */
23
24 /********************************* MSG **************************************/
25
26 /** \ingroup msg_easier_life
27  * \brief A name directory service...
28  *
29  * Finds a m_host_t using its name.
30  * \param name the name of an host.
31  * \return the corresponding host
32  */
33 m_host_t MSG_get_host_by_name(const char *name)
34 {
35   smx_host_t simix_h = NULL;
36
37   simix_h = SIMIX_host_get_by_name(name);
38   if (simix_h == NULL) {
39     return NULL;
40   } else
41     return (m_host_t) simix_h->data;
42 }
43
44 /** \ingroup msg_easier_life
45  * \brief A platform constructor.
46  *
47  * Creates a new platform, including hosts, links and the
48  * routing_table. 
49  * \param file a filename of a xml description of a platform. This file 
50  * follows this DTD :
51  *
52  *     \include surfxml.dtd
53  *
54  * Here is a small example of such a platform 
55  *
56  *     \include small_platform.xml
57  *
58  * Have a look in the directory examples/msg/ to have a big example.
59  */
60 void MSG_create_environment(const char *file)
61 {
62   smx_host_t *workstation = NULL;
63   int i;
64
65   SIMIX_create_environment(file);
66
67   /* Initialize MSG hosts */
68   workstation = SIMIX_host_get_table();
69   for (i = 0; i < SIMIX_host_get_number(); i++) {
70     __MSG_host_create(workstation[i], NULL);
71   }
72   xbt_free(workstation);
73   return;
74 }