Compare commits
13 Commits
master
...
v5.9.0-rc.
Author | SHA1 | Date | |
---|---|---|---|
|
bae21f0d5d | ||
|
305df1fb6e | ||
|
9ab0fca31c | ||
|
e2e398edc5 | ||
|
b87366132b | ||
|
f4ef4b022e | ||
|
81d479304e | ||
|
92b53e5be0 | ||
|
cc73e753bd | ||
|
725dc396c7 | ||
|
890f0d8d7e | ||
|
c9017090a2 | ||
|
e7061591e3 |
26
.travis.yml
26
.travis.yml
@ -19,6 +19,7 @@ branches:
|
||||
- master
|
||||
# enable building tags
|
||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
||||
- "5.9"
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
@ -72,7 +73,7 @@ matrix:
|
||||
addons: &gcc6
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
@ -82,7 +83,7 @@ matrix:
|
||||
addons: &gcc6
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000
|
||||
|
||||
- os: linux
|
||||
@ -90,7 +91,7 @@ matrix:
|
||||
addons: &clang40
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CLANG_VERSION='4.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
|
||||
|
||||
- os: linux
|
||||
@ -115,7 +116,7 @@ matrix:
|
||||
addons: &gcc6
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
@ -124,12 +125,20 @@ matrix:
|
||||
TARGET_ARCH='i686' CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
|
||||
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-6-stxxl"
|
||||
addons: &gcc6
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' ENABLE_STXXL=On
|
||||
|
||||
- os: linux
|
||||
compiler: "gcc-4.9-release"
|
||||
addons: &gcc49
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
|
||||
packages: ['g++-4.9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache']
|
||||
env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release'
|
||||
|
||||
- os: osx
|
||||
@ -146,7 +155,7 @@ matrix:
|
||||
#- addons: &clang40
|
||||
#- apt:
|
||||
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
|
||||
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release'
|
||||
|
||||
# Shared Library
|
||||
@ -155,7 +164,7 @@ matrix:
|
||||
addons: &gcc6
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
||||
|
||||
# Disabled because CI slowness
|
||||
@ -164,7 +173,7 @@ matrix:
|
||||
#- addons: &clang40
|
||||
#- apt:
|
||||
#- sources: ['llvm-toolchain-trusty-4.0', 'ubuntu-toolchain-r-test']
|
||||
#- packages: ['clang-4.0', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev']
|
||||
#- packages: ['clang-4.0', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libboost-all-dev']
|
||||
#- env: CCOMPILER='clang-4.0' CXXCOMPILER='clang++-4.0' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
|
||||
|
||||
# Node build jobs. These skip running the tests.
|
||||
@ -323,6 +332,7 @@ install:
|
||||
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
|
||||
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
|
||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||
-DENABLE_STXXL=${ENABLE_STXXL:-OFF} \
|
||||
-DBUILD_TOOLS=ON \
|
||||
-DENABLE_CCACHE=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 5.9.0
|
||||
# 5.9.0 RC2
|
||||
- Changes from 5.8:
|
||||
- Algorithm:
|
||||
- Multi-Level Dijkstra:
|
||||
@ -16,6 +16,8 @@
|
||||
- Exposes `alternatives=Number` parameter overload in addition to the boolean flag
|
||||
- Tools:
|
||||
- Exposes engine limit on number of alternatives to generate `--max-alternatives` in `osrm-routed` (3 by default)
|
||||
- Infrastructure
|
||||
- STXXL is not required to build OSRM and is an optional dependency for back-compatibility (ENABLE_STXXL=On)
|
||||
|
||||
# 5.8.0
|
||||
- Changes from 5.7
|
||||
|
@ -21,6 +21,7 @@ option(BUILD_PACKAGE "Build OSRM package" OFF)
|
||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||
option(ENABLE_STXXL "Use STXXL library" ON)
|
||||
option(ENABLE_LTO "Use LTO if available" OFF)
|
||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||
@ -428,9 +429,12 @@ if(ENABLE_MASON)
|
||||
mason_use(boost_libsystem VERSION ${MASON_BOOST_VERSION})
|
||||
set(Boost_SYSTEM_LIBRARY ${MASON_PACKAGE_boost_libsystem_STATIC_LIBS})
|
||||
|
||||
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
|
||||
set(STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
|
||||
if (ENABLE_STXXL)
|
||||
mason_use(stxxl VERSION ${MASON_STXXL_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_stxxl_INCLUDE_DIRS})
|
||||
set(MAYBE_STXXL_LIBRARY ${MASON_PACKAGE_stxxl_STATIC_LIBS})
|
||||
add_definitions(-DUSE_STXXL_LIBRARY)
|
||||
endif()
|
||||
|
||||
mason_use(expat VERSION ${MASON_EXPAT_VERSION})
|
||||
add_dependency_includes(${MASON_PACKAGE_expat_INCLUDE_DIRS})
|
||||
@ -493,8 +497,16 @@ else()
|
||||
find_package(EXPAT REQUIRED)
|
||||
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
|
||||
|
||||
find_package(STXXL REQUIRED)
|
||||
add_dependency_includes(${STXXL_INCLUDE_DIR})
|
||||
if (ENABLE_STXXL)
|
||||
find_package(STXXL)
|
||||
if (STXXL_FOUND)
|
||||
add_dependency_includes(${STXXL_INCLUDE_DIR})
|
||||
set(MAYBE_STXXL_LIBRARY ${STXXL_LIBRARY})
|
||||
add_definitions(-DUSE_STXXL_LIBRARY)
|
||||
else()
|
||||
MESSAGE(STATUS "STXXL was requested but not found, default STL will be used")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||
@ -617,7 +629,7 @@ set(EXTRACTOR_LIBRARIES
|
||||
${EXPAT_LIBRARIES}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${OSMIUM_LIBRARIES}
|
||||
${STXXL_LIBRARY}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@ -645,7 +657,7 @@ set(CONTRACTOR_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${USED_LUA_LIBRARIES}
|
||||
${STXXL_LIBRARY}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
@ -665,7 +677,7 @@ set(STORAGE_LIBRARIES
|
||||
set(UTIL_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${STXXL_LIBRARY}
|
||||
${MAYBE_STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
|
||||
@ -734,12 +746,14 @@ install(FILES ${ParametersGlob} DESTINATION include/osrm/engine/api)
|
||||
install(FILES ${VariantGlob} DESTINATION include/mapbox)
|
||||
install(TARGETS osrm-extract DESTINATION bin)
|
||||
install(TARGETS osrm-partition DESTINATION bin)
|
||||
install(TARGETS osrm-customize DESTINATION bin)
|
||||
install(TARGETS osrm-contract DESTINATION bin)
|
||||
install(TARGETS osrm-datastore DESTINATION bin)
|
||||
install(TARGETS osrm-routed DESTINATION bin)
|
||||
install(TARGETS osrm DESTINATION lib)
|
||||
install(TARGETS osrm_extract DESTINATION lib)
|
||||
install(TARGETS osrm_partition DESTINATION lib)
|
||||
install(TARGETS osrm_customize DESTINATION lib)
|
||||
install(TARGETS osrm_update DESTINATION lib)
|
||||
install(TARGETS osrm_contract DESTINATION lib)
|
||||
install(TARGETS osrm_store DESTINATION lib)
|
||||
|
16
features/car/construction.feature
Normal file
16
features/car/construction.feature
Normal file
@ -0,0 +1,16 @@
|
||||
@routing @car @construction
|
||||
Feature: Car - all construction tags the OpenStreetMap community could think of and then some
|
||||
|
||||
Background:
|
||||
Given the profile "car"
|
||||
|
||||
Scenario: Various ways to tag construction and proposed roads
|
||||
Then routability should be
|
||||
| highway | construction | proposed | bothw |
|
||||
| primary | | | x |
|
||||
| construction | | | |
|
||||
| proposed | | | |
|
||||
| primary | yes | | |
|
||||
| primary | | yes | |
|
||||
| primary | no | | x |
|
||||
| primary | widening | | x |
|
@ -41,8 +41,8 @@ Feature: Exit Numbers and Names
|
||||
| ef | motorway_link | ExitRamp | |
|
||||
|
||||
When I route I should get
|
||||
| waypoints | route | turns | exits |
|
||||
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10;12, |
|
||||
| waypoints | route | turns | exits |
|
||||
| a,f | MainRoad,ExitRamp,ExitRamp | depart,off ramp slight right,arrive | ,10; 12, |
|
||||
|
||||
|
||||
Scenario: Exit number on the ways after the motorway junction, multiple exits
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <stxxl/vector>
|
||||
|
||||
#include <tbb/enumerable_thread_specific.h>
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/parallel_sort.h>
|
||||
@ -25,6 +23,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/vector>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace contractor
|
||||
@ -33,6 +35,12 @@ namespace contractor
|
||||
class GraphContractor
|
||||
{
|
||||
private:
|
||||
#if USE_STXXL_LIBRARY
|
||||
template <typename T> using ExternalVector = stxxl::vector<T>;
|
||||
#else
|
||||
template <typename T> using ExternalVector = std::vector<T>;
|
||||
#endif
|
||||
|
||||
struct ContractorThreadData
|
||||
{
|
||||
ContractorDijkstra dijkstra;
|
||||
@ -401,7 +409,7 @@ class GraphContractor
|
||||
bool Bias(const NodeID a, const NodeID b) const;
|
||||
|
||||
std::shared_ptr<ContractorGraph> contractor_graph;
|
||||
stxxl::vector<QueryEdge> external_edge_list;
|
||||
ExternalVector<QueryEdge> external_edge_list;
|
||||
std::vector<NodeID> orig_node_id_from_new_node_id_map;
|
||||
std::vector<float> node_levels;
|
||||
|
||||
|
@ -10,31 +10,19 @@
|
||||
|
||||
#include "storage/io.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <stxxl/vector>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
/**
|
||||
* Uses external memory containers from stxxl to store all the data that
|
||||
* Uses memory containers to store all the data that
|
||||
* is collected by the extractor callbacks.
|
||||
*
|
||||
* The data is the filtered, aggregated and finally written to disk.
|
||||
*/
|
||||
class ExtractionContainers
|
||||
{
|
||||
#ifndef _MSC_VER
|
||||
constexpr static unsigned stxxl_memory =
|
||||
((sizeof(std::size_t) == 4) ? std::numeric_limits<int>::max()
|
||||
: std::numeric_limits<unsigned>::max());
|
||||
#else
|
||||
const static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? INT_MAX : UINT_MAX);
|
||||
#endif
|
||||
void FlushVectors();
|
||||
void PrepareNodes();
|
||||
void PrepareRestrictions();
|
||||
void PrepareEdges(ScriptingEnvironment &scripting_environment);
|
||||
@ -45,25 +33,24 @@ class ExtractionContainers
|
||||
void WriteCharData(const std::string &file_name);
|
||||
|
||||
public:
|
||||
using STXXLNodeIDVector = stxxl::vector<OSMNodeID>;
|
||||
using STXXLNodeVector = stxxl::vector<QueryNode>;
|
||||
using STXXLEdgeVector = stxxl::vector<InternalExtractorEdge>;
|
||||
using NodeIDVector = std::vector<OSMNodeID>;
|
||||
using NodeVector = std::vector<QueryNode>;
|
||||
using EdgeVector = std::vector<InternalExtractorEdge>;
|
||||
using RestrictionsVector = std::vector<InputRestrictionContainer>;
|
||||
using STXXLWayIDStartEndVector = stxxl::vector<FirstAndLastSegmentOfWay>;
|
||||
using STXXLNameCharData = stxxl::vector<unsigned char>;
|
||||
using STXXLNameOffsets = stxxl::vector<unsigned>;
|
||||
using WayIDStartEndVector = std::vector<FirstAndLastSegmentOfWay>;
|
||||
using NameCharData = std::vector<unsigned char>;
|
||||
using NameOffsets = std::vector<unsigned>;
|
||||
|
||||
std::vector<OSMNodeID> barrier_nodes;
|
||||
std::vector<OSMNodeID> traffic_lights;
|
||||
STXXLNodeIDVector used_node_id_list;
|
||||
STXXLNodeVector all_nodes_list;
|
||||
STXXLEdgeVector all_edges_list;
|
||||
STXXLNameCharData name_char_data;
|
||||
STXXLNameOffsets name_offsets;
|
||||
NodeIDVector used_node_id_list;
|
||||
NodeVector all_nodes_list;
|
||||
EdgeVector all_edges_list;
|
||||
NameCharData name_char_data;
|
||||
NameOffsets name_offsets;
|
||||
// an adjacency array containing all turn lane masks
|
||||
RestrictionsVector restrictions_list;
|
||||
STXXLWayIDStartEndVector way_start_end_id_list;
|
||||
std::unordered_map<OSMNodeID, NodeID> external_to_internal_node_id_map;
|
||||
WayIDStartEndVector way_start_end_id_list;
|
||||
unsigned max_internal_node_id;
|
||||
std::vector<TurnRestriction> unconditional_turn_restrictions;
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct FirstAndLastSegmentOfWay
|
||||
}
|
||||
};
|
||||
|
||||
struct FirstAndLastSegmentOfWayStxxlCompare
|
||||
struct FirstAndLastSegmentOfWayCompare
|
||||
{
|
||||
using value_type = FirstAndLastSegmentOfWay;
|
||||
bool operator()(const FirstAndLastSegmentOfWay &a, const FirstAndLastSegmentOfWay &b) const
|
||||
|
@ -721,7 +721,7 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (value->IsBoolean())
|
||||
{
|
||||
params->alternatives = value->BooleanValue();
|
||||
params->number_of_alternatives = 1u;
|
||||
params->number_of_alternatives = value->BooleanValue() ? 1u : 0u;
|
||||
}
|
||||
else if (value->IsNumber())
|
||||
{
|
||||
|
@ -7,8 +7,13 @@
|
||||
|
||||
#include "storage/io.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/vector>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
@ -58,6 +63,7 @@ inline void write(storage::io::FileWriter &writer, const util::DeallocatingVecto
|
||||
writer.WriteFrom(vec.bucket_list.back(), last_block_size);
|
||||
}
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
template <typename T> inline void read(storage::io::FileReader &reader, stxxl::vector<T> &vec)
|
||||
{
|
||||
auto size = reader.ReadOne<std::uint64_t>();
|
||||
@ -78,6 +84,7 @@ inline void write(storage::io::FileWriter &writer, const stxxl::vector<T> &vec)
|
||||
writer.WriteOne<T>(vec[idx]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T> void read(io::FileReader &reader, std::vector<T> &data)
|
||||
{
|
||||
|
@ -3,11 +3,14 @@
|
||||
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include <stxxl/mng>
|
||||
#ifndef _WIN32
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/mng>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
@ -15,6 +18,7 @@ namespace util
|
||||
|
||||
inline void DumpSTXXLStats()
|
||||
{
|
||||
#if USE_STXXL_LIBRARY
|
||||
#if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4)
|
||||
auto manager = stxxl::block_manager::get_instance();
|
||||
util::Log() << "STXXL: peak bytes used: " << manager->get_maximum_allocation();
|
||||
@ -23,6 +27,7 @@ inline void DumpSTXXLStats()
|
||||
#warning STXXL 1.4+ recommended - STXXL memory summary will not be available
|
||||
util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void DumpMemoryStats()
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <stxxl/vector>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
@ -21,6 +19,10 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
#include <stxxl/vector>
|
||||
#endif
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
@ -209,10 +211,16 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
|
||||
std::swap(lhs.m_size, rhs.m_size);
|
||||
}
|
||||
|
||||
#if USE_STXXL_LIBRARY
|
||||
template <typename T> using ExternalVector = stxxl::vector<T>;
|
||||
#else
|
||||
template <typename T> using ExternalVector = std::vector<T>;
|
||||
#endif
|
||||
|
||||
template <typename DataT, storage::Ownership Ownership>
|
||||
using InternalOrExternalVector =
|
||||
typename std::conditional<Ownership == storage::Ownership::External,
|
||||
stxxl::vector<DataT>,
|
||||
ExternalVector<DataT>,
|
||||
std::vector<DataT>>::type;
|
||||
|
||||
template <typename DataT, storage::Ownership Ownership>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "osrm",
|
||||
"version": "5.9.0-latest.1",
|
||||
"version": "5.9.0-rc.2",
|
||||
"private": false,
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
|
@ -189,7 +189,8 @@ local profile = {
|
||||
|
||||
avoid = Set {
|
||||
'impassable',
|
||||
'construction'
|
||||
'construction',
|
||||
'proposed'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,9 @@ local profile = {
|
||||
'reversible',
|
||||
'impassable',
|
||||
'hov_lanes',
|
||||
'steps'
|
||||
'steps',
|
||||
'construction',
|
||||
'proposed'
|
||||
},
|
||||
|
||||
speeds = Sequence {
|
||||
|
@ -76,7 +76,9 @@ local profile = {
|
||||
},
|
||||
|
||||
avoid = Set {
|
||||
'impassable'
|
||||
'impassable',
|
||||
'construction',
|
||||
'proposed'
|
||||
},
|
||||
|
||||
speeds = Sequence {
|
||||
|
@ -48,7 +48,7 @@ function Handlers.handle_names(way,result,data,profile)
|
||||
end
|
||||
|
||||
if exits then
|
||||
result.exits = exits
|
||||
result.exits = canonicalizeStringList(exits, ";")
|
||||
end
|
||||
end
|
||||
|
||||
@ -513,6 +513,25 @@ function Handlers.handle_blocked_ways(way,result,data,profile)
|
||||
return false
|
||||
end
|
||||
|
||||
-- In addition to the highway=construction tag above handle the construction=* tag
|
||||
-- http://wiki.openstreetmap.org/wiki/Key:construction
|
||||
-- https://taginfo.openstreetmap.org/keys/construction#values
|
||||
if profile.avoid.construction then
|
||||
local construction = way:get_value_by_key('construction')
|
||||
|
||||
-- Of course there are negative tags to handle, too
|
||||
if construction and construction ~= 'no' and construction ~= 'widening' then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Not only are there multiple construction tags there is also a proposed=* tag.
|
||||
-- http://wiki.openstreetmap.org/wiki/Key:proposed
|
||||
-- https://taginfo.openstreetmap.org/keys/proposed#values
|
||||
if profile.avoid.proposed and way:get_value_by_key('proposed') then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Reversible oneways change direction with low frequency (think twice a day):
|
||||
-- do not route over these at all at the moment because of time dependence.
|
||||
-- Note: alternating (high frequency) oneways are handled below with penalty.
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <stxxl/sort>
|
||||
#include <tbb/parallel_sort.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
@ -32,16 +32,6 @@ namespace
|
||||
{
|
||||
namespace oe = osrm::extractor;
|
||||
|
||||
// Needed for STXXL comparison - STXXL requires max_value(), min_value(), so we can not use
|
||||
// std::less<OSMNodeId>{}. Anonymous namespace to keep translation unit local.
|
||||
struct OSMNodeIDSTXXLLess
|
||||
{
|
||||
using value_type = OSMNodeID;
|
||||
bool operator()(const value_type left, const value_type right) const { return left < right; }
|
||||
value_type max_value() { return MAX_OSM_NODEID; }
|
||||
value_type min_value() { return MIN_OSM_NODEID; }
|
||||
};
|
||||
|
||||
struct CmpEdgeByOSMStartID
|
||||
{
|
||||
using value_type = oe::InternalExtractorEdge;
|
||||
@ -49,9 +39,6 @@ struct CmpEdgeByOSMStartID
|
||||
{
|
||||
return lhs.result.osm_source_id < rhs.result.osm_source_id;
|
||||
}
|
||||
|
||||
value_type max_value() { return value_type::max_osm_value(); }
|
||||
value_type min_value() { return value_type::min_osm_value(); }
|
||||
};
|
||||
|
||||
struct CmpEdgeByOSMTargetID
|
||||
@ -61,9 +48,6 @@ struct CmpEdgeByOSMTargetID
|
||||
{
|
||||
return lhs.result.osm_target_id < rhs.result.osm_target_id;
|
||||
}
|
||||
|
||||
value_type max_value() { return value_type::max_osm_value(); }
|
||||
value_type min_value() { return value_type::min_osm_value(); }
|
||||
};
|
||||
|
||||
struct CmpEdgeByInternalSourceTargetAndName
|
||||
@ -92,22 +76,25 @@ struct CmpEdgeByInternalSourceTargetAndName
|
||||
if (rhs.result.name_id == EMPTY_NAMEID)
|
||||
return true;
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
BOOST_ASSERT(!name_offsets.empty() && name_offsets.back() == name_data.size());
|
||||
const oe::ExtractionContainers::STXXLNameCharData::const_iterator data = name_data.begin();
|
||||
const oe::ExtractionContainers::NameCharData::const_iterator data = name_data.begin();
|
||||
return std::lexicographical_compare(data + name_offsets[lhs.result.name_id],
|
||||
data + name_offsets[lhs.result.name_id + 1],
|
||||
data + name_offsets[rhs.result.name_id],
|
||||
data + name_offsets[rhs.result.name_id + 1]);
|
||||
}
|
||||
|
||||
value_type max_value() { return value_type::max_internal_value(); }
|
||||
value_type min_value() { return value_type::min_internal_value(); }
|
||||
|
||||
std::mutex &mutex;
|
||||
const oe::ExtractionContainers::STXXLNameCharData &name_data;
|
||||
const oe::ExtractionContainers::STXXLNameOffsets &name_offsets;
|
||||
const oe::ExtractionContainers::NameCharData &name_data;
|
||||
const oe::ExtractionContainers::NameOffsets &name_offsets;
|
||||
};
|
||||
|
||||
template <typename Iter>
|
||||
inline NodeID mapExternalToInternalNodeID(Iter first, Iter last, const OSMNodeID value)
|
||||
{
|
||||
const auto it = std::lower_bound(first, last, value);
|
||||
return (it == last || value < *it) ? SPECIAL_NODEID
|
||||
: static_cast<NodeID>(std::distance(first, it));
|
||||
}
|
||||
}
|
||||
|
||||
namespace osrm
|
||||
@ -117,9 +104,6 @@ namespace extractor
|
||||
|
||||
ExtractionContainers::ExtractionContainers()
|
||||
{
|
||||
// Check if stxxl can be instantiated
|
||||
stxxl::vector<unsigned> dummy_vector;
|
||||
|
||||
// Insert four empty strings offsets for name, ref, destination, pronunciation, and exits
|
||||
name_offsets.push_back(0);
|
||||
name_offsets.push_back(0);
|
||||
@ -130,16 +114,6 @@ ExtractionContainers::ExtractionContainers()
|
||||
name_offsets.push_back(0);
|
||||
}
|
||||
|
||||
void ExtractionContainers::FlushVectors()
|
||||
{
|
||||
used_node_id_list.flush();
|
||||
all_nodes_list.flush();
|
||||
all_edges_list.flush();
|
||||
name_char_data.flush();
|
||||
name_offsets.flush();
|
||||
way_start_end_id_list.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the collected data and serializes it.
|
||||
* At this point nodes are still referenced by their OSM id.
|
||||
@ -158,11 +132,11 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme
|
||||
storage::io::FileWriter file_out(output_file_name,
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
|
||||
FlushVectors();
|
||||
|
||||
PrepareNodes();
|
||||
WriteNodes(file_out);
|
||||
PrepareEdges(scripting_environment);
|
||||
all_nodes_list.clear(); // free all_nodes_list before allocation of normal_edges
|
||||
all_nodes_list.shrink_to_fit();
|
||||
WriteEdges(file_out);
|
||||
|
||||
PrepareRestrictions();
|
||||
@ -190,8 +164,7 @@ void ExtractionContainers::PrepareNodes()
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting used nodes ... " << std::flush;
|
||||
TIMER_START(sorting_used_nodes);
|
||||
stxxl::sort(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(), stxxl_memory);
|
||||
tbb::parallel_sort(used_node_id_list.begin(), used_node_id_list.end());
|
||||
TIMER_STOP(sorting_used_nodes);
|
||||
log << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s";
|
||||
}
|
||||
@ -207,23 +180,13 @@ void ExtractionContainers::PrepareNodes()
|
||||
}
|
||||
|
||||
{
|
||||
struct QueryNodeSTXXLCompare
|
||||
{
|
||||
using value_type = QueryNode;
|
||||
value_type max_value() { return value_type::max_value(); }
|
||||
value_type min_value() { return value_type::min_value(); }
|
||||
|
||||
bool operator()(const value_type &left, const value_type &right) const
|
||||
{
|
||||
return left.node_id < right.node_id;
|
||||
}
|
||||
};
|
||||
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting all nodes ... " << std::flush;
|
||||
TIMER_START(sorting_nodes);
|
||||
stxxl::sort(
|
||||
all_nodes_list.begin(), all_nodes_list.end(), QueryNodeSTXXLCompare(), stxxl_memory);
|
||||
tbb::parallel_sort(
|
||||
all_nodes_list.begin(), all_nodes_list.end(), [](const auto &left, const auto &right) {
|
||||
return left.node_id < right.node_id;
|
||||
});
|
||||
TIMER_STOP(sorting_nodes);
|
||||
log << "ok, after " << TIMER_SEC(sorting_nodes) << "s";
|
||||
}
|
||||
@ -232,16 +195,11 @@ void ExtractionContainers::PrepareNodes()
|
||||
util::UnbufferedLog log;
|
||||
log << "Building node id map ... " << std::flush;
|
||||
TIMER_START(id_map);
|
||||
external_to_internal_node_id_map.reserve(used_node_id_list.size());
|
||||
auto node_iter = all_nodes_list.begin();
|
||||
auto ref_iter = used_node_id_list.begin();
|
||||
auto used_nodes_iter = used_node_id_list.begin();
|
||||
const auto all_nodes_list_end = all_nodes_list.end();
|
||||
const auto used_node_id_list_end = used_node_id_list.end();
|
||||
// Note: despite being able to handle 64 bit OSM node ids, we can't
|
||||
// handle > uint32_t actual usable nodes. This should be OK for a while
|
||||
// because we usually route on a *lot* less than 2^32 of the OSM
|
||||
// graph nodes.
|
||||
std::uint64_t internal_id = 0;
|
||||
|
||||
// compute the intersection of nodes that were referenced and nodes we actually have
|
||||
while (node_iter != all_nodes_list_end && ref_iter != used_node_id_list_end)
|
||||
@ -257,17 +215,21 @@ void ExtractionContainers::PrepareNodes()
|
||||
continue;
|
||||
}
|
||||
BOOST_ASSERT(node_iter->node_id == *ref_iter);
|
||||
external_to_internal_node_id_map[*ref_iter] = static_cast<NodeID>(internal_id++);
|
||||
*used_nodes_iter = std::move(*ref_iter);
|
||||
used_nodes_iter++;
|
||||
node_iter++;
|
||||
ref_iter++;
|
||||
}
|
||||
if (internal_id > std::numeric_limits<NodeID>::max())
|
||||
|
||||
// Remove unused nodes and check maximal internal node id
|
||||
used_node_id_list.resize(std::distance(used_node_id_list.begin(), used_nodes_iter));
|
||||
if (used_node_id_list.size() > std::numeric_limits<NodeID>::max())
|
||||
{
|
||||
throw util::exception("There are too many nodes remaining after filtering, OSRM only "
|
||||
"supports 2^32 unique nodes, but there were " +
|
||||
std::to_string(internal_id) + SOURCE_REF);
|
||||
std::to_string(used_node_id_list.size()) + SOURCE_REF);
|
||||
}
|
||||
max_internal_node_id = boost::numeric_cast<std::uint64_t>(internal_id);
|
||||
max_internal_node_id = boost::numeric_cast<std::uint64_t>(used_node_id_list.size());
|
||||
TIMER_STOP(id_map);
|
||||
log << "ok, after " << TIMER_SEC(id_map) << "s";
|
||||
}
|
||||
@ -280,8 +242,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting edges by start ... " << std::flush;
|
||||
TIMER_START(sort_edges_by_start);
|
||||
stxxl::sort(
|
||||
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID(), stxxl_memory);
|
||||
tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMStartID());
|
||||
TIMER_STOP(sort_edges_by_start);
|
||||
log << "ok, after " << TIMER_SEC(sort_edges_by_start) << "s";
|
||||
}
|
||||
@ -325,9 +286,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
BOOST_ASSERT(edge_iterator->result.osm_source_id == node_iterator->node_id);
|
||||
|
||||
// assign new node id
|
||||
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id);
|
||||
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end());
|
||||
edge_iterator->result.source = id_iter->second;
|
||||
const auto node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
|
||||
BOOST_ASSERT(node_id != SPECIAL_NODEID);
|
||||
edge_iterator->result.source = node_id;
|
||||
|
||||
edge_iterator->source_coordinate.lat = node_iterator->lat;
|
||||
edge_iterator->source_coordinate.lon = node_iterator->lon;
|
||||
@ -351,8 +313,7 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting edges by target ... " << std::flush;
|
||||
TIMER_START(sort_edges_by_target);
|
||||
stxxl::sort(
|
||||
all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID(), stxxl_memory);
|
||||
tbb::parallel_sort(all_edges_list.begin(), all_edges_list.end(), CmpEdgeByOSMTargetID());
|
||||
TIMER_STOP(sort_edges_by_target);
|
||||
log << "ok, after " << TIMER_SEC(sort_edges_by_target) << "s";
|
||||
}
|
||||
@ -419,9 +380,10 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.));
|
||||
|
||||
// assign new node id
|
||||
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id);
|
||||
BOOST_ASSERT(id_iter != external_to_internal_node_id_map.end());
|
||||
edge.target = id_iter->second;
|
||||
const auto node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), node_iterator->node_id);
|
||||
BOOST_ASSERT(node_id != SPECIAL_NODEID);
|
||||
edge.target = node_id;
|
||||
|
||||
// orient edges consistently: source id < target id
|
||||
// important for multi-edge removal
|
||||
@ -454,11 +416,9 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
log << "Sorting edges by renumbered start ... ";
|
||||
TIMER_START(sort_edges_by_renumbered_start);
|
||||
std::mutex name_data_mutex;
|
||||
stxxl::sort(
|
||||
all_edges_list.begin(),
|
||||
all_edges_list.end(),
|
||||
CmpEdgeByInternalSourceTargetAndName{name_data_mutex, name_char_data, name_offsets},
|
||||
stxxl_memory);
|
||||
tbb::parallel_sort(all_edges_list.begin(),
|
||||
all_edges_list.end(),
|
||||
CmpEdgeByInternalSourceTargetAndName{name_char_data, name_offsets});
|
||||
TIMER_STOP(sort_edges_by_renumbered_start);
|
||||
log << "ok, after " << TIMER_SEC(sort_edges_by_renumbered_start) << "s";
|
||||
}
|
||||
@ -640,12 +600,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
|
||||
log << "Writing barrier nodes ... ";
|
||||
TIMER_START(write_nodes);
|
||||
std::vector<NodeID> internal_barrier_nodes;
|
||||
for (const auto id : barrier_nodes)
|
||||
for (const auto osm_id : barrier_nodes)
|
||||
{
|
||||
auto iter = external_to_internal_node_id_map.find(id);
|
||||
if (iter != external_to_internal_node_id_map.end())
|
||||
const auto node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
|
||||
if (node_id != SPECIAL_NODEID)
|
||||
{
|
||||
internal_barrier_nodes.push_back(iter->second);
|
||||
internal_barrier_nodes.push_back(node_id);
|
||||
}
|
||||
}
|
||||
storage::serialization::write(file_out, internal_barrier_nodes);
|
||||
@ -657,12 +618,13 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
|
||||
log << "Writing traffic light nodes ... ";
|
||||
TIMER_START(write_nodes);
|
||||
std::vector<NodeID> internal_traffic_lights;
|
||||
for (const auto id : traffic_lights)
|
||||
for (const auto osm_id : traffic_lights)
|
||||
{
|
||||
auto iter = external_to_internal_node_id_map.find(id);
|
||||
if (iter != external_to_internal_node_id_map.end())
|
||||
const auto node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), osm_id);
|
||||
if (node_id != SPECIAL_NODEID)
|
||||
{
|
||||
internal_traffic_lights.push_back(iter->second);
|
||||
internal_traffic_lights.push_back(node_id);
|
||||
}
|
||||
}
|
||||
storage::serialization::write(file_out, internal_traffic_lights);
|
||||
@ -716,10 +678,9 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting used ways ... ";
|
||||
TIMER_START(sort_ways);
|
||||
stxxl::sort(way_start_end_id_list.begin(),
|
||||
way_start_end_id_list.end(),
|
||||
FirstAndLastSegmentOfWayStxxlCompare(),
|
||||
stxxl_memory);
|
||||
tbb::parallel_sort(way_start_end_id_list.begin(),
|
||||
way_start_end_id_list.end(),
|
||||
FirstAndLastSegmentOfWayCompare());
|
||||
TIMER_STOP(sort_ways);
|
||||
log << "ok, after " << TIMER_SEC(sort_ways) << "s";
|
||||
}
|
||||
@ -728,7 +689,7 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting " << restrictions_list.size() << " restriction. by from... ";
|
||||
TIMER_START(sort_restrictions);
|
||||
std::sort(
|
||||
tbb::parallel_sort(
|
||||
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByFrom());
|
||||
TIMER_STOP(sort_restrictions);
|
||||
log << "ok, after " << TIMER_SEC(sort_restrictions) << "s";
|
||||
@ -766,26 +727,30 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
BOOST_ASSERT(
|
||||
way_start_and_end_iterator->way_id ==
|
||||
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.from.way)});
|
||||
|
||||
// we do not remap the via id yet, since we will need it for the to node as well
|
||||
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node};
|
||||
const OSMNodeID via_osm_node_id =
|
||||
OSMNodeID{restrictions_iterator->restriction.via.node};
|
||||
|
||||
// check if via is actually valid, if not invalidate
|
||||
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
|
||||
if (via_id_iter == external_to_internal_node_id_map.end())
|
||||
auto via_node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
|
||||
if (via_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
util::Log(logDEBUG) << "Restriction references invalid node: "
|
||||
<< restrictions_iterator->restriction.via.node;
|
||||
util::Log(logDEBUG) << "Restriction references invalid node: " << via_osm_node_id;
|
||||
restrictions_iterator->restriction.via.node = SPECIAL_NODEID;
|
||||
++restrictions_iterator;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (way_start_and_end_iterator->first_segment_source_id == via_node_id)
|
||||
if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
|
||||
{
|
||||
// assign new from node id
|
||||
auto id_iter = external_to_internal_node_id_map.find(
|
||||
const auto from_node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(),
|
||||
used_node_id_list.end(),
|
||||
way_start_and_end_iterator->first_segment_target_id);
|
||||
if (id_iter == external_to_internal_node_id_map.end())
|
||||
if (from_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
util::Log(logDEBUG) << "Way references invalid node: "
|
||||
<< way_start_and_end_iterator->first_segment_target_id;
|
||||
@ -794,14 +759,16 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
++way_start_and_end_iterator;
|
||||
continue;
|
||||
}
|
||||
restrictions_iterator->restriction.from.node = id_iter->second;
|
||||
restrictions_iterator->restriction.from.node = from_node_id;
|
||||
}
|
||||
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id)
|
||||
else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
|
||||
{
|
||||
// assign new from node id
|
||||
auto id_iter = external_to_internal_node_id_map.find(
|
||||
way_start_and_end_iterator->last_segment_source_id);
|
||||
if (id_iter == external_to_internal_node_id_map.end())
|
||||
const auto from_node_id =
|
||||
mapExternalToInternalNodeID(used_node_id_list.begin(),
|
||||
used_node_id_list.end(),
|
||||
way_start_and_end_iterator->last_segment_source_id);
|
||||
if (from_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
util::Log(logDEBUG) << "Way references invalid node: "
|
||||
<< way_start_and_end_iterator->last_segment_target_id;
|
||||
@ -810,7 +777,7 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
++way_start_and_end_iterator;
|
||||
continue;
|
||||
}
|
||||
restrictions_iterator->restriction.from.node = id_iter->second;
|
||||
restrictions_iterator->restriction.from.node = from_node_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -828,7 +795,7 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
util::UnbufferedLog log;
|
||||
log << "Sorting restrictions. by to ... " << std::flush;
|
||||
TIMER_START(sort_restrictions_to);
|
||||
std::sort(
|
||||
tbb::parallel_sort(
|
||||
restrictions_list.begin(), restrictions_list.end(), CmpRestrictionContainerByTo());
|
||||
TIMER_STOP(sort_restrictions_to);
|
||||
log << "ok, after " << TIMER_SEC(sort_restrictions_to) << "s";
|
||||
@ -870,18 +837,22 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
BOOST_ASSERT(
|
||||
way_start_and_end_iterator->way_id ==
|
||||
OSMWayID{static_cast<std::uint32_t>(restrictions_iterator->restriction.to.way)});
|
||||
const OSMNodeID via_node_id = OSMNodeID{restrictions_iterator->restriction.via.node};
|
||||
const OSMNodeID via_osm_node_id =
|
||||
OSMNodeID{restrictions_iterator->restriction.via.node};
|
||||
|
||||
// assign new via node id
|
||||
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
|
||||
BOOST_ASSERT(via_id_iter != external_to_internal_node_id_map.end());
|
||||
restrictions_iterator->restriction.via.node = via_id_iter->second;
|
||||
const auto via_node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(), used_node_id_list.end(), via_osm_node_id);
|
||||
BOOST_ASSERT(via_node_id != SPECIAL_NODEID);
|
||||
restrictions_iterator->restriction.via.node = via_node_id;
|
||||
|
||||
if (way_start_and_end_iterator->first_segment_source_id == via_node_id)
|
||||
if (way_start_and_end_iterator->first_segment_source_id == via_osm_node_id)
|
||||
{
|
||||
auto to_id_iter = external_to_internal_node_id_map.find(
|
||||
const auto to_node_id = mapExternalToInternalNodeID(
|
||||
used_node_id_list.begin(),
|
||||
used_node_id_list.end(),
|
||||
way_start_and_end_iterator->first_segment_target_id);
|
||||
if (to_id_iter == external_to_internal_node_id_map.end())
|
||||
if (to_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
util::Log(logDEBUG) << "Way references invalid node: "
|
||||
<< way_start_and_end_iterator->first_segment_source_id;
|
||||
@ -890,13 +861,15 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
++way_start_and_end_iterator;
|
||||
continue;
|
||||
}
|
||||
restrictions_iterator->restriction.to.node = to_id_iter->second;
|
||||
restrictions_iterator->restriction.to.node = to_node_id;
|
||||
}
|
||||
else if (way_start_and_end_iterator->last_segment_target_id == via_node_id)
|
||||
else if (way_start_and_end_iterator->last_segment_target_id == via_osm_node_id)
|
||||
{
|
||||
auto to_id_iter = external_to_internal_node_id_map.find(
|
||||
way_start_and_end_iterator->last_segment_source_id);
|
||||
if (to_id_iter == external_to_internal_node_id_map.end())
|
||||
const auto to_node_id =
|
||||
mapExternalToInternalNodeID(used_node_id_list.begin(),
|
||||
used_node_id_list.end(),
|
||||
way_start_and_end_iterator->last_segment_source_id);
|
||||
if (to_node_id == SPECIAL_NODEID)
|
||||
{
|
||||
util::Log(logDEBUG) << "Way references invalid node: "
|
||||
<< way_start_and_end_iterator->last_segment_source_id;
|
||||
@ -905,7 +878,7 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
++way_start_and_end_iterator;
|
||||
continue;
|
||||
}
|
||||
restrictions_iterator->restriction.to.node = to_id_iter->second;
|
||||
restrictions_iterator->restriction.to.node = to_node_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
10
taginfo.json
10
taginfo.json
@ -366,6 +366,16 @@
|
||||
"value": "circular",
|
||||
"description": "A Roundabout where the traffic on the roundabout not always has right of way."
|
||||
},
|
||||
{
|
||||
"key": "proposed",
|
||||
"object_types": [ "way" ],
|
||||
"description": "Proposed ways. Discarded for routing"
|
||||
},
|
||||
{
|
||||
"key": "construction",
|
||||
"object_types": [ "way" ],
|
||||
"description": "Ways under construction. Discarded for routing except construction=no, construction=widening"
|
||||
},
|
||||
{
|
||||
"key": "type",
|
||||
"value": "restriction",
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <numeric>
|
||||
#include <stxxl/vector>
|
||||
#include <vector>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(range_table)
|
||||
|
||||
@ -15,7 +15,7 @@ using namespace osrm::util;
|
||||
constexpr unsigned BLOCK_SIZE = 16;
|
||||
typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable;
|
||||
|
||||
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
|
||||
void ConstructionTest(std::vector<unsigned> lengths, std::vector<unsigned> offsets)
|
||||
{
|
||||
BOOST_ASSERT(lengths.size() == offsets.size() - 1);
|
||||
|
||||
@ -29,7 +29,7 @@ void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> off
|
||||
}
|
||||
}
|
||||
|
||||
void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths,
|
||||
void ComputeLengthsOffsets(std::vector<unsigned> &lengths,
|
||||
std::vector<unsigned> &offsets,
|
||||
unsigned num)
|
||||
{
|
||||
@ -54,12 +54,12 @@ void ComputeLengthsOffsets(stxxl::vector<unsigned> &lengths,
|
||||
BOOST_AUTO_TEST_CASE(construction_test)
|
||||
{
|
||||
// only offset empty block
|
||||
stxxl::vector<unsigned> empty_lengths;
|
||||
std::vector<unsigned> empty_lengths;
|
||||
empty_lengths.push_back(1);
|
||||
ConstructionTest(empty_lengths, {0, 1});
|
||||
// first block almost full => sentinel is last element of block
|
||||
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, (16)}
|
||||
stxxl::vector<unsigned> almost_full_lengths;
|
||||
std::vector<unsigned> almost_full_lengths;
|
||||
std::vector<unsigned> almost_full_offsets;
|
||||
ComputeLengthsOffsets(almost_full_lengths, almost_full_offsets, BLOCK_SIZE);
|
||||
ConstructionTest(almost_full_lengths, almost_full_offsets);
|
||||
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(construction_test)
|
||||
// first block full => sentinel is offset of new block, next block empty
|
||||
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
|
||||
// [(153)] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
stxxl::vector<unsigned> full_lengths;
|
||||
std::vector<unsigned> full_lengths;
|
||||
std::vector<unsigned> full_offsets;
|
||||
ComputeLengthsOffsets(full_lengths, full_offsets, BLOCK_SIZE + 1);
|
||||
ConstructionTest(full_lengths, full_offsets);
|
||||
@ -75,13 +75,13 @@ BOOST_AUTO_TEST_CASE(construction_test)
|
||||
// first block full and offset of next block not sentinel, but the first differential value
|
||||
// [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
|
||||
// [153] {(17), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
stxxl::vector<unsigned> over_full_lengths;
|
||||
std::vector<unsigned> over_full_lengths;
|
||||
std::vector<unsigned> over_full_offsets;
|
||||
ComputeLengthsOffsets(over_full_lengths, over_full_offsets, BLOCK_SIZE + 2);
|
||||
ConstructionTest(over_full_lengths, over_full_offsets);
|
||||
|
||||
// test multiple blocks
|
||||
stxxl::vector<unsigned> multiple_lengths;
|
||||
std::vector<unsigned> multiple_lengths;
|
||||
std::vector<unsigned> multiple_offsets;
|
||||
ComputeLengthsOffsets(multiple_lengths, multiple_offsets, (BLOCK_SIZE + 1) * 10);
|
||||
ConstructionTest(multiple_lengths, multiple_offsets);
|
||||
|
Loading…
Reference in New Issue
Block a user