Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some new files of the cxx version of the MSG API
[simgrid.git] / src / cxx / Simulation.cxx
diff --git a/src/cxx/Simulation.cxx b/src/cxx/Simulation.cxx
new file mode 100644 (file)
index 0000000..6461932
--- /dev/null
@@ -0,0 +1,40 @@
+#include <Simulation.hpp>\r
+\r
+#include <Simulator.hpp>\r
+\r
+namespace SimGrid\r
+{\r
+       namespace Msg\r
+       {\r
+               int Simulation::execute(int argc, char** argv)\r
+               {\r
+                       if(argc < 3) \r
+                       {\r
+                     info("Usage: Msg platform_file deployment_file");\r
+                     return 1;\r
+                   }\r
+                   \r
+                        // initialize the MSG simulator. Must be done before anything else (even logging).\r
+               Simulator::init(argc, argv);\r
+                       \r
+                       // the environment to load\r
+                       Environment environment(argv[1]);\r
+                       // the application to deploy\r
+                       Application application(argv[2]);\r
+                       // the simulation\r
+                       Simulation simulation;\r
+                       \r
+                       // load the environment\r
+                       environment.load();\r
+                       \r
+                       // deploy the application\r
+                       application.deploy();\r
+                       \r
+                       // run the simulation\r
+                       simulation.run(environment, application);\r
+                       \r
+                       // finalize the simulator\r
+                       Simulator::finalize();\r
+               }\r
+       } // namespace Msg\r
+} // namespace SimGrid\r