Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Integrate Bruno's work on SIMIX onto main stream. Tests are broken, but it looks...
[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  *    \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
19  * 
20  */
21
22 /********************************* MSG **************************************/
23
24 /** \ingroup msg_easier_life
25  * \brief A name directory service...
26  *
27  * Finds a m_host_t using its name.
28  * \param name the name of an host.
29  * \return the corresponding host
30  */
31 m_host_t MSG_get_host_by_name(const char *name)
32 {
33         smx_host_t simix_h = NULL;
34
35         simix_h = SIMIX_host_get_by_name(name);
36         if (simix_h == NULL) {
37                 return NULL;
38         }
39         else return (m_host_t)simix_h->data;
40 }
41
42 /** \ingroup msg_easier_life
43  * \brief A platform constructor.
44  *
45  * Creates a new platform, including hosts, links and the
46  * routing_table. 
47  * \param file a filename of a xml description of a platform. This file 
48  * follows this DTD :
49  *
50  *     \include surfxml.dtd
51  *
52  * Here is a small example of such a platform 
53  *
54  *     \include small_platform.xml
55  *
56  * Have a look in the directory examples/msg/ to have a big example.
57  */
58 void MSG_create_environment(const char *file) 
59 {
60   smx_host_t *workstation = NULL;
61         int i;
62
63         SIMIX_create_environment(file);
64
65         /* Initialize MSG hosts */
66         workstation = SIMIX_host_get_table();
67         for (i=0; i< SIMIX_host_get_number();i++) {
68                 __MSG_host_create(workstation[i], NULL);
69         }
70         xbt_free(workstation);
71   return;
72 }
73