Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
C++ify some forgotten part of surf
[simgrid.git] / src / include / surf / surf.hpp
1 /* Copyright (c) 2004-2018. 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 SURF_SURF_H
7 #define SURF_SURF_H
8
9 #include "simgrid/forward.h"
10 #include "xbt/graph.h"
11
12 /***************************/
13 /* Generic model object */
14 /***************************/
15
16 /** @{ @ingroup SURF_c_bindings */
17
18 /**
19  * @brief Get the size of the running action set of a model
20  *
21  * @param model The model
22  * @return The size of the running action set
23  */
24 XBT_PUBLIC int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
25
26 /**
27  * @brief [brief description]
28  * @details [long description]
29  *
30  * @param action The surf cpu action
31  * @param bound [description]
32  */
33 XBT_PUBLIC void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
34
35 /** @} */
36
37 /**************************************/
38 /* Implementations of model object */
39 /**************************************/
40
41 /** \ingroup SURF_models
42  *  \brief The CPU model object for the physical machine layer
43  */
44 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_pm;
45
46 /** \ingroup SURF_models
47  *  \brief The CPU model object for the virtual machine layer
48  */
49 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_vm;
50
51 XBT_PUBLIC_DATA simgrid::surf::StorageModel* surf_storage_model;
52
53 /** \ingroup SURF_models
54  *  \brief The host model
55  *
56  *  Note that when you create an API on top of SURF, the host model should be the only one you use
57  *  because depending on the platform model, the network model and the CPU model may not exist.
58  */
59 XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
60
61
62 /*** SURF Globals **************************/
63
64 /** \ingroup SURF_simulation
65  *  \brief Initialize SURF
66  *  \param argc argument number
67  *  \param argv arguments
68  *
69  *  This function has to be called to initialize the common structures. Then you will have to create the environment by
70  *  calling  e.g. surf_host_model_init_CM02()
71  *
72  *  \see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
73  */
74 XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
75
76 /** \ingroup SURF_simulation
77  *  \brief Finish simulation initialization
78  *
79  *  This function must be called before the first call to surf_solve()
80  */
81 XBT_PUBLIC void surf_presolve();
82
83 /** \ingroup SURF_simulation
84  *  \brief Performs a part of the simulation
85  *  \param max_date Maximum date to update the simulation to, or -1
86  *  \return the elapsed time, or -1.0 if no event could be executed
87  *
88  *  This function execute all possible events, update the action states  and returns the time elapsed.
89  *  When you call execute or communicate on a model, the corresponding actions are not executed immediately but only
90  *  when you call surf_solve.
91  *  Note that the returned elapsed time can be zero.
92  */
93 XBT_PUBLIC double surf_solve(double max_date);
94
95 /** \ingroup SURF_simulation
96  *  \brief Return the current time
97  *
98  *  Return the current time in millisecond.
99  */
100 XBT_PUBLIC double surf_get_clock();
101
102 /** \ingroup SURF_simulation
103  *  \brief Exit SURF
104  *
105  *  Clean everything.
106  *
107  *  \see surf_init()
108  */
109 XBT_PUBLIC void surf_exit();
110
111 /* surf parse file related (public because called from a test suite) */
112 XBT_PUBLIC void parse_platform_file(const char* file);
113
114 #endif