Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Moritz Kobitzsch committed Jul 14, 2017
1 parent ecab9c8 commit 90cceac
Showing 5 changed files with 21 additions and 21 deletions.
5 changes: 1 addition & 4 deletions include/extractor/restriction.hpp
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion include/extractor/way_restriction_map.hpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ class WayRestrictionMap
NodeID from;
NodeID to;
};
WayRestrictionMap(const std::vector<TurnRestriction> & turn_restrictions);
WayRestrictionMap(const std::vector<TurnRestriction> &turn_restrictions);

bool IsViaWay(const NodeID from, const NodeID to) const;

14 changes: 8 additions & 6 deletions src/extractor/edge_based_graph_factory.cpp
Original file line number Diff line number Diff line change
@@ -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())
3 changes: 2 additions & 1 deletion src/extractor/extractor.cpp
Original file line number Diff line number Diff line change
@@ -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();
18 changes: 9 additions & 9 deletions src/extractor/way_restriction_map.cpp
Original file line number Diff line number Diff line change
@@ -11,12 +11,11 @@ namespace extractor
WayRestrictionMap::WayRestrictionMap(const std::vector<TurnRestriction> &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<TurnRestriction> &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<std::size_t> 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::ViaWay> WayRestrictionMap::DuplicatedNodeRepresen
std::vector<ViaWay> 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();

0 comments on commit 90cceac

Please sign in to comment.