Renaming of MemorySetting > Ownership
This commit is contained in:
parent
d6e56c38d5
commit
16665aeb00
@ -20,19 +20,19 @@ using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
|
|||||||
|
|
||||||
struct MultiLevelEdgeBasedGraph
|
struct MultiLevelEdgeBasedGraph
|
||||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||||
osrm::storage::MemorySetting::InternalMemory>
|
osrm::storage::Ownership::Container>
|
||||||
{
|
{
|
||||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||||
osrm::storage::MemorySetting::InternalMemory>;
|
osrm::storage::Ownership::Container>;
|
||||||
using Base::Base;
|
using Base::Base;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MultiLevelEdgeBasedGraphView
|
struct MultiLevelEdgeBasedGraphView
|
||||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||||
osrm::storage::MemorySetting::SharedMemory>
|
osrm::storage::Ownership::View>
|
||||||
{
|
{
|
||||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||||
osrm::storage::MemorySetting::SharedMemory>;
|
osrm::storage::Ownership::View>;
|
||||||
using Base::Base;
|
using Base::Base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
|
|||||||
: public datafacade::AlgorithmDataFacade<algorithm::CH>
|
: public datafacade::AlgorithmDataFacade<algorithm::CH>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using QueryGraph = util::StaticGraph<EdgeData, osrm::storage::MemorySetting::SharedMemory>;
|
using QueryGraph = util::StaticGraph<EdgeData, osrm::storage::Ownership::View>;
|
||||||
using GraphNode = QueryGraph::NodeArrayEntry;
|
using GraphNode = QueryGraph::NodeArrayEntry;
|
||||||
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
||||||
|
|
||||||
@ -200,11 +200,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using super = BaseDataFacade;
|
using super = BaseDataFacade;
|
||||||
using IndexBlock = util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT;
|
using IndexBlock = util::RangeTable<16, osrm::storage::Ownership::View>::BlockT;
|
||||||
using RTreeLeaf = super::RTreeLeaf;
|
using RTreeLeaf = super::RTreeLeaf;
|
||||||
using SharedRTree = util::StaticRTree<RTreeLeaf,
|
using SharedRTree = util::StaticRTree<RTreeLeaf,
|
||||||
util::vector_view<util::Coordinate>,
|
util::vector_view<util::Coordinate>,
|
||||||
osrm::storage::MemorySetting::SharedMemory>;
|
osrm::storage::Ownership::View>;
|
||||||
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
||||||
using RTreeNode = SharedRTree::TreeNode;
|
using RTreeNode = SharedRTree::TreeNode;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
unsigned m_check_sum;
|
unsigned m_check_sum;
|
||||||
util::vector_view<util::Coordinate> m_coordinate_list;
|
util::vector_view<util::Coordinate> m_coordinate_list;
|
||||||
util::PackedVector<OSMNodeID, osrm::storage::MemorySetting::SharedMemory> m_osmnodeid_list;
|
util::PackedVector<OSMNodeID, osrm::storage::Ownership::View> m_osmnodeid_list;
|
||||||
util::vector_view<GeometryID> m_via_geometry_list;
|
util::vector_view<GeometryID> m_via_geometry_list;
|
||||||
util::vector_view<NameID> m_name_ID_list;
|
util::vector_view<NameID> m_name_ID_list;
|
||||||
util::vector_view<LaneDataID> m_lane_data_id;
|
util::vector_view<LaneDataID> m_lane_data_id;
|
||||||
@ -251,7 +251,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
util::vector_view<util::guidance::EntryClass> m_entry_class_table;
|
util::vector_view<util::guidance::EntryClass> m_entry_class_table;
|
||||||
// the look-up table for distinct bearing classes. A bearing class lists the available bearings
|
// the look-up table for distinct bearing classes. A bearing class lists the available bearings
|
||||||
// at an intersection
|
// at an intersection
|
||||||
std::shared_ptr<util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>>
|
std::shared_ptr<util::RangeTable<16, osrm::storage::Ownership::View>>
|
||||||
m_bearing_ranges_table;
|
m_bearing_ranges_table;
|
||||||
util::vector_view<DiscreteBearing> m_bearing_values_table;
|
util::vector_view<DiscreteBearing> m_bearing_values_table;
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
|
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
|
||||||
|
|
||||||
m_bearing_ranges_table =
|
m_bearing_ranges_table =
|
||||||
std::make_unique<util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>>(
|
std::make_unique<util::RangeTable<16, osrm::storage::Ownership::View>>(
|
||||||
bearing_offsets,
|
bearing_offsets,
|
||||||
bearing_blocks,
|
bearing_blocks,
|
||||||
static_cast<unsigned>(m_bearing_values_table.size()));
|
static_cast<unsigned>(m_bearing_values_table.size()));
|
||||||
|
@ -24,24 +24,24 @@ class CompressedEdgeContainer;
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainerImpl;
|
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
inline void read(const boost::filesystem::path &path,
|
inline void read(const boost::filesystem::path &path,
|
||||||
detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
|
detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
inline void write(const boost::filesystem::path &path,
|
inline void write(const boost::filesystem::path &path,
|
||||||
const detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
|
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainerImpl
|
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||||
{
|
{
|
||||||
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
|
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
|
||||||
|
|
||||||
friend CompressedEdgeContainer;
|
friend CompressedEdgeContainer;
|
||||||
|
|
||||||
@ -191,11 +191,11 @@ template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainer
|
|||||||
auto GetNumberOfSegments() const { return fwd_weights.size(); }
|
auto GetNumberOfSegments() const { return fwd_weights.size(); }
|
||||||
|
|
||||||
friend void
|
friend void
|
||||||
io::read<MemorySetting>(const boost::filesystem::path &path,
|
io::read<Ownership>(const boost::filesystem::path &path,
|
||||||
detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
|
detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||||
friend void
|
friend void
|
||||||
io::write<MemorySetting>(const boost::filesystem::path &path,
|
io::write<Ownership>(const boost::filesystem::path &path,
|
||||||
const detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
|
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<std::uint32_t> index;
|
Vector<std::uint32_t> index;
|
||||||
@ -209,9 +209,9 @@ template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
using SegmentDataView =
|
using SegmentDataView =
|
||||||
detail::SegmentDataContainerImpl<osrm::storage::MemorySetting::SharedMemory>;
|
detail::SegmentDataContainerImpl<osrm::storage::Ownership::View>;
|
||||||
using SegmentDataContainer =
|
using SegmentDataContainer =
|
||||||
detail::SegmentDataContainerImpl<osrm::storage::MemorySetting::InternalMemory>;
|
detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,24 +27,24 @@ namespace partition
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl;
|
template <osrm::storage::Ownership Ownership> class CellStorageImpl;
|
||||||
}
|
}
|
||||||
using CellStorage = detail::CellStorageImpl<osrm::storage::MemorySetting::InternalMemory>;
|
using CellStorage = detail::CellStorageImpl<osrm::storage::Ownership::Container>;
|
||||||
using CellStorageView = detail::CellStorageImpl<osrm::storage::MemorySetting::SharedMemory>;
|
using CellStorageView = detail::CellStorageImpl<osrm::storage::Ownership::View>;
|
||||||
|
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
inline void read(const boost::filesystem::path &path,
|
inline void read(const boost::filesystem::path &path,
|
||||||
detail::CellStorageImpl<MemorySetting> &storage);
|
detail::CellStorageImpl<Ownership> &storage);
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
inline void write(const boost::filesystem::path &path,
|
inline void write(const boost::filesystem::path &path,
|
||||||
const detail::CellStorageImpl<MemorySetting> &storage);
|
const detail::CellStorageImpl<Ownership> &storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using WeightOffset = std::uint32_t;
|
using WeightOffset = std::uint32_t;
|
||||||
@ -66,7 +66,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
|
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
|
||||||
|
|
||||||
// Implementation of the cell view. We need a template parameter here
|
// Implementation of the cell view. We need a template parameter here
|
||||||
// because we need to derive a read-only and read-write view from this.
|
// because we need to derive a read-only and read-write view from this.
|
||||||
@ -188,7 +188,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
|||||||
|
|
||||||
template <
|
template <
|
||||||
typename GraphT,
|
typename GraphT,
|
||||||
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::InternalMemory>>
|
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||||
CellStorageImpl(const partition::MultiLevelPartition &partition, const GraphT &base_graph)
|
CellStorageImpl(const partition::MultiLevelPartition &partition, const GraphT &base_graph)
|
||||||
{
|
{
|
||||||
// pre-allocate storge for CellData so we can have random access to it by cell id
|
// pre-allocate storge for CellData so we can have random access to it by cell id
|
||||||
@ -318,7 +318,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::SharedMemory>>
|
typename = std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||||
CellStorageImpl(Vector<EdgeWeight> weights_,
|
CellStorageImpl(Vector<EdgeWeight> weights_,
|
||||||
Vector<NodeID> source_boundary_,
|
Vector<NodeID> source_boundary_,
|
||||||
Vector<NodeID> destination_boundary_,
|
Vector<NodeID> destination_boundary_,
|
||||||
@ -344,7 +344,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::InternalMemory>>
|
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||||
Cell GetCell(LevelID level, CellID id)
|
Cell GetCell(LevelID level, CellID id)
|
||||||
{
|
{
|
||||||
const auto level_index = LevelIDToIndex(level);
|
const auto level_index = LevelIDToIndex(level);
|
||||||
@ -356,10 +356,10 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
|
|||||||
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
|
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
|
||||||
}
|
}
|
||||||
|
|
||||||
friend void io::read<MemorySetting>(const boost::filesystem::path &path,
|
friend void io::read<Ownership>(const boost::filesystem::path &path,
|
||||||
detail::CellStorageImpl<MemorySetting> &storage);
|
detail::CellStorageImpl<Ownership> &storage);
|
||||||
friend void io::write<MemorySetting>(const boost::filesystem::path &path,
|
friend void io::write<Ownership>(const boost::filesystem::path &path,
|
||||||
const detail::CellStorageImpl<MemorySetting> &storage);
|
const detail::CellStorageImpl<Ownership> &storage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<EdgeWeight> weights;
|
Vector<EdgeWeight> weights;
|
||||||
|
@ -16,9 +16,9 @@ namespace partition
|
|||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||||
inline void read(const boost::filesystem::path &path,
|
inline void read(const boost::filesystem::path &path,
|
||||||
MultiLevelGraph<EdgeDataT, MemorySetting> &graph)
|
MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||||
{
|
{
|
||||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||||
storage::io::FileReader reader{path, fingerprint};
|
storage::io::FileReader reader{path, fingerprint};
|
||||||
@ -28,9 +28,9 @@ inline void read(const boost::filesystem::path &path,
|
|||||||
reader.DeserializeVector(graph.edge_to_level);
|
reader.DeserializeVector(graph.edge_to_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||||
inline void write(const boost::filesystem::path &path,
|
inline void write(const boost::filesystem::path &path,
|
||||||
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph)
|
const MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||||
{
|
{
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||||
storage::io::FileWriter writer{path, fingerprint};
|
storage::io::FileWriter writer{path, fingerprint};
|
||||||
|
@ -16,24 +16,24 @@ namespace osrm
|
|||||||
{
|
{
|
||||||
namespace partition
|
namespace partition
|
||||||
{
|
{
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting> class MultiLevelGraph;
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership> class MultiLevelGraph;
|
||||||
|
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||||
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
|
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||||
|
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||||
void write(const boost::filesystem::path &path,
|
void write(const boost::filesystem::path &path,
|
||||||
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
|
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
|
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||||
class MultiLevelGraph : public util::StaticGraph<EdgeDataT, MemorySetting>
|
class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using SuperT = util::StaticGraph<EdgeDataT, MemorySetting>;
|
using SuperT = util::StaticGraph<EdgeDataT, Ownership>;
|
||||||
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
|
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// We limit each node to have 255 edges
|
// We limit each node to have 255 edges
|
||||||
@ -192,11 +192,11 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, MemorySetting>
|
|||||||
}
|
}
|
||||||
|
|
||||||
friend void
|
friend void
|
||||||
io::read<EdgeDataT, MemorySetting>(const boost::filesystem::path &path,
|
io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||||
MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
|
MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||||
friend void
|
friend void
|
||||||
io::write<EdgeDataT, MemorySetting>(const boost::filesystem::path &path,
|
io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||||
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
|
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||||
|
|
||||||
Vector<EdgeOffset> node_to_edge_offset;
|
Vector<EdgeOffset> node_to_edge_offset;
|
||||||
};
|
};
|
||||||
|
@ -26,32 +26,32 @@ namespace partition
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionImpl;
|
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl;
|
||||||
}
|
}
|
||||||
using MultiLevelPartition =
|
using MultiLevelPartition =
|
||||||
detail::MultiLevelPartitionImpl<osrm::storage::MemorySetting::InternalMemory>;
|
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::Container>;
|
||||||
using MultiLevelPartitionView =
|
using MultiLevelPartitionView =
|
||||||
detail::MultiLevelPartitionImpl<osrm::storage::MemorySetting::SharedMemory>;
|
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
|
||||||
|
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
void read(const boost::filesystem::path &file, detail::MultiLevelPartitionImpl<MemorySetting> &mlp);
|
void read(const boost::filesystem::path &file, detail::MultiLevelPartitionImpl<Ownership> &mlp);
|
||||||
template <osrm::storage::MemorySetting MemorySetting>
|
template <osrm::storage::Ownership Ownership>
|
||||||
void write(const boost::filesystem::path &file,
|
void write(const boost::filesystem::path &file,
|
||||||
const detail::MultiLevelPartitionImpl<MemorySetting> &mlp);
|
const detail::MultiLevelPartitionImpl<Ownership> &mlp);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionImpl final
|
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl final
|
||||||
{
|
{
|
||||||
// we will support at most 16 levels
|
// we will support at most 16 levels
|
||||||
static const constexpr std::uint8_t MAX_NUM_LEVEL = 16;
|
static const constexpr std::uint8_t MAX_NUM_LEVEL = 16;
|
||||||
static const constexpr std::uint8_t NUM_PARTITION_BITS = sizeof(PartitionID) * CHAR_BIT;
|
static const constexpr std::uint8_t NUM_PARTITION_BITS = sizeof(PartitionID) * CHAR_BIT;
|
||||||
|
|
||||||
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
|
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Contains all data necessary to describe the level hierarchy
|
// Contains all data necessary to describe the level hierarchy
|
||||||
@ -70,8 +70,8 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
|
|||||||
// cell_sizes is index by level (starting at 0, the base graph).
|
// cell_sizes is index by level (starting at 0, the base graph).
|
||||||
// However level 0 always needs to have cell size 1, since it is the
|
// However level 0 always needs to have cell size 1, since it is the
|
||||||
// basegraph.
|
// basegraph.
|
||||||
template <typename = typename std::enable_if<MemorySetting ==
|
template <typename = typename std::enable_if<Ownership ==
|
||||||
osrm::storage::MemorySetting::InternalMemory>>
|
osrm::storage::Ownership::Container>>
|
||||||
MultiLevelPartitionImpl(const std::vector<std::vector<CellID>> &partitions,
|
MultiLevelPartitionImpl(const std::vector<std::vector<CellID>> &partitions,
|
||||||
const std::vector<std::uint32_t> &lidx_to_num_cells)
|
const std::vector<std::uint32_t> &lidx_to_num_cells)
|
||||||
: level_data(MakeLevelData(lidx_to_num_cells))
|
: level_data(MakeLevelData(lidx_to_num_cells))
|
||||||
@ -79,8 +79,8 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
|
|||||||
InitializePartitionIDs(partitions);
|
InitializePartitionIDs(partitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename = typename std::enable_if<MemorySetting ==
|
template <typename = typename std::enable_if<Ownership ==
|
||||||
osrm::storage::MemorySetting::SharedMemory>>
|
osrm::storage::Ownership::View>>
|
||||||
MultiLevelPartitionImpl(LevelData level_data,
|
MultiLevelPartitionImpl(LevelData level_data,
|
||||||
Vector<PartitionID> partition_,
|
Vector<PartitionID> partition_,
|
||||||
Vector<CellID> cell_to_children_)
|
Vector<CellID> cell_to_children_)
|
||||||
@ -138,9 +138,9 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
|
|||||||
return cell_to_children[offset + cell + 1];
|
return cell_to_children[offset + cell + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
friend void io::read<MemorySetting>(const boost::filesystem::path &file,
|
friend void io::read<Ownership>(const boost::filesystem::path &file,
|
||||||
MultiLevelPartitionImpl &mlp);
|
MultiLevelPartitionImpl &mlp);
|
||||||
friend void io::write<MemorySetting>(const boost::filesystem::path &file,
|
friend void io::write<Ownership>(const boost::filesystem::path &file,
|
||||||
const MultiLevelPartitionImpl &mlp);
|
const MultiLevelPartitionImpl &mlp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -30,10 +30,10 @@ namespace osrm
|
|||||||
namespace storage
|
namespace storage
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class MemorySetting
|
enum class Ownership
|
||||||
{
|
{
|
||||||
SharedMemory,
|
Container,
|
||||||
InternalMemory
|
View
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OSRMLockFile
|
struct OSRMLockFile
|
||||||
|
@ -23,7 +23,7 @@ namespace util
|
|||||||
* configure BITSIZE and ELEMSIZE
|
* configure BITSIZE and ELEMSIZE
|
||||||
*/
|
*/
|
||||||
template <typename T,
|
template <typename T,
|
||||||
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
|
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||||
class PackedVector
|
class PackedVector
|
||||||
{
|
{
|
||||||
static const constexpr std::size_t BITSIZE = 33;
|
static const constexpr std::size_t BITSIZE = 33;
|
||||||
@ -124,20 +124,20 @@ class PackedVector
|
|||||||
|
|
||||||
std::size_t size() const { return num_elements; }
|
std::size_t size() const { return num_elements; }
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void reserve(typename std::enable_if<!enabled, std::size_t>::type capacity)
|
void reserve(typename std::enable_if<!enabled, std::size_t>::type capacity)
|
||||||
{
|
{
|
||||||
vec.reserve(elements_to_blocks(capacity));
|
vec.reserve(elements_to_blocks(capacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void reset(typename std::enable_if<enabled, std::uint64_t>::type *ptr,
|
void reset(typename std::enable_if<enabled, std::uint64_t>::type *ptr,
|
||||||
typename std::enable_if<enabled, std::size_t>::type size)
|
typename std::enable_if<enabled, std::size_t>::type size)
|
||||||
{
|
{
|
||||||
vec.reset(ptr, size);
|
vec.reset(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void set_number_of_entries(typename std::enable_if<enabled, std::size_t>::type count)
|
void set_number_of_entries(typename std::enable_if<enabled, std::size_t>::type count)
|
||||||
{
|
{
|
||||||
num_elements = count;
|
num_elements = count;
|
||||||
@ -149,44 +149,44 @@ class PackedVector
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename util::ShM<std::uint64_t, MemorySetting>::vector vec;
|
typename util::ShM<std::uint64_t, Ownership>::vector vec;
|
||||||
|
|
||||||
std::size_t num_elements = 0;
|
std::size_t num_elements = 0;
|
||||||
|
|
||||||
signed cursor = -1;
|
signed cursor = -1;
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void replace_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
void replace_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
||||||
{
|
{
|
||||||
vec[cursor] = last_elem;
|
vec[cursor] = last_elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void replace_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
void replace_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
||||||
{
|
{
|
||||||
vec.back() = last_elem;
|
vec.back() = last_elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void add_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
void add_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
||||||
{
|
{
|
||||||
vec[cursor + 1] = last_elem;
|
vec[cursor + 1] = last_elem;
|
||||||
cursor++;
|
cursor++;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
void add_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
void add_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
||||||
{
|
{
|
||||||
vec.push_back(last_elem);
|
vec.push_back(last_elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
std::uint64_t vec_back(typename std::enable_if<enabled>::type * = nullptr)
|
std::uint64_t vec_back(typename std::enable_if<enabled>::type * = nullptr)
|
||||||
{
|
{
|
||||||
return vec[cursor];
|
return vec[cursor];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
|
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||||
std::uint64_t vec_back(typename std::enable_if<!enabled>::type * = nullptr)
|
std::uint64_t vec_back(typename std::enable_if<!enabled>::type * = nullptr)
|
||||||
{
|
{
|
||||||
return vec.back();
|
return vec.back();
|
||||||
|
@ -20,14 +20,14 @@ namespace util
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE = 16,
|
template <unsigned BLOCK_SIZE = 16,
|
||||||
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
|
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||||
class RangeTable;
|
class RangeTable;
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||||
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemorySetting> &table);
|
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table);
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||||
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting> &table);
|
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores adjacent ranges in a compressed format.
|
* Stores adjacent ranges in a compressed format.
|
||||||
@ -38,12 +38,12 @@ std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting>
|
|||||||
* But each block consists of an absolute value and BLOCK_SIZE differential values.
|
* But each block consists of an absolute value and BLOCK_SIZE differential values.
|
||||||
* So the effective block size is sizeof(unsigned) + BLOCK_SIZE.
|
* So the effective block size is sizeof(unsigned) + BLOCK_SIZE.
|
||||||
*/
|
*/
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting> class RangeTable
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using BlockT = std::array<unsigned char, BLOCK_SIZE>;
|
using BlockT = std::array<unsigned char, BLOCK_SIZE>;
|
||||||
using BlockContainerT = typename ShM<BlockT, MemorySetting>::vector;
|
using BlockContainerT = typename ShM<BlockT, Ownership>::vector;
|
||||||
using OffsetContainerT = typename ShM<unsigned, MemorySetting>::vector;
|
using OffsetContainerT = typename ShM<unsigned, Ownership>::vector;
|
||||||
using RangeT = range<unsigned>;
|
using RangeT = range<unsigned>;
|
||||||
|
|
||||||
friend std::ostream &operator<<<>(std::ostream &out, const RangeTable &table);
|
friend std::ostream &operator<<<>(std::ostream &out, const RangeTable &table);
|
||||||
@ -215,8 +215,8 @@ template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting> class
|
|||||||
unsigned sum_lengths;
|
unsigned sum_lengths;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||||
unsigned RangeTable<BLOCK_SIZE, MemorySetting>::PrefixSumAtIndex(int index,
|
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index,
|
||||||
const BlockT &block) const
|
const BlockT &block) const
|
||||||
{
|
{
|
||||||
// this loop looks inefficent, but a modern compiler
|
// this loop looks inefficent, but a modern compiler
|
||||||
@ -230,8 +230,8 @@ unsigned RangeTable<BLOCK_SIZE, MemorySetting>::PrefixSumAtIndex(int index,
|
|||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||||
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemorySetting> &table)
|
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table)
|
||||||
{
|
{
|
||||||
// write number of block
|
// write number of block
|
||||||
const unsigned number_of_blocks = table.diff_blocks.size();
|
const unsigned number_of_blocks = table.diff_blocks.size();
|
||||||
@ -246,8 +246,8 @@ std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemoryS
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
|
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||||
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting> &table)
|
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table)
|
||||||
{
|
{
|
||||||
// read number of block
|
// read number of block
|
||||||
unsigned number_of_blocks;
|
unsigned number_of_blocks;
|
||||||
|
@ -175,10 +175,10 @@ void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
|
|||||||
std::swap(lhs.m_size, rhs.m_size);
|
std::swap(lhs.m_size, rhs.m_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataT, osrm::storage::MemorySetting MemorySetting> struct ShM
|
template <typename DataT, osrm::storage::Ownership Ownership> struct ShM
|
||||||
{
|
{
|
||||||
using vector =
|
using vector =
|
||||||
typename std::conditional<MemorySetting == osrm::storage::MemorySetting::SharedMemory,
|
typename std::conditional<Ownership == osrm::storage::Ownership::View,
|
||||||
vector_view<DataT>,
|
vector_view<DataT>,
|
||||||
std::vector<DataT>>::type;
|
std::vector<DataT>>::type;
|
||||||
};
|
};
|
||||||
|
@ -100,7 +100,7 @@ EntryT edgeToEntry(const OtherEdge &from, std::false_type)
|
|||||||
} // namespace static_graph_details
|
} // namespace static_graph_details
|
||||||
|
|
||||||
template <typename EdgeDataT,
|
template <typename EdgeDataT,
|
||||||
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
|
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||||
class StaticGraph
|
class StaticGraph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -126,8 +126,8 @@ class StaticGraph
|
|||||||
InitializeFromSortedEdgeRange(nodes, edges.begin(), edges.end());
|
InitializeFromSortedEdgeRange(nodes, edges.begin(), edges.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticGraph(typename util::ShM<NodeArrayEntry, MemorySetting>::vector node_array_,
|
StaticGraph(typename util::ShM<NodeArrayEntry, Ownership>::vector node_array_,
|
||||||
typename util::ShM<EdgeArrayEntry, MemorySetting>::vector edge_array_)
|
typename util::ShM<EdgeArrayEntry, Ownership>::vector edge_array_)
|
||||||
: node_array(std::move(node_array_)), edge_array(std::move(edge_array_))
|
: node_array(std::move(node_array_)), edge_array(std::move(edge_array_))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!node_array.empty());
|
BOOST_ASSERT(!node_array.empty());
|
||||||
@ -262,8 +262,8 @@ class StaticGraph
|
|||||||
NodeIterator number_of_nodes;
|
NodeIterator number_of_nodes;
|
||||||
EdgeIterator number_of_edges;
|
EdgeIterator number_of_edges;
|
||||||
|
|
||||||
typename ShM<NodeArrayEntry, MemorySetting>::vector node_array;
|
typename ShM<NodeArrayEntry, Ownership>::vector node_array;
|
||||||
typename ShM<EdgeArrayEntry, MemorySetting>::vector edge_array;
|
typename ShM<EdgeArrayEntry, Ownership>::vector edge_array;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
@ -54,7 +54,7 @@ namespace util
|
|||||||
// are computed, this means the internal distance metric doesn not represent meters!
|
// are computed, this means the internal distance metric doesn not represent meters!
|
||||||
template <class EdgeDataT,
|
template <class EdgeDataT,
|
||||||
class CoordinateListT = std::vector<Coordinate>,
|
class CoordinateListT = std::vector<Coordinate>,
|
||||||
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory,
|
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container,
|
||||||
std::uint32_t BRANCHING_FACTOR = 128,
|
std::uint32_t BRANCHING_FACTOR = 128,
|
||||||
std::uint32_t LEAF_PAGE_SIZE = 4096>
|
std::uint32_t LEAF_PAGE_SIZE = 4096>
|
||||||
class StaticRTree
|
class StaticRTree
|
||||||
@ -154,12 +154,12 @@ class StaticRTree
|
|||||||
Coordinate fixed_projected_coordinate;
|
Coordinate fixed_projected_coordinate;
|
||||||
};
|
};
|
||||||
|
|
||||||
typename ShM<TreeNode, MemorySetting>::vector m_search_tree;
|
typename ShM<TreeNode, Ownership>::vector m_search_tree;
|
||||||
const CoordinateListT &m_coordinate_list;
|
const CoordinateListT &m_coordinate_list;
|
||||||
|
|
||||||
boost::iostreams::mapped_file_source m_leaves_region;
|
boost::iostreams::mapped_file_source m_leaves_region;
|
||||||
// read-only view of leaves
|
// read-only view of leaves
|
||||||
typename ShM<const LeafNode, osrm::storage::MemorySetting::SharedMemory>::vector m_leaves;
|
typename ShM<const LeafNode, osrm::storage::Ownership::View>::vector m_leaves;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StaticRTree(const StaticRTree &) = delete;
|
StaticRTree(const StaticRTree &) = delete;
|
||||||
|
@ -29,8 +29,8 @@ constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
|
|||||||
using RTreeLeaf = extractor::EdgeBasedNode;
|
using RTreeLeaf = extractor::EdgeBasedNode;
|
||||||
using BenchStaticRTree = util::StaticRTree<
|
using BenchStaticRTree = util::StaticRTree<
|
||||||
RTreeLeaf,
|
RTreeLeaf,
|
||||||
util::ShM<util::Coordinate, osrm::storage::MemorySetting::InternalMemory>::vector,
|
util::ShM<util::Coordinate, osrm::storage::Ownership::Container>::vector,
|
||||||
osrm::storage::MemorySetting::InternalMemory>;
|
osrm::storage::Ownership::Container>;
|
||||||
|
|
||||||
std::vector<util::Coordinate> loadCoordinates(const boost::filesystem::path &nodes_file)
|
std::vector<util::Coordinate> loadCoordinates(const boost::filesystem::path &nodes_file)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
|
|||||||
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
|
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
|
||||||
auto edge_based_graph =
|
auto edge_based_graph =
|
||||||
std::make_unique<partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
std::make_unique<partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||||
osrm::storage::MemorySetting::InternalMemory>>(
|
osrm::storage::Ownership::Container>>(
|
||||||
mlp, num_nodes, std::move(tidied));
|
mlp, num_nodes, std::move(tidied));
|
||||||
|
|
||||||
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
||||||
|
@ -57,7 +57,7 @@ namespace storage
|
|||||||
using RTreeLeaf = engine::datafacade::BaseDataFacade::RTreeLeaf;
|
using RTreeLeaf = engine::datafacade::BaseDataFacade::RTreeLeaf;
|
||||||
using RTreeNode = util::StaticRTree<RTreeLeaf,
|
using RTreeNode = util::StaticRTree<RTreeLeaf,
|
||||||
util::vector_view<util::Coordinate>,
|
util::vector_view<util::Coordinate>,
|
||||||
osrm::storage::MemorySetting::SharedMemory>::TreeNode;
|
osrm::storage::Ownership::View>::TreeNode;
|
||||||
using QueryGraph = util::StaticGraph<contractor::QueryEdge::EdgeData>;
|
using QueryGraph = util::StaticGraph<contractor::QueryEdge::EdgeData>;
|
||||||
using EdgeBasedGraph = util::StaticGraph<extractor::EdgeBasedEdge::EdgeData>;
|
using EdgeBasedGraph = util::StaticGraph<extractor::EdgeBasedEdge::EdgeData>;
|
||||||
|
|
||||||
@ -366,13 +366,13 @@ void Storage::PopulateLayout(DataLayout &layout)
|
|||||||
|
|
||||||
layout.SetBlockSize<unsigned>(DataLayout::BEARING_OFFSETS, bearing_blocks);
|
layout.SetBlockSize<unsigned>(DataLayout::BEARING_OFFSETS, bearing_blocks);
|
||||||
layout.SetBlockSize<
|
layout.SetBlockSize<
|
||||||
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT>(
|
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||||
DataLayout::BEARING_BLOCKS, bearing_blocks);
|
DataLayout::BEARING_BLOCKS, bearing_blocks);
|
||||||
|
|
||||||
// No need to read the data
|
// No need to read the data
|
||||||
intersection_file.Skip<unsigned>(bearing_blocks);
|
intersection_file.Skip<unsigned>(bearing_blocks);
|
||||||
intersection_file.Skip<
|
intersection_file.Skip<
|
||||||
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT>(
|
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||||
bearing_blocks);
|
bearing_blocks);
|
||||||
|
|
||||||
const auto num_bearings = intersection_file.ReadElementCount64();
|
const auto num_bearings = intersection_file.ReadElementCount64();
|
||||||
@ -698,7 +698,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
layout.GetBlockPtr<util::Coordinate, true>(memory_ptr, DataLayout::COORDINATE_LIST);
|
layout.GetBlockPtr<util::Coordinate, true>(memory_ptr, DataLayout::COORDINATE_LIST);
|
||||||
const auto osmnodeid_ptr =
|
const auto osmnodeid_ptr =
|
||||||
layout.GetBlockPtr<std::uint64_t, true>(memory_ptr, DataLayout::OSM_NODE_ID_LIST);
|
layout.GetBlockPtr<std::uint64_t, true>(memory_ptr, DataLayout::OSM_NODE_ID_LIST);
|
||||||
util::PackedVector<OSMNodeID, osrm::storage::MemorySetting::SharedMemory> osmnodeid_list;
|
util::PackedVector<OSMNodeID, osrm::storage::Ownership::View> osmnodeid_list;
|
||||||
|
|
||||||
osmnodeid_list.reset(osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]);
|
osmnodeid_list.reset(osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]);
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
|
|
||||||
std::vector<unsigned> bearing_offsets_data(bearing_blocks);
|
std::vector<unsigned> bearing_offsets_data(bearing_blocks);
|
||||||
std::vector<
|
std::vector<
|
||||||
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT>
|
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>
|
||||||
bearing_blocks_data(bearing_blocks);
|
bearing_blocks_data(bearing_blocks);
|
||||||
|
|
||||||
intersection_file.ReadInto(bearing_offsets_data.data(), bearing_blocks);
|
intersection_file.ReadInto(bearing_offsets_data.data(), bearing_blocks);
|
||||||
@ -849,7 +849,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
if (layout.GetBlockSize(DataLayout::BEARING_BLOCKS) > 0)
|
if (layout.GetBlockSize(DataLayout::BEARING_BLOCKS) > 0)
|
||||||
{
|
{
|
||||||
const auto bearing_blocks_ptr = layout.GetBlockPtr<
|
const auto bearing_blocks_ptr = layout.GetBlockPtr<
|
||||||
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT,
|
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT,
|
||||||
true>(memory_ptr, DataLayout::BEARING_BLOCKS);
|
true>(memory_ptr, DataLayout::BEARING_BLOCKS);
|
||||||
BOOST_ASSERT(
|
BOOST_ASSERT(
|
||||||
static_cast<std::size_t>(layout.GetBlockSize(DataLayout::BEARING_BLOCKS)) >=
|
static_cast<std::size_t>(layout.GetBlockSize(DataLayout::BEARING_BLOCKS)) >=
|
||||||
|
@ -38,7 +38,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
|
|||||||
edges.push_back(Edge{m.target, m.start, m.weight, false, true});
|
edges.push_back(Edge{m.target, m.start, m.weight, false, true});
|
||||||
}
|
}
|
||||||
std::sort(edges.begin(), edges.end());
|
std::sort(edges.begin(), edges.end());
|
||||||
return partition::MultiLevelGraph<EdgeData, osrm::storage::MemorySetting::InternalMemory>(
|
return partition::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
|
||||||
mlp, max_id + 1, edges);
|
mlp, max_id + 1, edges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
|
|||||||
edges.push_back(Edge{m.target, m.source, false, true});
|
edges.push_back(Edge{m.target, m.source, false, true});
|
||||||
}
|
}
|
||||||
std::sort(edges.begin(), edges.end());
|
std::sort(edges.begin(), edges.end());
|
||||||
return MultiLevelGraph<EdgeData, osrm::storage::MemorySetting::InternalMemory>(
|
return MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
|
||||||
mlp, max_id + 1, edges);
|
mlp, max_id + 1, edges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ using namespace osrm::util;
|
|||||||
// Verify that the packed vector behaves as expected
|
// Verify that the packed vector behaves as expected
|
||||||
BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
|
BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
|
||||||
{
|
{
|
||||||
PackedVector<OSMNodeID, osrm::storage::MemorySetting::InternalMemory> packed_ids;
|
PackedVector<OSMNodeID, osrm::storage::Ownership::Container> packed_ids;
|
||||||
std::vector<OSMNodeID> original_ids;
|
std::vector<OSMNodeID> original_ids;
|
||||||
|
|
||||||
const constexpr std::size_t num_test_cases = 399;
|
const constexpr std::size_t num_test_cases = 399;
|
||||||
@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(packed_vector_capacity_test)
|
BOOST_AUTO_TEST_CASE(packed_vector_capacity_test)
|
||||||
{
|
{
|
||||||
PackedVector<OSMNodeID, osrm::storage::MemorySetting::InternalMemory> packed_vec;
|
PackedVector<OSMNodeID, osrm::storage::Ownership::Container> packed_vec;
|
||||||
const std::size_t original_size = packed_vec.capacity();
|
const std::size_t original_size = packed_vec.capacity();
|
||||||
std::vector<OSMNodeID> dummy_vec;
|
std::vector<OSMNodeID> dummy_vec;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ using namespace osrm;
|
|||||||
using namespace osrm::util;
|
using namespace osrm::util;
|
||||||
|
|
||||||
constexpr unsigned BLOCK_SIZE = 16;
|
constexpr unsigned BLOCK_SIZE = 16;
|
||||||
typedef RangeTable<BLOCK_SIZE, osrm::storage::MemorySetting::InternalMemory> TestRangeTable;
|
typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable;
|
||||||
|
|
||||||
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
|
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
|
||||||
{
|
{
|
||||||
|
@ -42,12 +42,12 @@ constexpr uint32_t TEST_LEAF_NODE_SIZE = 64;
|
|||||||
using TestData = extractor::EdgeBasedNode;
|
using TestData = extractor::EdgeBasedNode;
|
||||||
using TestStaticRTree = StaticRTree<TestData,
|
using TestStaticRTree = StaticRTree<TestData,
|
||||||
std::vector<Coordinate>,
|
std::vector<Coordinate>,
|
||||||
osrm::storage::MemorySetting::InternalMemory,
|
osrm::storage::Ownership::Container,
|
||||||
TEST_BRANCHING_FACTOR,
|
TEST_BRANCHING_FACTOR,
|
||||||
TEST_LEAF_NODE_SIZE>;
|
TEST_LEAF_NODE_SIZE>;
|
||||||
using MiniStaticRTree = StaticRTree<TestData,
|
using MiniStaticRTree = StaticRTree<TestData,
|
||||||
std::vector<Coordinate>,
|
std::vector<Coordinate>,
|
||||||
osrm::storage::MemorySetting::InternalMemory,
|
osrm::storage::Ownership::Container,
|
||||||
2,
|
2,
|
||||||
128>;
|
128>;
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ BOOST_FIXTURE_TEST_CASE(construct_tiny, TestRandomGraphFixture_10_30)
|
|||||||
{
|
{
|
||||||
using TinyTestTree = StaticRTree<TestData,
|
using TinyTestTree = StaticRTree<TestData,
|
||||||
std::vector<Coordinate>,
|
std::vector<Coordinate>,
|
||||||
osrm::storage::MemorySetting::InternalMemory,
|
osrm::storage::Ownership::Container,
|
||||||
2,
|
2,
|
||||||
64>;
|
64>;
|
||||||
construction_test<TinyTestTree>("test_tiny", this);
|
construction_test<TinyTestTree>("test_tiny", this);
|
||||||
|
Loading…
Reference in New Issue
Block a user