Renumber node IDs in .osrm.maneuver_overrides

This commit is contained in:
Michael Krasnyk
2018-02-22 10:49:01 +01:00
parent 5acf660f37
commit 83588fd00f
7 changed files with 87 additions and 22 deletions
+8 -4
View File
@@ -16,10 +16,14 @@ namespace partitioner
struct PartitionerConfig final : storage::IOConfig
{
PartitionerConfig()
: IOConfig(
{".osrm", ".osrm.fileIndex", ".osrm.ebg_nodes"},
{".osrm.hsgr", ".osrm.cnbg"},
{".osrm.ebg", ".osrm.cnbg", ".osrm.cnbg_to_ebg", ".osrm.partition", ".osrm.cells"}),
: IOConfig({".osrm", ".osrm.fileIndex", ".osrm.ebg_nodes"},
{".osrm.hsgr", ".osrm.cnbg"},
{".osrm.ebg",
".osrm.cnbg",
".osrm.cnbg_to_ebg",
".osrm.partition",
".osrm.cells",
".osrm.maneuver_overrides"}),
requested_num_threads(0), balance(1.2), boundary_factor(0.25), num_optimizing_cuts(10),
small_component_size(1000),
max_cell_sizes({128, 128 * 32, 128 * 32 * 16, 128 * 32 * 16 * 32})
+20
View File
@@ -2,6 +2,7 @@
#define OSRM_PARTITIONER_RENUMBER_HPP
#include "extractor/edge_based_node_segment.hpp"
#include "extractor/maneuver_override.hpp"
#include "extractor/nbg_to_ebg.hpp"
#include "extractor/node_data_container.hpp"
@@ -73,6 +74,25 @@ inline void renumber(std::vector<extractor::NBGToEBG> &mapping,
}
}
inline void renumber(std::vector<NodeID> &node_ids, const std::vector<std::uint32_t> &permutation)
{
for (auto &node_id : node_ids)
{
if (node_id != SPECIAL_NODEID)
node_id = permutation[node_id];
}
}
inline void renumber(std::vector<extractor::StorageManeuverOverride> &maneuver_overrides,
const std::vector<std::uint32_t> &permutation)
{
for (auto &maneuver_override : maneuver_overrides)
{
if (maneuver_override.start_node != SPECIAL_NODEID)
maneuver_override.start_node = permutation[maneuver_override.start_node];
}
}
} // namespace partitioner
} // namespace osrm