Skip to content

Commit

Permalink
vt
Browse files Browse the repository at this point in the history
  • Loading branch information
yakra committed Jan 14, 2021
2 parents c200686 + 7a67ce4 commit e3e708e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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::list<HGVertex*> rvlist; // union of all lists in regions
std::list<HGVertex*> svlist; // union of all lists in systems
std::list<HGVertex*> pvlist; // set of vertices within placeradius
std::unordered_set<TravelerList*> trav_set;

if (g.regions)
for (Region *r : *g.regions)
Expand Down Expand Up @@ -233,7 +232,11 @@ inline void HighwayGraph::matching_vertices_and_edges
}
if (system_match)
{ mte.insert(e);
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 @@ -251,7 +254,7 @@ inline void HighwayGraph::matching_vertices_and_edges
if (system_match) mce.insert(e);
}
}
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 e3e708e

Please sign in to comment.