1 #include <Simulation.hpp>
\r
3 #include <Simulator.hpp>
\r
9 int Simulation::execute(int argc, char** argv)
\r
13 info("Usage: Msg platform_file deployment_file");
\r
17 // initialize the MSG simulator. Must be done before anything else (even logging).
\r
20 // the environment to load
\r
21 Environment environment;
\r
23 // the application to deploy
\r
24 Application application;
\r
27 Simulation simulation;
\r
29 // try to load the environment described by the xml file (argv[1])
\r
32 environment.load(argv[1]);
\r
34 catch(InvalidArgumentException e)
\r
40 catch(LogicException e)
\r
48 // try to deploy the application described by the xml file deployment (argv[2])
\r
51 application.deploy(argv[2]);
\r
52 catch(InvalidArgumentException e)
\r
58 catch(LogicException e)
\r
65 //try to run the simulation the given application on the given environment
\r
68 simulation.run(environment, application);
\r
70 catch(MsgException e)
\r
77 // finalize the MSG simulator
\r
83 catch(MsgExceptio e)
\r
92 void run(const Environment& rEnvironment, const Application& rApplication)
\r
93 throw (MsgException)
\r
95 if(MSG_OK != MSG_main())
\r
96 throw MsgException("MSG_main() failed");
\r
99 } // namespace SimGrid
\r