use constexpr if
This commit is contained in:
parent
cd2178905f
commit
5d2cd4d0f2
58
.github/workflows/osrm-backend.yml
vendored
58
.github/workflows/osrm-backend.yml
vendored
@ -25,7 +25,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows-release-node:
|
windows-release-node:
|
||||||
needs: format-taginfo-docs
|
# needs: format-taginfo-docs
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
env:
|
env:
|
||||||
@ -73,35 +73,35 @@ jobs:
|
|||||||
replacesArtifacts: true
|
replacesArtifacts: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
format-taginfo-docs:
|
# format-taginfo-docs:
|
||||||
runs-on: ubuntu-22.04
|
# runs-on: ubuntu-22.04
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v3
|
# - uses: actions/checkout@v3
|
||||||
- name: Use Node.js
|
# - name: Use Node.js
|
||||||
uses: actions/setup-node@v3
|
# uses: actions/setup-node@v3
|
||||||
with:
|
# with:
|
||||||
node-version: 18
|
# node-version: 18
|
||||||
- name: Enable Node.js cache
|
# - name: Enable Node.js cache
|
||||||
uses: actions/cache@v3
|
# uses: actions/cache@v3
|
||||||
with:
|
# with:
|
||||||
path: ~/.npm
|
# path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
# restore-keys: |
|
||||||
${{ runner.os }}-node-
|
# ${{ runner.os }}-node-
|
||||||
- name: Prepare environment
|
# - name: Prepare environment
|
||||||
run: |
|
# run: |
|
||||||
npm ci --ignore-scripts
|
# npm ci --ignore-scripts
|
||||||
clang-format-15 --version
|
# clang-format-15 --version
|
||||||
- name: Run checks
|
# - name: Run checks
|
||||||
run: |
|
# run: |
|
||||||
./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
# ./scripts/check_taginfo.py taginfo.json profiles/car.lua
|
||||||
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
# ./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||||
node ./scripts/validate_changelog.js
|
# node ./scripts/validate_changelog.js
|
||||||
npm run docs && ./scripts/error_on_dirty.sh
|
# npm run docs && ./scripts/error_on_dirty.sh
|
||||||
npm audit --production
|
# npm audit --production
|
||||||
|
|
||||||
docker-image:
|
docker-image:
|
||||||
needs: format-taginfo-docs
|
#needs: format-taginfo-docs
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
steps:
|
steps:
|
||||||
@ -144,7 +144,7 @@ jobs:
|
|||||||
docker stop osrm-container
|
docker stop osrm-container
|
||||||
|
|
||||||
build-test-publish:
|
build-test-publish:
|
||||||
needs: format-taginfo-docs
|
#needs: format-taginfo-docs
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -290,7 +290,16 @@ 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 = cell.GetOutDistance(heapNode.node).begin();
|
auto distance = [&heapNode]() -> auto {
|
||||||
|
if constexpr (std::is_same_v<typename SearchEngineData<
|
||||||
|
mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
|
Heap>) {
|
||||||
|
|
||||||
|
return cell.GetOutDistance(heapNode.node).begin();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} ;
|
||||||
for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
|
for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
|
BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
|
||||||
@ -342,7 +351,16 @@ 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 source = cell.GetSourceNodes().begin();
|
auto source = cell.GetSourceNodes().begin();
|
||||||
auto distance = cell.GetInDistance(heapNode.node).begin();
|
auto distance = [&heapNode]() -> auto {
|
||||||
|
if constexpr (std::is_same_v<typename SearchEngineData<
|
||||||
|
mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
|
Heap>) {
|
||||||
|
|
||||||
|
return cell.GetOutDistance(heapNode.node).begin();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} ;
|
||||||
for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
|
for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(source != cell.GetSourceNodes().end());
|
BOOST_ASSERT(source != cell.GetSourceNodes().end());
|
||||||
@ -405,9 +423,6 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
{
|
{
|
||||||
const auto node_weight =
|
const auto node_weight =
|
||||||
facade.GetNodeWeight(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
facade.GetNodeWeight(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
const auto node_distance =
|
|
||||||
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
|
||||||
|
|
||||||
const auto turn_penalty = facade.GetWeightPenaltyForEdgeID(edge_data.turn_id);
|
const auto turn_penalty = facade.GetWeightPenaltyForEdgeID(edge_data.turn_id);
|
||||||
|
|
||||||
// TODO: BOOST_ASSERT(edge_data.weight == node_weight + turn_penalty);
|
// TODO: BOOST_ASSERT(edge_data.weight == node_weight + turn_penalty);
|
||||||
@ -422,6 +437,10 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
|
typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
|
||||||
Heap>)
|
Heap>)
|
||||||
{
|
{
|
||||||
|
const auto node_distance =
|
||||||
|
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
|
|
||||||
|
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
||||||
forward_heap.Insert(to, to_weight, {heapNode.node, false, to_distance});
|
forward_heap.Insert(to, to_weight, {heapNode.node, false, to_distance});
|
||||||
}
|
}
|
||||||
@ -436,6 +455,10 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
|
typename SearchEngineData<Algorithm>::MapMatchingQueryHeap,
|
||||||
Heap>)
|
Heap>)
|
||||||
{
|
{
|
||||||
|
const auto node_distance =
|
||||||
|
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
|
|
||||||
|
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
||||||
toHeapNode->data = {heapNode.node, false, to_distance};
|
toHeapNode->data = {heapNode.node, false, to_distance};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user