use constexpr if
This commit is contained in:
parent
6b4665c7b2
commit
e1d6a10fc6
@ -300,6 +300,10 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
|
|
||||||
const auto level = getNodeQueryLevel(partition, heapNode.node, args...);
|
const auto level = getNodeQueryLevel(partition, heapNode.node, args...);
|
||||||
|
|
||||||
|
static constexpr auto IS_MAP_MATCHING = std::is_same_v<typename SearchEngineData<
|
||||||
|
mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
|
Heap>;
|
||||||
|
|
||||||
// SearchEngineData<Algorithm>::MapMatchingQueryHeap
|
// SearchEngineData<Algorithm>::MapMatchingQueryHeap
|
||||||
if (level >= 1 && !heapNode.data.from_clique_arc)
|
if (level >= 1 && !heapNode.data.from_clique_arc)
|
||||||
{
|
{
|
||||||
@ -309,19 +313,15 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const auto &cell =
|
const auto &cell =
|
||||||
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
||||||
auto destination = cell.GetDestinationNodes().begin();
|
auto destination = cell.GetDestinationNodes().begin();
|
||||||
auto distance = [&heapNode, &cell ]() -> auto
|
auto distance = [&]() -> auto
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (IS_MAP_MATCHING)
|
||||||
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
|
||||||
Heap>)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return cell.GetOutDistance(heapNode.node).begin();
|
return cell.GetOutDistance(heapNode.node).begin();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void)cell;
|
|
||||||
(void)heapNode;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,9 +336,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
|
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
|
||||||
BOOST_ASSERT(to_weight >= heapNode.weight);
|
BOOST_ASSERT(to_weight >= heapNode.weight);
|
||||||
|
|
||||||
if constexpr (std::is_same_v<typename SearchEngineData<
|
if constexpr (IS_MAP_MATCHING)
|
||||||
mld::Algorithm>::MapMatchingQueryHeap,
|
|
||||||
Heap>)
|
|
||||||
{
|
{
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + *distance;
|
const EdgeDistance to_distance = heapNode.data.distance + *distance;
|
||||||
insertOrUpdate(
|
insertOrUpdate(
|
||||||
@ -350,28 +348,26 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++destination;
|
++destination;
|
||||||
|
if (IS_MAP_MATCHING) {
|
||||||
++distance;
|
++distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Shortcuts in backward direction
|
// Shortcuts in backward direction
|
||||||
const auto &cell =
|
const auto &cell =
|
||||||
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
||||||
auto source = cell.GetSourceNodes().begin();
|
auto source = cell.GetSourceNodes().begin();
|
||||||
auto distance = [&heapNode, &cell ]() -> auto
|
auto distance = [&]() -> auto
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (IS_MAP_MATCHING)
|
||||||
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
|
||||||
Heap>)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return cell.GetInDistance(heapNode.node).begin();
|
return cell.GetInDistance(heapNode.node).begin();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void)cell;
|
|
||||||
(void)heapNode;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,9 +381,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
{
|
{
|
||||||
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
|
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
|
||||||
BOOST_ASSERT(to_weight >= heapNode.weight);
|
BOOST_ASSERT(to_weight >= heapNode.weight);
|
||||||
if constexpr (std::is_same_v<typename SearchEngineData<
|
if constexpr (IS_MAP_MATCHING)
|
||||||
mld::Algorithm>::MapMatchingQueryHeap,
|
|
||||||
Heap>)
|
|
||||||
{
|
{
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + *distance;
|
const EdgeDistance to_distance = heapNode.data.distance + *distance;
|
||||||
insertOrUpdate(
|
insertOrUpdate(
|
||||||
@ -399,10 +393,12 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++source;
|
++source;
|
||||||
|
if (IS_MAP_MATCHING) {
|
||||||
++distance;
|
++distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Boundary edges
|
// Boundary edges
|
||||||
for (const auto edge : facade.GetBorderEdgeRange(level, heapNode.node))
|
for (const auto edge : facade.GetBorderEdgeRange(level, heapNode.node))
|
||||||
@ -426,9 +422,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const EdgeWeight to_weight =
|
const EdgeWeight to_weight =
|
||||||
heapNode.weight + node_weight + alias_cast<EdgeWeight>(turn_penalty);
|
heapNode.weight + node_weight + alias_cast<EdgeWeight>(turn_penalty);
|
||||||
|
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (IS_MAP_MATCHING)
|
||||||
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
|
||||||
Heap>)
|
|
||||||
{
|
{
|
||||||
const auto node_distance =
|
const auto node_distance =
|
||||||
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
|
Loading…
Reference in New Issue
Block a user