Rename BinaryHeap to QueryHeap

This commit is contained in:
Michael Krasnyk 2017-05-02 13:12:28 +02:00 committed by Patrick Niklaus
parent 358aebec4d
commit 07c7cb3c6c
6 changed files with 31 additions and 36 deletions

View File

@ -1,7 +1,7 @@
#ifndef OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
#define OSRM_CONTRACTOR_CONTRACTOR_HEAP_HPP_
#include "util/binary_heap.hpp"
#include "util/query_heap.hpp"
#include "util/typedefs.hpp"
#include "util/xor_fast_hash_storage.hpp"
@ -18,7 +18,7 @@ struct ContractorHeapData
bool target = false;
};
using ContractorHeap = util::BinaryHeap<NodeID,
using ContractorHeap = util::QueryHeap<NodeID,
NodeID,
EdgeWeight,
ContractorHeapData,

View File

@ -3,7 +3,7 @@
#include "partition/cell_storage.hpp"
#include "partition/multi_level_partition.hpp"
#include "util/binary_heap.hpp"
#include "util/query_heap.hpp"
#include <tbb/enumerable_thread_specific.h>
@ -24,7 +24,7 @@ class CellCustomizer
public:
using Heap =
util::BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
util::QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
using HeapPtr = tbb::enumerable_thread_specific<Heap>;
CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}

View File

@ -4,7 +4,7 @@
#include <boost/thread/tss.hpp>
#include "engine/algorithm.hpp"
#include "util/binary_heap.hpp"
#include "util/query_heap.hpp"
#include "util/typedefs.hpp"
namespace osrm
@ -14,8 +14,7 @@ namespace engine
// Algorithm-dependent heaps
// - CH algorithms use CH heaps
// - CoreCH algorithms use CoreCH heaps that can be upcasted to CH heaps when CH algorithms reused
// by CoreCH at calling ch::routingStep, ch::retrievePackedPathFromSingleHeap and ch::unpackPath
// - CoreCH algorithms use CH
// - MLD algorithms use MLD heaps
template <typename Algorithm> struct SearchEngineData
@ -37,10 +36,10 @@ struct ManyToManyHeapData : HeapData
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
{
using QueryHeap = util::
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
using ManyToManyQueryHeap = util::BinaryHeap<NodeID,
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
NodeID,
EdgeWeight,
ManyToManyHeapData,
@ -81,7 +80,7 @@ struct MultiLayerDijkstraHeapData
template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
{
using QueryHeap = util::BinaryHeap<NodeID,
using QueryHeap = util::QueryHeap<NodeID,
NodeID,
EdgeWeight,
MultiLayerDijkstraHeapData,

View File

@ -1,14 +1,12 @@
#ifndef BINARY_HEAP_H
#define BINARY_HEAP_H
#ifndef OSRM_UTIL_QUERY_HEAP_HPP
#define OSRM_UTIL_QUERY_HEAP_HPP
#include <boost/assert.hpp>
#include <boost/heap/d_ary_heap.hpp>
#include <algorithm>
#include <cstddef>
#include <limits>
#include <map>
#include <type_traits>
#include <unordered_map>
#include <vector>
@ -133,13 +131,13 @@ template <typename NodeID,
typename Weight,
typename Data,
typename IndexStorage = ArrayStorage<NodeID, NodeID>>
class BinaryHeap
class QueryHeap
{
public:
using WeightType = Weight;
using DataType = Data;
explicit BinaryHeap(std::size_t maxID) : node_index(maxID) { Clear(); }
explicit QueryHeap(std::size_t maxID) : node_index(maxID) { Clear(); }
void Clear()
{
@ -256,4 +254,4 @@ class BinaryHeap
}
}
#endif // BINARY_HEAP_H
#endif // OSRM_UTIL_QUERY_HEAP_HPP

View File

@ -1,7 +1,5 @@
#include "engine/search_engine_data.hpp"
#include "util/binary_heap.hpp"
namespace osrm
{
namespace engine

View File

@ -1,4 +1,4 @@
#include "util/binary_heap.hpp"
#include "util/query_heap.hpp"
#include "util/typedefs.hpp"
#include <boost/mpl/list.hpp>
@ -56,7 +56,7 @@ constexpr unsigned NUM_NODES = 100;
BOOST_FIXTURE_TEST_CASE_TEMPLATE(insert_test, T, storage_types, RandomDataFixture<NUM_NODES>)
{
BinaryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
QueryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
TestWeight min_weight = std::numeric_limits<TestWeight>::max();
TestNodeID min_id;
@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(insert_test, T, storage_types, RandomDataFixtur
BOOST_FIXTURE_TEST_CASE_TEMPLATE(delete_min_test, T, storage_types, RandomDataFixture<NUM_NODES>)
{
BinaryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
QueryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
for (unsigned idx : order)
{
@ -111,7 +111,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(delete_min_test, T, storage_types, RandomDataFi
BOOST_FIXTURE_TEST_CASE_TEMPLATE(delete_all_test, T, storage_types, RandomDataFixture<NUM_NODES>)
{
BinaryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
QueryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(NUM_NODES);
for (unsigned idx : order)
{
@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(delete_all_test, T, storage_types, RandomDataFi
BOOST_FIXTURE_TEST_CASE_TEMPLATE(decrease_key_test, T, storage_types, RandomDataFixture<10>)
{
BinaryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(10);
QueryHeap<TestNodeID, TestKey, TestWeight, TestData, T> heap(10);
for (unsigned idx : order)
{