diff --git a/include/extractor/restriction.hpp b/include/extractor/restriction.hpp index c8b06427e93..05d8305f90a 100644 --- a/include/extractor/restriction.hpp +++ b/include/extractor/restriction.hpp @@ -64,10 +64,7 @@ struct Bits // when adding more bits, consider using bitfields just as in // bool unused : 7; - bool operator==(const Bits &other) const - { - return is_only == other.is_only; - } + bool operator==(const Bits &other) const { return is_only == other.is_only; } }; } // namespace restriction diff --git a/include/extractor/way_restriction_map.hpp b/include/extractor/way_restriction_map.hpp index 8c0a5fadcb2..03a8a25bdf8 100644 --- a/include/extractor/way_restriction_map.hpp +++ b/include/extractor/way_restriction_map.hpp @@ -26,7 +26,7 @@ class WayRestrictionMap NodeID from; NodeID to; }; - WayRestrictionMap(const std::vector & turn_restrictions); + WayRestrictionMap(const std::vector &turn_restrictions); bool IsViaWay(const NodeID from, const NodeID to) const; diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index 8e2bca76a89..59c31b2f51f 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -942,8 +942,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( nodes_completed += buffer->nodes_processed; progress.PrintStatus(nodes_completed); append_data_to_output(buffer->continuous_data); - delayed_data.insert(delayed_data.end(),buffer->delayed_data.begin(),buffer->delayed_data.end()); - }); + delayed_data.insert( + delayed_data.end(), buffer->delayed_data.begin(), buffer->delayed_data.end()); + }); // Now, execute the pipeline. The value of "5" here was chosen by experimentation // on a 16-CPU machine and seemed to give the best performance. This value needs @@ -953,16 +954,17 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5, generator_stage & processor_stage & output_stage); - std::sort(delayed_data.begin(),delayed_data.end(),[](auto const& lhs, auto const& rhs){return lhs.edge.source < rhs.edge.source;}); - auto const transfer_data = [&](auto const& edge_with_data) - { + std::sort(delayed_data.begin(), delayed_data.end(), [](auto const &lhs, auto const &rhs) { + return lhs.edge.source < rhs.edge.source; + }); + auto const transfer_data = [&](auto const &edge_with_data) { m_edge_based_edge_list.push_back(edge_with_data.edge); turn_weight_penalties.push_back(edge_with_data.turn_weight_penalty); turn_duration_penalties.push_back(edge_with_data.turn_duration_penalty); turn_data_container.push_back(edge_with_data.turn_data); turn_indexes_write_buffer.push_back(edge_with_data.turn_index); }; - std::for_each(delayed_data.begin(),delayed_data.end(),transfer_data); + std::for_each(delayed_data.begin(), delayed_data.end(), transfer_data); // Flush the turn_indexes_write_buffer if it's not empty if (!turn_indexes_write_buffer.empty()) diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index dc04646c745..54bad56ca4b 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -497,7 +497,8 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment, config.cnbg_ebg_graph_mapping_output_path, via_node_restriction_map, via_way_restriction_map); - return edge_based_graph_factory.GetHighestEdgeID() + via_way_restriction_map.NumberOfDuplicatedNodes(); + return edge_based_graph_factory.GetHighestEdgeID() + + via_way_restriction_map.NumberOfDuplicatedNodes(); }(); compressed_edge_container.PrintStatistics(); diff --git a/src/extractor/way_restriction_map.cpp b/src/extractor/way_restriction_map.cpp index dca06f2f62a..d4a6558eef4 100644 --- a/src/extractor/way_restriction_map.cpp +++ b/src/extractor/way_restriction_map.cpp @@ -11,12 +11,11 @@ namespace extractor WayRestrictionMap::WayRestrictionMap(const std::vector &turn_restrictions) { // get all way restrictions - const auto get_way_restrictions = [this](const auto & turn_restriction) - { - if( turn_restriction.Type() == RestrictionType::WAY_RESTRICTION ) + const auto get_way_restrictions = [this](const auto &turn_restriction) { + if (turn_restriction.Type() == RestrictionType::WAY_RESTRICTION) restriction_data.push_back(turn_restriction); }; - std::for_each(turn_restrictions.begin(),turn_restrictions.end(),get_way_restrictions); + std::for_each(turn_restrictions.begin(), turn_restrictions.end(), get_way_restrictions); const auto as_duplicated_node = [](auto const &restriction) { auto &way = restriction.AsWayRestriction(); @@ -48,7 +47,7 @@ WayRestrictionMap::WayRestrictionMap(const std::vector &turn_re std::size_t offset = 1; // the first group starts at 0 - if( !restriction_data.empty() ) + if (!restriction_data.empty()) duplicated_node_groups.push_back(0); auto const add_offset_on_new_groups = [&](auto const &lhs, auto const &rhs) { @@ -77,7 +76,8 @@ std::size_t WayRestrictionMap::DuplicatedNodeID(const std::size_t restriction_id return std::distance(duplicated_node_groups.begin(), std::upper_bound(duplicated_node_groups.begin(), duplicated_node_groups.end(), - restriction_id))-1; + restriction_id)) - + 1; } // check if an edge between two nodes is a restricted turn @@ -103,8 +103,8 @@ std::vector WayRestrictionMap::GetIDs(const NodeID from, const Node std::transform(range.first, range.second, std::back_inserter(result), [](auto pair) { return pair.second; }); - //group by their respective duplicated nodes - std::sort(result.begin(),result.end()); + // group by their respective duplicated nodes + std::sort(result.begin(), result.end()); return result; } @@ -118,7 +118,7 @@ std::vector WayRestrictionMap::DuplicatedNodeRepresen std::vector result; result.reserve(NumberOfDuplicatedNodes()); std::transform(duplicated_node_groups.begin(), - duplicated_node_groups.end()-1, + duplicated_node_groups.end() - 1, std::back_inserter(result), [&](auto const representative_id) -> ViaWay { auto &way = restriction_data[representative_id].AsWayRestriction();