Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. class PredatorPreyView : public artis::observer::View<artis::common::DoubleTime> {
  2. public:
  3. PredatorPreyView()
  4. {
  5. selector("PredatorView",
  6. {PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
  7. artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
  8. selector("PreyView",
  9. {PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
  10. artis::pdevs::qss::Integrator<artis::common::DoubleTime>::VALUE});
  11. }
  12. };
  13.  
  14. void run_predator_prey()
  15. {
  16. PreyPredatorGraphManagerParameters parameters = {{{45.},
  17. {true, true, 0.1, 3},
  18. {0.5, 0.01, 0.01, 0.2}},
  19. {{5000.},
  20. {true, true, 1, 3},
  21. {0.5, 0.01, 0.01, 0.2}}};
  22. artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
  23. artis::common::RootCoordinator<
  24. artis::common::DoubleTime, artis::pdevs::Coordinator<
  25. artis::common::DoubleTime,
  26. PreyPredatorGraphManager,
  27. PreyPredatorGraphManagerParameters>
  28. > rc(context, "root", parameters, artis::common::NoParameters());
  29.  
  30. rc.attachView("Value1", new PredatorPreyView());
  31.  
  32. rc.run(context);
  33.  
  34. artis::observer::Output<artis::common::DoubleTime> output(rc.observer());
  35.  
  36. output(0, 100, 0.1);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement