Skip to content

Commit

Permalink
et
Browse files Browse the repository at this point in the history
  • Loading branch information
yakra committed Jan 14, 2021
2 parents bb4e450 + 7a67ce4 commit a08dd6c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions siteupdate/cplusplus/classes/GraphGeneration/HGVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ HGVertex::~HGVertex()
{ //std::cout << "deleting vertex at " << first_waypoint->str() << std::endl;
while (incident_s_edges.size()) delete incident_s_edges.front();
while (incident_c_edges.size()) delete incident_c_edges.front();
while (incident_t_edges.size()) delete incident_t_edges.front();
delete[] s_vertex_num;
delete[] c_vertex_num;
delete[] t_vertex_num;
}
9 changes: 6 additions & 3 deletions siteupdate/cplusplus/classes/GraphGeneration/HighwayGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ inline void HighwayGraph::matching_vertices_and_edges
std::unordered_set<HGVertex*> rvset; // union of all sets in regions
std::unordered_set<HGVertex*> svset; // union of all sets in systems
std::unordered_set<HGVertex*> pvset; // set of vertices within placeradius
std::unordered_set<TravelerList*> trav_set;

if (g.regions) for (Region *r : *g.regions)
rvset.insert(r->vertices.begin(), r->vertices.end());
Expand Down Expand Up @@ -231,7 +230,11 @@ inline void HighwayGraph::matching_vertices_and_edges
if (system_match)
{ mte.push_back(e);
e->t_written[threadnum] = 1;
for (TravelerList *t : e->segment->clinched_by) trav_set.insert(t);
for (TravelerList *t : e->segment->clinched_by)
if (!t->in_subgraph[threadnum])
{ traveler_lists.push_back(t);
t->in_subgraph[threadnum] = 1;
}
}
}
if (v->visibility < 2) continue;
Expand All @@ -252,7 +255,7 @@ inline void HighwayGraph::matching_vertices_and_edges
}
}
}
traveler_lists.assign(trav_set.begin(), trav_set.end());
for (TravelerList* t : traveler_lists) t->in_subgraph[threadnum] = 0;
traveler_lists.sort(sort_travelers_by_name);
}

Expand Down
2 changes: 2 additions & 0 deletions siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ TravelerList::TravelerList(std::string travname, std::string* updarr[], ErrorLis
preview_systems_traveled = 0;
preview_systems_clinched = 0;
unsigned int list_entries = 0;
in_subgraph = new bool[args->numthreads];
traveler_num = new unsigned int[args->numthreads];
// deleted on termination of program
for (size_t i = 0; i < args->numthreads; i++) in_subgraph[i] = 0;
traveler_name = travname.substr(0, travname.size()-5); // strip ".list" from end of travname
if (traveler_name.size() > DBFieldLength::traveler)
el->add_error("Traveler name " + traveler_name + " > " + std::to_string(DBFieldLength::traveler) + "bytes");
Expand Down
1 change: 1 addition & 0 deletions siteupdate/cplusplus/classes/TravelerList/TravelerList.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class TravelerList
std::unordered_map<Region*, double> active_only_mileage_by_region; // total mileage per region, active only
std::unordered_map<HighwaySystem*, std::unordered_map<Region*, double>> system_region_mileages; // mileage per region per system
std::unordered_set<Route*> routes;
bool* in_subgraph;
unsigned int *traveler_num;
unsigned int active_systems_traveled;
unsigned int active_systems_clinched;
Expand Down

0 comments on commit a08dd6c

Please sign in to comment.