This commit is contained in:
Denis Koronchik 2017-10-12 17:41:08 +03:00 committed by Patrick Niklaus
parent fe8a2251cd
commit 031ce72db1
2 changed files with 19 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#define OSRM_PARTITION_RENUMBER_HPP
#include "extractor/edge_based_node_segment.hpp"
#include "extractor/nbg_to_ebg.hpp"
#include "extractor/node_data_container.hpp"
#include "partition/bisection_to_partition.hpp"
@ -59,7 +60,20 @@ inline void renumber(util::vector_view<extractor::EdgeBasedNodeSegment> &segment
segment.reverse_segment_id.id = permutation[segment.reverse_segment_id.id];
}
}
inline void renumber(std::vector<extractor::NBGToEBG> &mapping,
const std::vector<std::uint32_t> &permutation)
{
for (extractor::NBGToEBG &m : mapping)
{
if (m.backward_ebg_node != SPECIAL_NODEID)
m.backward_ebg_node = permutation[m.backward_ebg_node];
if (m.forward_ebg_node != SPECIAL_NODEID)
m.forward_ebg_node = permutation[m.forward_ebg_node];
}
}
} // namespace partition
} // namespace osrm
#endif

View File

@ -183,6 +183,10 @@ int Partitioner::Run(const PartitionConfig &config)
auto permutation = makePermutation(edge_based_graph, partitions);
renumber(edge_based_graph, permutation);
renumber(partitions, permutation);
{
renumber(mapping, permutation);
extractor::files::writeNBGMapping(config.GetPath(".osrm.cnbg_to_ebg").string(), mapping);
}
{
boost::iostreams::mapped_file segment_region;
auto segments = util::mmapFile<extractor::EdgeBasedNodeSegment>(