moved basic type definitions to osrm namespace
This commit is contained in:
parent
faaf82c837
commit
ec3cda32fa
@ -20,10 +20,7 @@ class CellCustomizer
|
||||
CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}
|
||||
|
||||
template <typename GraphT>
|
||||
void Customize(const GraphT &graph,
|
||||
partition::CellStorage &cells,
|
||||
partition::LevelID level,
|
||||
partition::CellID id)
|
||||
void Customize(const GraphT &graph, partition::CellStorage &cells, LevelID level, CellID id)
|
||||
{
|
||||
auto cell = cells.GetCell(level, id);
|
||||
auto destinations = cell.GetDestinationNodes();
|
||||
@ -87,8 +84,8 @@ class CellCustomizer
|
||||
void RelaxNode(const GraphT &graph,
|
||||
const partition::CellStorage &cells,
|
||||
Heap &heap,
|
||||
partition::LevelID level,
|
||||
partition::CellID id,
|
||||
LevelID level,
|
||||
CellID id,
|
||||
NodeID node,
|
||||
EdgeWeight weight) const
|
||||
{
|
||||
|
@ -1110,19 +1110,19 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
|
||||
*data_layout.GetBlockPtr<partition::MultiLevelPartitionView::LevelData>(
|
||||
memory_block, storage::DataLayout::MLD_LEVEL_DATA);
|
||||
|
||||
auto mld_partition_ptr = data_layout.GetBlockPtr<partition::PartitionID>(
|
||||
auto mld_partition_ptr = data_layout.GetBlockPtr<PartitionID>(
|
||||
memory_block, storage::DataLayout::MLD_PARTITION);
|
||||
auto partition_entries_count =
|
||||
data_layout.GetBlockEntries(storage::DataLayout::MLD_PARTITION);
|
||||
util::ShM<partition::PartitionID, true>::vector partition(mld_partition_ptr,
|
||||
partition_entries_count);
|
||||
util::ShM<PartitionID, true>::vector partition(mld_partition_ptr,
|
||||
partition_entries_count);
|
||||
|
||||
auto mld_chilren_ptr = data_layout.GetBlockPtr<partition::CellID>(
|
||||
auto mld_chilren_ptr = data_layout.GetBlockPtr<CellID>(
|
||||
memory_block, storage::DataLayout::MLD_CELL_TO_CHILDREN);
|
||||
auto children_entries_count =
|
||||
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_TO_CHILDREN);
|
||||
util::ShM<partition::CellID, true>::vector cell_to_children(mld_chilren_ptr,
|
||||
children_entries_count);
|
||||
util::ShM<CellID, true>::vector cell_to_children(mld_chilren_ptr,
|
||||
children_entries_count);
|
||||
|
||||
mld_partition =
|
||||
partition::MultiLevelPartitionView{level_data, partition, cell_to_children};
|
||||
|
@ -177,7 +177,7 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t LevelIDToIndex(partition::LevelID level) const { return level - 1; }
|
||||
std::size_t LevelIDToIndex(LevelID level) const { return level - 1; }
|
||||
|
||||
public:
|
||||
using Cell = CellImpl<EdgeWeight>;
|
||||
@ -190,7 +190,7 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
{
|
||||
// pre-allocate storge for CellData so we can have random access to it by cell id
|
||||
unsigned number_of_cells = 0;
|
||||
for (partition::LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
|
||||
for (LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
|
||||
{
|
||||
level_to_cell_offset.push_back(number_of_cells);
|
||||
number_of_cells += partition.GetNumberOfCells(level);
|
||||
@ -198,12 +198,12 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
level_to_cell_offset.push_back(number_of_cells);
|
||||
cells.resize(number_of_cells);
|
||||
|
||||
std::vector<std::pair<partition::CellID, NodeID>> level_source_boundary;
|
||||
std::vector<std::pair<partition::CellID, NodeID>> level_destination_boundary;
|
||||
std::vector<std::pair<CellID, NodeID>> level_source_boundary;
|
||||
std::vector<std::pair<CellID, NodeID>> level_destination_boundary;
|
||||
|
||||
std::size_t number_of_unconneced = 0;
|
||||
|
||||
for (partition::LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
|
||||
for (LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
|
||||
{
|
||||
auto level_offset = level_to_cell_offset[LevelIDToIndex(level)];
|
||||
|
||||
@ -212,7 +212,7 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
|
||||
for (auto node = 0u; node < base_graph.GetNumberOfNodes(); ++node)
|
||||
{
|
||||
const partition::CellID cell_id = partition.GetCell(level, node);
|
||||
const CellID cell_id = partition.GetCell(level, node);
|
||||
bool is_source_node = false;
|
||||
bool is_destination_node = false;
|
||||
bool is_boundary_node = false;
|
||||
@ -324,7 +324,7 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
{
|
||||
}
|
||||
|
||||
ConstCell GetCell(partition::LevelID level, partition::CellID id) const
|
||||
ConstCell GetCell(LevelID level, CellID id) const
|
||||
{
|
||||
const auto level_index = LevelIDToIndex(level);
|
||||
BOOST_ASSERT(level_index < level_to_cell_offset.size());
|
||||
@ -335,8 +335,7 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<!UseShareMemory>>
|
||||
Cell GetCell(partition::LevelID level, partition::CellID id)
|
||||
template <typename = std::enable_if<!UseShareMemory>> Cell GetCell(LevelID level, CellID id)
|
||||
{
|
||||
const auto level_index = LevelIDToIndex(level);
|
||||
BOOST_ASSERT(level_index < level_to_cell_offset.size());
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef OSRM_PARTITION_IO_HPP
|
||||
#define OSRM_PARTITION_IO_HPP
|
||||
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
#include "partition/cell_storage.hpp"
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
|
||||
#include "storage/io.hpp"
|
||||
|
||||
@ -44,7 +44,6 @@ template <> inline void write(const boost::filesystem::path &path, const CellSto
|
||||
writer.SerializeVector(storage.cells);
|
||||
writer.SerializeVector(storage.level_to_cell_offset);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,6 @@ void write(const boost::filesystem::path &file,
|
||||
const detail::MultiLevelPartitionImpl<UseShareMemory> &mlp);
|
||||
}
|
||||
|
||||
using LevelID = std::uint8_t;
|
||||
using CellID = std::uint32_t;
|
||||
using PartitionID = std::uint64_t;
|
||||
|
||||
static constexpr CellID INVALID_CELL_ID = std::numeric_limits<CellID>::max();
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
@ -61,7 +61,6 @@ using EdgeWeight = std::int32_t;
|
||||
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
|
||||
|
||||
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
|
||||
using BisectionID = std::uint32_t;
|
||||
|
||||
using LaneID = std::uint8_t;
|
||||
static const LaneID INVALID_LANEID = std::numeric_limits<LaneID>::max();
|
||||
@ -99,6 +98,14 @@ static const EdgeWeight MAXIMAL_EDGE_DURATION_INT_30 = (1 << 29) - 1;
|
||||
|
||||
using DatasourceID = std::uint8_t;
|
||||
|
||||
using BisectionID = std::uint32_t;
|
||||
using LevelID = std::uint8_t;
|
||||
using CellID = std::uint32_t;
|
||||
using PartitionID = std::uint64_t;
|
||||
|
||||
static constexpr auto INVALID_LEVEL_ID = std::numeric_limits<LevelID>::max();
|
||||
static constexpr auto INVALID_CELL_ID = std::numeric_limits<CellID>::max();
|
||||
|
||||
struct SegmentID
|
||||
{
|
||||
SegmentID(const NodeID id_, const bool enabled_) : id{id_}, enabled{enabled_}
|
||||
|
@ -23,7 +23,7 @@ void CellStorageStatistics(const Graph &graph,
|
||||
|
||||
for (std::size_t level = 1; level < partition.GetNumberOfLevels(); ++level)
|
||||
{
|
||||
std::unordered_map<partition::CellID, std::size_t> cell_nodes;
|
||||
std::unordered_map<CellID, std::size_t> cell_nodes;
|
||||
for (auto node : util::irange(0u, graph.GetNumberOfNodes()))
|
||||
{
|
||||
++cell_nodes[partition.GetCell(level, node)];
|
||||
@ -55,14 +55,14 @@ void CellStorageStatistics(const Graph &graph,
|
||||
}
|
||||
|
||||
util::Log() << "Level " << level << " #cells " << cell_nodes.size() << " #nodes " << total
|
||||
<< ", source nodes: average " << source
|
||||
<< " (" << (100. * source / total) << "%)"
|
||||
<< " invalid " << invalid_sources
|
||||
<< " (" << (100. * invalid_sources / total) << "%)"
|
||||
<< ", destination nodes: average " << destination
|
||||
<< " (" << (100. * destination / total) << "%)"
|
||||
<< " invalid " << invalid_destinations
|
||||
<< " (" << (100. * invalid_destinations / total) << "%)";
|
||||
<< ", source nodes: average " << source << " (" << (100. * source / total)
|
||||
<< "%)"
|
||||
<< " invalid " << invalid_sources << " (" << (100. * invalid_sources / total)
|
||||
<< "%)"
|
||||
<< ", destination nodes: average " << destination << " ("
|
||||
<< (100. * destination / total) << "%)"
|
||||
<< " invalid " << invalid_destinations << " ("
|
||||
<< (100. * invalid_destinations / total) << "%)";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "partition/partitioner.hpp"
|
||||
#include "partition/bisection_graph.hpp"
|
||||
#include "partition/bisection_to_partition.hpp"
|
||||
#include "partition/cell_storage.hpp"
|
||||
#include "partition/compressed_node_based_graph_reader.hpp"
|
||||
#include "partition/edge_based_graph_reader.hpp"
|
||||
#include "partition/io.hpp"
|
||||
@ -17,7 +18,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
@ -427,19 +427,17 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
reader.Skip<partition::MultiLevelPartition::LevelData>(1);
|
||||
layout.SetBlockSize<partition::MultiLevelPartition::LevelData>(
|
||||
DataLayout::MLD_LEVEL_DATA, 1);
|
||||
const auto partition_entries_count = reader.ReadVectorSize<partition::PartitionID>();
|
||||
layout.SetBlockSize<partition::PartitionID>(DataLayout::MLD_PARTITION,
|
||||
partition_entries_count);
|
||||
const auto children_entries_count = reader.ReadVectorSize<partition::CellID>();
|
||||
layout.SetBlockSize<partition::CellID>(DataLayout::MLD_CELL_TO_CHILDREN,
|
||||
children_entries_count);
|
||||
const auto partition_entries_count = reader.ReadVectorSize<PartitionID>();
|
||||
layout.SetBlockSize<PartitionID>(DataLayout::MLD_PARTITION, partition_entries_count);
|
||||
const auto children_entries_count = reader.ReadVectorSize<CellID>();
|
||||
layout.SetBlockSize<CellID>(DataLayout::MLD_CELL_TO_CHILDREN, children_entries_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
layout.SetBlockSize<partition::MultiLevelPartition::LevelData>(
|
||||
DataLayout::MLD_LEVEL_DATA, 0);
|
||||
layout.SetBlockSize<partition::PartitionID>(DataLayout::MLD_PARTITION, 0);
|
||||
layout.SetBlockSize<partition::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
|
||||
layout.SetBlockSize<PartitionID>(DataLayout::MLD_PARTITION, 0);
|
||||
layout.SetBlockSize<CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
@ -964,10 +962,10 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
auto mld_level_data_ptr =
|
||||
layout.GetBlockPtr<partition::MultiLevelPartition::LevelData, true>(
|
||||
memory_ptr, DataLayout::MLD_LEVEL_DATA);
|
||||
auto mld_partition_ptr = layout.GetBlockPtr<partition::PartitionID, true>(
|
||||
memory_ptr, DataLayout::MLD_PARTITION);
|
||||
auto mld_chilren_ptr = layout.GetBlockPtr<partition::CellID, true>(
|
||||
memory_ptr, DataLayout::MLD_CELL_TO_CHILDREN);
|
||||
auto mld_partition_ptr =
|
||||
layout.GetBlockPtr<PartitionID, true>(memory_ptr, DataLayout::MLD_PARTITION);
|
||||
auto mld_chilren_ptr =
|
||||
layout.GetBlockPtr<CellID, true>(memory_ptr, DataLayout::MLD_CELL_TO_CHILDREN);
|
||||
|
||||
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user