55 const double POSITIVE_INFINITY = std::numeric_limits<double>::max();
57 namespace swarm {
namespace monitors {
69 struct TutorialMonitor_params
71 double max_distance_from_origin;
73 TutorialMonitor_params(
const config &cfg)
75 max_distance_from_origin = cfg.optional(
"max_distance_from_origin",POSITIVE_INFINITY);
90 typedef TutorialMonitor_params params;
100 ensemble::SystemRef& _sys;
105 GPUAPI TutorialMonitor(
const params& p,ensemble::SystemRef& s,log_t& l)
106 :_params(p),_sys(s),_log(l){}
118 if(thread_in_system == 0)
120 bool need_to_take_action = is_there_any_ejection();
122 if(need_to_take_action)
149 GPUAPI
bool is_there_any_ejection()
151 for(
int b = 0; b < _sys.nbod(); b++){
152 double distance_to_origin = _sys[b].distance_to_origin();
153 if(distance_to_origin > _params.max_distance_from_origin)