From 0dc155b55e417ef0d70ce22abcdd37204a0bc7f8 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Fri, 10 Mar 2017 10:57:07 +0100 Subject: [PATCH] Rename {id|edge_id} to turn_id --- include/contractor/graph_contractor.hpp | 6 ++--- .../contractor/graph_contractor_adaptors.hpp | 4 +-- include/contractor/query_edge.hpp | 8 +++--- .../routing_algorithms/routing_base.hpp | 27 +++++++++---------- include/extractor/edge_based_edge.hpp | 12 ++++----- include/partition/edge_based_graph_reader.hpp | 6 ++--- .../routing_algorithms/alternative_path.cpp | 4 +-- src/updater/updater.cpp | 4 +-- 8 files changed, 35 insertions(+), 36 deletions(-) diff --git a/include/contractor/graph_contractor.hpp b/include/contractor/graph_contractor.hpp index f2a2b12e0cf..06904af2055 100644 --- a/include/contractor/graph_contractor.hpp +++ b/include/contractor/graph_contractor.hpp @@ -139,13 +139,13 @@ class GraphContractor if (!data.is_original_via_node_ID && !orig_node_id_from_new_node_id_map.empty()) { // tranlate the _node id_ of the shortcutted node - new_edge.data.id = orig_node_id_from_new_node_id_map[data.id]; + new_edge.data.turn_id = orig_node_id_from_new_node_id_map[data.id]; } else { - new_edge.data.id = data.id; + new_edge.data.turn_id = data.id; } - BOOST_ASSERT_MSG(new_edge.data.id != INT_MAX, // 2^31 + BOOST_ASSERT_MSG(new_edge.data.turn_id != INT_MAX, // 2^31 "edge id invalid"); new_edge.data.forward = data.forward; new_edge.data.backward = data.backward; diff --git a/include/contractor/graph_contractor_adaptors.hpp b/include/contractor/graph_contractor_adaptors.hpp index 969e78c85ca..f6a525ea95d 100644 --- a/include/contractor/graph_contractor_adaptors.hpp +++ b/include/contractor/graph_contractor_adaptors.hpp @@ -35,7 +35,7 @@ std::vector adaptToContractorInput(InputEdgeContainer input_edge std::max(input_edge.data.weight, 1), input_edge.data.duration, 1, - input_edge.data.edge_id, + input_edge.data.turn_id, false, input_edge.data.forward ? true : false, input_edge.data.backward ? true : false); @@ -45,7 +45,7 @@ std::vector adaptToContractorInput(InputEdgeContainer input_edge std::max(input_edge.data.weight, 1), input_edge.data.duration, 1, - input_edge.data.edge_id, + input_edge.data.turn_id, false, input_edge.data.backward ? true : false, input_edge.data.forward ? true : false); diff --git a/include/contractor/query_edge.hpp b/include/contractor/query_edge.hpp index f34d0575cbd..06c1f0fbf61 100644 --- a/include/contractor/query_edge.hpp +++ b/include/contractor/query_edge.hpp @@ -17,7 +17,7 @@ struct QueryEdge struct EdgeData { explicit EdgeData() - : id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false) + : turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false) { } @@ -26,14 +26,14 @@ struct QueryEdge weight = other.weight; duration = other.duration; shortcut = other.shortcut; - id = other.id; + turn_id = other.id; forward = other.forward; backward = other.backward; } // this ID is either the middle node of the shortcut, or the ID of the edge based node (node // based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle // node. Otherwise we see the edge based node to access node data. - NodeID id : 31; + NodeID turn_id : 31; bool shortcut : 1; EdgeWeight weight; EdgeWeight duration : 30; @@ -58,7 +58,7 @@ struct QueryEdge return (source == right.source && target == right.target && data.weight == right.data.weight && data.duration == right.data.duration && data.shortcut == right.data.shortcut && data.forward == right.data.forward && - data.backward == right.data.backward && data.id == right.data.id); + data.backward == right.data.backward && data.turn_id == right.data.turn_id); } }; } diff --git a/include/engine/routing_algorithms/routing_base.hpp b/include/engine/routing_algorithms/routing_base.hpp index e1b0a630e09..946c506f443 100644 --- a/include/engine/routing_algorithms/routing_base.hpp +++ b/include/engine/routing_algorithms/routing_base.hpp @@ -292,7 +292,7 @@ void unpackPath(const datafacade::ContiguousInternalMemoryDataFacademiddle to get visited before middle->second recursion_stack.emplace(middle_node_id, edge.second); @@ -340,14 +340,15 @@ void unpackPath(const FacadeT &facade, const auto &edge_data) { BOOST_ASSERT_MSG(!edge_data.shortcut, "original edge flagged as shortcut"); - const auto name_index = facade.GetNameIndexFromEdgeID(edge_data.id); - const auto turn_instruction = facade.GetTurnInstructionForEdgeID(edge_data.id); + const auto turn_id = edge_data.turn_id; // edge-based node ID + const auto name_index = facade.GetNameIndexFromEdgeID(turn_id); + const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id); const extractor::TravelMode travel_mode = (unpacked_path.empty() && start_traversed_in_reverse) ? phantom_node_pair.source_phantom.backward_travel_mode - : facade.GetTravelModeForEdgeID(edge_data.id); + : facade.GetTravelModeForEdgeID(turn_id); - const auto geometry_index = facade.GetGeometryIndexForEdgeID(edge_data.id); + const auto geometry_index = facade.GetGeometryIndexForEdgeID(turn_id); std::vector id_vector; std::vector weight_vector; @@ -399,17 +400,15 @@ void unpackPath(const FacadeT &facade, util::guidance::TurnBearing(0)}); } BOOST_ASSERT(unpacked_path.size() > 0); - if (facade.hasLaneData(edge_data.id)) - unpacked_path.back().lane_data = facade.GetLaneData(edge_data.id); + if (facade.hasLaneData(turn_id)) + unpacked_path.back().lane_data = facade.GetLaneData(turn_id); - unpacked_path.back().entry_classid = facade.GetEntryClassID(edge_data.id); + unpacked_path.back().entry_classid = facade.GetEntryClassID(turn_id); unpacked_path.back().turn_instruction = turn_instruction; - unpacked_path.back().duration_until_turn += - facade.GetDurationPenaltyForEdgeID(edge_data.id); - unpacked_path.back().weight_until_turn += - facade.GetWeightPenaltyForEdgeID(edge_data.id); - unpacked_path.back().pre_turn_bearing = facade.PreTurnBearing(edge_data.id); - unpacked_path.back().post_turn_bearing = facade.PostTurnBearing(edge_data.id); + unpacked_path.back().duration_until_turn += facade.GetDurationPenaltyForEdgeID(turn_id); + unpacked_path.back().weight_until_turn += facade.GetWeightPenaltyForEdgeID(turn_id); + unpacked_path.back().pre_turn_bearing = facade.PreTurnBearing(turn_id); + unpacked_path.back().post_turn_bearing = facade.PostTurnBearing(turn_id); }); std::size_t start_index = 0, end_index = 0; diff --git a/include/extractor/edge_based_edge.hpp b/include/extractor/edge_based_edge.hpp index cbc10308d3b..a0611d3b6da 100644 --- a/include/extractor/edge_based_edge.hpp +++ b/include/extractor/edge_based_edge.hpp @@ -32,19 +32,19 @@ struct EdgeBasedEdge struct EdgeData { - EdgeData() : edge_id(0), weight(0), duration(0), forward(false), backward(false) {} + EdgeData() : turn_id(0), weight(0), duration(0), forward(false), backward(false) {} - EdgeData(const NodeID edge_id, + EdgeData(const NodeID turn_id, const EdgeWeight weight, const EdgeWeight duration, const bool forward, const bool backward) - : edge_id(edge_id), weight(weight), duration(duration), forward(forward), + : turn_id(turn_id), weight(weight), duration(duration), forward(forward), backward(backward) { } - NodeID edge_id; + NodeID turn_id; // ID of the edge based node (node based edge) EdgeWeight weight; EdgeWeight duration : 30; std::uint32_t forward : 1; @@ -64,12 +64,12 @@ inline EdgeBasedEdge::EdgeBasedEdge() : source(0), target(0) {} inline EdgeBasedEdge::EdgeBasedEdge(const NodeID source, const NodeID target, - const NodeID edge_id, + const NodeID turn_id, const EdgeWeight weight, const EdgeWeight duration, const bool forward, const bool backward) - : source(source), target(target), data{edge_id, weight, duration, forward, backward} + : source(source), target(target), data{turn_id, weight, duration, forward, backward} { } diff --git a/include/partition/edge_based_graph_reader.hpp b/include/partition/edge_based_graph_reader.hpp index 39f0afe73a5..157d92c0bd1 100644 --- a/include/partition/edge_based_graph_reader.hpp +++ b/include/partition/edge_based_graph_reader.hpp @@ -49,7 +49,7 @@ splitBidirectionalEdges(const std::vector &edges) { directed.emplace_back(edge.source, edge.target, - edge.data.edge_id, + edge.data.turn_id, std::max(edge.data.weight, 1), edge.data.duration, edge.data.forward, @@ -57,7 +57,7 @@ splitBidirectionalEdges(const std::vector &edges) directed.emplace_back(edge.target, edge.source, - edge.data.edge_id, + edge.data.turn_id, std::max(edge.data.weight, 1), edge.data.duration, edge.data.backward, @@ -91,7 +91,7 @@ prepareEdgesForUsageInGraph(std::vector edges) EdgeBasedGraphEdge reverse_edge; forward_edge.source = reverse_edge.source = source; forward_edge.target = reverse_edge.target = target; - forward_edge.data.edge_id = reverse_edge.data.edge_id = edges[i].data.edge_id; + forward_edge.data.turn_id = reverse_edge.data.turn_id = edges[i].data.turn_id; forward_edge.data.weight = reverse_edge.data.weight = INVALID_EDGE_WEIGHT; forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION_INT_30; forward_edge.data.forward = reverse_edge.data.backward = true; diff --git a/src/engine/routing_algorithms/alternative_path.cpp b/src/engine/routing_algorithms/alternative_path.cpp index ad998fe4ea7..a75e0772c4c 100644 --- a/src/engine/routing_algorithms/alternative_path.cpp +++ b/src/engine/routing_algorithms/alternative_path.cpp @@ -434,7 +434,7 @@ bool viaNodeCandidatePassesTTest( const bool current_edge_is_shortcut = current_edge_data.shortcut; if (current_edge_is_shortcut) { - const NodeID via_path_middle_node_id = current_edge_data.id; + const NodeID via_path_middle_node_id = current_edge_data.turn_id; const EdgeID second_segment_edge_id = facade.FindEdgeInEitherDirection(via_path_middle_node_id, via_path_edge.second); const int second_segment_length = facade.GetEdgeData(second_segment_edge_id).weight; @@ -496,7 +496,7 @@ bool viaNodeCandidatePassesTTest( const bool IsViaEdgeShortCut = current_edge_data.shortcut; if (IsViaEdgeShortCut) { - const NodeID middleOfViaPath = current_edge_data.id; + const NodeID middleOfViaPath = current_edge_data.turn_id; EdgeID edgeIDOfFirstSegment = facade.FindEdgeInEitherDirection(via_path_edge.first, middleOfViaPath); int lengthOfFirstSegment = facade.GetEdgeData(edgeIDOfFirstSegment).weight; diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 1f44ee6fba4..a67a1c4e4e8 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -147,8 +147,8 @@ void CheckWeightsConsistency( for (auto &edge : edge_based_edge_list) { - BOOST_ASSERT(edge.data.edge_id < current_edge_data.size()); - auto geometry_id = current_edge_data[edge.data.edge_id].via_geometry; + BOOST_ASSERT(edge.data.turn_id < current_edge_data.size()); + auto geometry_id = current_edge_data[edge.data.turn_id].via_geometry; BOOST_ASSERT(geometry_id.id < geometry_indices.size()); const auto &weights = geometry_id.forward ? forward_weight_list : reverse_weight_list;