SimGrid  3.14.159
Versatile Simulation of Distributed Systems
simgrid::s4u::Engine Class Reference

Detailed Description

Simulation engine.

This class is an interface to the simulation engine.

Examples:
examples/s4u/launching/s4u_launching.cpp, and examples/s4u/mutex/s4u_mutex.cpp.

#include <engine.hpp>

Public Member Functions

 Engine (int *argc, char **argv)
 Constructor, taking the command line parameters of your main function. More...
 
void loadPlatform (const char *platf)
 Load a platform file describing the environment. More...
 
void registerFunction (const char *name, int(*code)(int, char **))
 Registers the main function of an actor that will be launched from the deployment file. More...
 
void registerDefault (int(*code)(int, char **))
 Registers a function as the default main function of actors. More...
 
void loadDeployment (const char *deploy)
 Load a deployment file and launch the actors that it contains. More...
 
void run ()
 Run the simulation. More...
 
simgrid::s4u::NetZonenetRoot ()
 Retrieve the root netzone, containing all others. More...
 
simgrid::s4u::NetZonenetzoneByNameOrNull (const char *name)
 Retrieve the netzone of the given name (or nullptr if not found) More...
 
simgrid::kernel::routing::NetCardnetcardByNameOrNull (const char *name)
 Retrieve the netcard of the given name (or nullptr if not found) More...
 
void netcardList (std::vector< simgrid::kernel::routing::NetCard *> *list)
 Fill the provided vector with all existing netcards. More...
 
void netcardRegister (simgrid::kernel::routing::NetCard *card)
 Register a new netcard to the system. More...
 
void netcardUnregister (simgrid::kernel::routing::NetCard *card)
 Unregister a given netcard. More...
 
template<class F >
void registerFunction (const char *name)
 
template<class F >
void registerFunction (const char *name, F code)
 

Static Public Member Functions

static void shutdown ()
 Finalize the default engine and all its dependencies. More...
 
static double getClock ()
 Retrieve the simulation time. More...
 
static s4u::Engineinstance ()
 Retrieve the engine singleton. More...
 

Public Attributes

simgrid::kernel::EngineImplpimpl
 

Constructor & Destructor Documentation

◆ Engine()

simgrid::s4u::Engine::Engine ( int *  argc,
char **  argv 
)

Constructor, taking the command line parameters of your main function.

Member Function Documentation

◆ shutdown()

void simgrid::s4u::Engine::shutdown ( )
static

Finalize the default engine and all its dependencies.

◆ loadPlatform()

void simgrid::s4u::Engine::loadPlatform ( const char *  platf)

Load a platform file describing the environment.

The environment is either a XML file following the simgrid.dtd formalism, or a lua file. Some examples can be found in the directory examples/platforms.

Examples:
examples/s4u/launching/s4u_launching.cpp, and examples/s4u/mutex/s4u_mutex.cpp.

◆ registerFunction() [1/3]

void simgrid::s4u::Engine::registerFunction ( const char *  name,
int(*)(int, char **)  code 
)

Registers the main function of an actor that will be launched from the deployment file.

Examples:
examples/s4u/launching/s4u_launching.cpp.

◆ registerDefault()

void simgrid::s4u::Engine::registerDefault ( int(*)(int, char **)  code)

Registers a function as the default main function of actors.

It will be used as fallback when the function requested from the deployment file was not registered. It is used for trace-based simulations (see examples/msg/actions).

◆ loadDeployment()

void simgrid::s4u::Engine::loadDeployment ( const char *  deploy)

Load a deployment file and launch the actors that it contains.

Examples:
examples/s4u/launching/s4u_launching.cpp.

◆ run()

void simgrid::s4u::Engine::run ( )

◆ getClock()

double simgrid::s4u::Engine::getClock ( )
static

Retrieve the simulation time.

◆ instance()

Engine * simgrid::s4u::Engine::instance ( )
static

Retrieve the engine singleton.

◆ netRoot()

s4u::NetZone * simgrid::s4u::Engine::netRoot ( )

Retrieve the root netzone, containing all others.

◆ netzoneByNameOrNull()

NetZone * simgrid::s4u::Engine::netzoneByNameOrNull ( const char *  name)

Retrieve the netzone of the given name (or nullptr if not found)

Retrieve the NetZone of the given name (or nullptr if not found)

◆ netcardByNameOrNull()

simgrid::kernel::routing::NetCard * simgrid::s4u::Engine::netcardByNameOrNull ( const char *  name)

Retrieve the netcard of the given name (or nullptr if not found)

◆ netcardList()

void simgrid::s4u::Engine::netcardList ( std::vector< simgrid::kernel::routing::NetCard *> *  list)

Fill the provided vector with all existing netcards.

◆ netcardRegister()

void simgrid::s4u::Engine::netcardRegister ( simgrid::kernel::routing::NetCard card)

Register a new netcard to the system.

◆ netcardUnregister()

void simgrid::s4u::Engine::netcardUnregister ( simgrid::kernel::routing::NetCard card)

Unregister a given netcard.

◆ registerFunction() [2/3]

template<class F >
void simgrid::s4u::Engine::registerFunction ( const char *  name)
inline

◆ registerFunction() [3/3]

template<class F >
void simgrid::s4u::Engine::registerFunction ( const char *  name,
code 
)
inline

Member Data Documentation

◆ pimpl

simgrid::kernel::EngineImpl* simgrid::s4u::Engine::pimpl

The documentation for this class was generated from the following files: