projects
/
mtp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renamed the Tracker class to MTPTracker.
[mtp.git]
/
mtp_tracker.cc
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
(file)
--- a/
tracker.cc
+++ b/
mtp_tracker.cc
@@
-22,13
+22,13
@@
*
*/
*
*/
-#include "tracker.h"
+#include "
mtp_
tracker.h"
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
-void Tracker::free() {
+void
MTP
Tracker::free() {
delete[] _edge_lengths;
delete _graph;
deallocate_array<scalar_t>(detection_scores);
delete[] _edge_lengths;
delete _graph;
deallocate_array<scalar_t>(detection_scores);
@@
-37,7
+37,7
@@
void Tracker::free() {
delete[] entrances;
}
delete[] entrances;
}
-void Tracker::allocate(int nb_time_steps, int nb_locations) {
+void
MTP
Tracker::allocate(int nb_time_steps, int nb_locations) {
free();
_nb_locations = nb_locations;
free();
_nb_locations = nb_locations;
@@
-67,7
+67,7
@@
void Tracker::allocate(int nb_time_steps, int nb_locations) {
_graph = 0;
}
_graph = 0;
}
-void Tracker::write(ostream *os) {
+void
MTP
Tracker::write(ostream *os) {
(*os) << _nb_locations << " " << _nb_time_steps <<endl;
(*os) << endl;
(*os) << _nb_locations << " " << _nb_time_steps <<endl;
(*os) << endl;
@@
-103,7
+103,7
@@
void Tracker::write(ostream *os) {
}
}
}
}
-void Tracker::read(istream *is) {
+void
MTP
Tracker::read(istream *is) {
int nb_locations, nb_time_steps;
(*is) >> nb_locations >> nb_time_steps;
int nb_locations, nb_time_steps;
(*is) >> nb_locations >> nb_time_steps;
@@
-131,7
+131,7
@@
void Tracker::read(istream *is) {
}
}
}
}
-void Tracker::write_trajectories(ostream *os) {
+void
MTP
Tracker::write_trajectories(ostream *os) {
for(int t = 0; t < nb_trajectories(); t++) {
(*os) << t
<< " " << trajectory_entrance_time(t)
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::MTP
Tracker() {
_nb_locations = 0;
_nb_time_steps = 0;
_nb_locations = 0;
_nb_time_steps = 0;
@@
-158,7
+158,7
@@
Tracker::Tracker() {
_graph = 0;
}
_graph = 0;
}
-
Tracker::~
Tracker() {
+
MTPTracker::~MTP
Tracker() {
delete[] _edge_lengths;
delete _graph;
deallocate_array<scalar_t>(detection_scores);
delete[] _edge_lengths;
delete _graph;
deallocate_array<scalar_t>(detection_scores);
@@
-167,15
+167,15
@@
Tracker::~Tracker() {
delete[] entrances;
}
delete[] entrances;
}
-int Tracker::early_pair_node(int t, int l) {
+int
MTP
Tracker::early_pair_node(int t, int l) {
return 1 + (2 * (t + 0) + 0) * _nb_locations + l;
}
return 1 + (2 * (t + 0) + 0) * _nb_locations + l;
}
-int Tracker::late_pair_node(int t, int l) {
+int
MTP
Tracker::late_pair_node(int t, int l) {
return 1 + (2 * (t + 0) + 1) * _nb_locations + l;
}
return 1 + (2 * (t + 0) + 1) * _nb_locations + l;
}
-void Tracker::build_graph() {
+void
MTP
Tracker::build_graph() {
// Delete the existing graph if there was one
delete[] _edge_lengths;
delete _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;
}
delete[] node_to;
}
-void Tracker::print_graph_dot(ostream *os) {
+void
MTP
Tracker::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++) {
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);
}
_graph->print_dot(os);
}
-void Tracker::track() {
+void
MTP
Tracker::track() {
ASSERT(_graph);
int e = 0;
ASSERT(_graph);
int e = 0;
@@
-323,22
+323,22
@@
void Tracker::track() {
#endif
}
#endif
}
-int Tracker::nb_trajectories() {
+int
MTP
Tracker::nb_trajectories() {
return _graph->nb_paths;
}
return _graph->nb_paths;
}
-scalar_t Tracker::trajectory_score(int k) {
+scalar_t
MTP
Tracker::trajectory_score(int k) {
return -_graph->paths[k]->length;
}
return -_graph->paths[k]->length;
}
-int Tracker::trajectory_entrance_time(int k) {
+int
MTP
Tracker::trajectory_entrance_time(int k) {
return (_graph->paths[k]->nodes[1] - 1) / (2 * _nb_locations);
}
return (_graph->paths[k]->nodes[1] - 1) / (2 * _nb_locations);
}
-int Tracker::trajectory_duration(int k) {
+int
MTP
Tracker::trajectory_duration(int k) {
return (_graph->paths[k]->nb_nodes - 2) / 2;
}
return (_graph->paths[k]->nb_nodes - 2) / 2;
}
-int Tracker::trajectory_location(int k, int time_from_entry) {
+int
MTP
Tracker::trajectory_location(int k, int time_from_entry) {
return (_graph->paths[k]->nodes[2 * time_from_entry + 1] - 1) % _nb_locations;
}
return (_graph->paths[k]->nodes[2 * time_from_entry + 1] - 1) % _nb_locations;
}