Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simgrid_get_all_hosts was redundant with existing sg_host_list
[simgrid.git] / include / simgrid / engine.h
1 /* Copyright (c) 2018-2020. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef INCLUDE_SIMGRID_ENGINE_H_
7 #define INCLUDE_SIMGRID_ENGINE_H_
8
9 #include <simgrid/forward.h>
10 #include <stddef.h>
11
12 SG_BEGIN_DECL /* C interface */
13 /** Initialize the SimGrid engine, taking the command line parameters of your main function. */
14 XBT_PUBLIC void simgrid_init(int* argc, char** argv);
15
16 /** Creates a new platform, including hosts, links, and the routing table.
17  *
18  * \beginrst
19  * See also: :ref:`platform`.
20  * \endrst
21  */
22 XBT_PUBLIC void simgrid_load_platform(const char* filename);
23 /** Load a deployment file and launch the actors that it contains
24  *
25  * \beginrst
26  * See also: :ref:`deploy`.
27  * \endrst
28  */
29 XBT_PUBLIC void simgrid_load_deployment(const char* filename);
30 /** Run the simulation after initialization */
31 XBT_PUBLIC void simgrid_run();
32 /** Registers the main function of an actor that will be launched from the deployment file */
33 XBT_PUBLIC void simgrid_register_function(const char* name, void (*code)(int, char**));
34 /** Registers a function as the default main function of actors
35  *
36  * It will be used as fallback when the function requested from the deployment file was not registered.
37  * It is used for trace-based simulations (see examples/s4u/replay-comms and similar).
38  */
39 XBT_PUBLIC void simgrid_register_default(void (*code)(int, char**));
40 /** Retrieve the simulation time (in seconds) */
41 XBT_PUBLIC double simgrid_get_clock();
42 /** Retrieve the number of actors in the simulation */
43 XBT_PUBLIC int simgrid_get_actor_count();
44
45 /** @brief Allow other libraries to react to the --help flag, too
46  *
47  * When finding --help on the command line, simgrid usually stops right after displaying its help message.
48  * If you are writing a library using simgrid, you may want to display your own help message before everything stops.
49  * If so, just call this function before having simgrid parsing the command line, and you will be given the control
50  * even if the user is asking for help.
51  */
52 XBT_PUBLIC void sg_config_continue_after_help();
53
54 SG_END_DECL
55
56 #endif /* INCLUDE_SIMGRID_ENGINE_H_ */