X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=mtp.git;a=blobdiff_plain;f=mtp_tracker.cc;fp=tracker.cc;h=af97ca58a8fa304359c71041e19401cedddf6a9e;hp=d19093b1860a2bb038ff69492f25196fc20eab8b;hb=f248d9481cd0338053cb38a18eb3898042c126d3;hpb=53da5d9421597dfc056b5727dbe7898afd30bdc9 diff --git a/tracker.cc b/mtp_tracker.cc similarity index 91% rename from tracker.cc rename to mtp_tracker.cc index d19093b..af97ca5 100644 --- a/tracker.cc +++ b/mtp_tracker.cc @@ -22,13 +22,13 @@ * */ -#include "tracker.h" +#include "mtp_tracker.h" #include using namespace std; -void Tracker::free() { +void MTPTracker::free() { delete[] _edge_lengths; delete _graph; deallocate_array(detection_scores); @@ -37,7 +37,7 @@ void Tracker::free() { delete[] entrances; } -void Tracker::allocate(int nb_time_steps, int nb_locations) { +void MTPTracker::allocate(int nb_time_steps, int nb_locations) { free(); _nb_locations = nb_locations; @@ -67,7 +67,7 @@ void Tracker::allocate(int nb_time_steps, int nb_locations) { _graph = 0; } -void Tracker::write(ostream *os) { +void MTPTracker::write(ostream *os) { (*os) << _nb_locations << " " << _nb_time_steps <> nb_locations >> nb_time_steps; @@ -131,7 +131,7 @@ void Tracker::read(istream *is) { } } -void Tracker::write_trajectories(ostream *os) { +void MTPTracker::write_trajectories(ostream *os) { for(int t = 0; t < nb_trajectories(); t++) { (*os) << t << " " << trajectory_entrance_time(t) @@ -144,7 +144,7 @@ void Tracker::write_trajectories(ostream *os) { } } -Tracker::Tracker() { +MTPTracker::MTPTracker() { _nb_locations = 0; _nb_time_steps = 0; @@ -158,7 +158,7 @@ Tracker::Tracker() { _graph = 0; } -Tracker::~Tracker() { +MTPTracker::~MTPTracker() { delete[] _edge_lengths; delete _graph; deallocate_array(detection_scores); @@ -167,15 +167,15 @@ Tracker::~Tracker() { delete[] entrances; } -int Tracker::early_pair_node(int t, int l) { +int MTPTracker::early_pair_node(int t, int l) { return 1 + (2 * (t + 0) + 0) * _nb_locations + l; } -int Tracker::late_pair_node(int t, int l) { +int MTPTracker::late_pair_node(int t, int l) { return 1 + (2 * (t + 0) + 1) * _nb_locations + l; } -void Tracker::build_graph() { +void MTPTracker::build_graph() { // Delete the existing graph if there was one delete[] _edge_lengths; delete _graph; @@ -288,7 +288,7 @@ void Tracker::build_graph() { delete[] node_to; } -void Tracker::print_graph_dot(ostream *os) { +void MTPTracker::print_graph_dot(ostream *os) { int e = 0; for(int t = 0; t < _nb_time_steps; t++) { for(int l = 0; l < _nb_locations; l++) { @@ -298,7 +298,7 @@ void Tracker::print_graph_dot(ostream *os) { _graph->print_dot(os); } -void Tracker::track() { +void MTPTracker::track() { ASSERT(_graph); int e = 0; @@ -323,22 +323,22 @@ void Tracker::track() { #endif } -int Tracker::nb_trajectories() { +int MTPTracker::nb_trajectories() { return _graph->nb_paths; } -scalar_t Tracker::trajectory_score(int k) { +scalar_t MTPTracker::trajectory_score(int k) { return -_graph->paths[k]->length; } -int Tracker::trajectory_entrance_time(int k) { +int MTPTracker::trajectory_entrance_time(int k) { return (_graph->paths[k]->nodes[1] - 1) / (2 * _nb_locations); } -int Tracker::trajectory_duration(int k) { +int MTPTracker::trajectory_duration(int k) { return (_graph->paths[k]->nb_nodes - 2) / 2; } -int Tracker::trajectory_location(int k, int time_from_entry) { +int MTPTracker::trajectory_location(int k, int time_from_entry) { return (_graph->paths[k]->nodes[2 * time_from_entry + 1] - 1) % _nb_locations; }