Don't use bool flags on ExternalMemoryNode because they blow up the struct
This commit is contained in:
parent
b12fee5c0a
commit
fef0344be0
@ -10,10 +10,10 @@
|
||||
|
||||
#include "extractor/class_data.hpp"
|
||||
#include "extractor/edge_based_node_segment.hpp"
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "extractor/guidance/turn_lane_types.hpp"
|
||||
#include "extractor/original_edge_data.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
|
||||
#include "util/exception.hpp"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "engine/datafacade/contiguous_block_allocator.hpp"
|
||||
#include "engine/datafacade_provider.hpp"
|
||||
#include "engine/engine_config.hpp"
|
||||
#include "engine/engine_config.hpp"
|
||||
#include "engine/plugins/match.hpp"
|
||||
#include "engine/plugins/nearest.hpp"
|
||||
#include "engine/plugins/table.hpp"
|
||||
|
@ -1,60 +0,0 @@
|
||||
#ifndef EXTERNAL_MEMORY_NODE_HPP_
|
||||
#define EXTERNAL_MEMORY_NODE_HPP_
|
||||
|
||||
#include "extractor/query_node.hpp"
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
struct ExternalMemoryNode : QueryNode
|
||||
{
|
||||
ExternalMemoryNode(const util::FixedLongitude lon_,
|
||||
const util::FixedLatitude lat_,
|
||||
OSMNodeID node_id_,
|
||||
bool barrier_,
|
||||
bool traffic_lights_)
|
||||
: QueryNode(lon_, lat_, node_id_), barrier(barrier_), traffic_lights(traffic_lights_)
|
||||
{
|
||||
}
|
||||
|
||||
ExternalMemoryNode() : barrier(false), traffic_lights(false) {}
|
||||
|
||||
static ExternalMemoryNode min_value()
|
||||
{
|
||||
return ExternalMemoryNode(
|
||||
util::FixedLongitude{0}, util::FixedLatitude{0}, MIN_OSM_NODEID, false, false);
|
||||
}
|
||||
|
||||
static ExternalMemoryNode max_value()
|
||||
{
|
||||
return ExternalMemoryNode(util::FixedLongitude{std::numeric_limits<std::int32_t>::max()},
|
||||
util::FixedLatitude{std::numeric_limits<std::int32_t>::max()},
|
||||
MAX_OSM_NODEID,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
bool barrier;
|
||||
bool traffic_lights;
|
||||
};
|
||||
|
||||
struct ExternalMemoryNodeSTXXLCompare
|
||||
{
|
||||
using value_type = ExternalMemoryNode;
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* EXTERNAL_MEMORY_NODE_HPP_ */
|
@ -1,10 +1,10 @@
|
||||
#ifndef EXTRACTION_CONTAINERS_HPP
|
||||
#define EXTRACTION_CONTAINERS_HPP
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/first_and_last_segment_of_way.hpp"
|
||||
#include "extractor/guidance/turn_lane_types.hpp"
|
||||
#include "extractor/internal_extractor_edge.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction.hpp"
|
||||
#include "extractor/scripting_environment.hpp"
|
||||
|
||||
@ -46,13 +46,15 @@ class ExtractionContainers
|
||||
|
||||
public:
|
||||
using STXXLNodeIDVector = stxxl::vector<OSMNodeID>;
|
||||
using STXXLNodeVector = stxxl::vector<ExternalMemoryNode>;
|
||||
using STXXLNodeVector = stxxl::vector<QueryNode>;
|
||||
using STXXLEdgeVector = stxxl::vector<InternalExtractorEdge>;
|
||||
using RestrictionsVector = std::vector<InputRestrictionContainer>;
|
||||
using STXXLWayIDStartEndVector = stxxl::vector<FirstAndLastSegmentOfWay>;
|
||||
using STXXLNameCharData = stxxl::vector<unsigned char>;
|
||||
using STXXLNameOffsets = stxxl::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;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef FIRST_AND_LAST_SEGMENT_OF_WAY_HPP
|
||||
#define FIRST_AND_LAST_SEGMENT_OF_WAY_HPP
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <cstring>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP
|
||||
#define OSRM_GEOJSON_DEBUG_POLICY_TOOLKIT_HPP
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef GRAPH_LOADER_HPP
|
||||
#define GRAPH_LOADER_HPP
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/node_based_edge.hpp"
|
||||
#include "extractor/packed_osm_ids.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
@ -50,7 +49,7 @@ NodeID loadNodesFromFile(storage::io::FileReader &file_reader,
|
||||
coordinates.resize(number_of_nodes);
|
||||
osm_node_ids.reserve(number_of_nodes);
|
||||
|
||||
extractor::ExternalMemoryNode current_node;
|
||||
extractor::QueryNode current_node;
|
||||
for (NodeID i = 0; i < number_of_nodes; ++i)
|
||||
{
|
||||
file_reader.ReadInto(¤t_node, 1);
|
||||
@ -58,18 +57,18 @@ NodeID loadNodesFromFile(storage::io::FileReader &file_reader,
|
||||
coordinates[i].lon = current_node.lon;
|
||||
coordinates[i].lat = current_node.lat;
|
||||
osm_node_ids.push_back(current_node.node_id);
|
||||
}
|
||||
|
||||
if (current_node.barrier)
|
||||
{
|
||||
*barriers = i;
|
||||
++barriers;
|
||||
}
|
||||
auto num_barriers = file_reader.ReadElementCount64();
|
||||
for (auto index = 0UL; index < num_barriers; ++index)
|
||||
{
|
||||
*barriers++ = file_reader.ReadOne<NodeID>();
|
||||
}
|
||||
|
||||
if (current_node.traffic_lights)
|
||||
{
|
||||
*traffic_signals = i;
|
||||
++traffic_signals;
|
||||
}
|
||||
auto num_lights = file_reader.ReadElementCount64();
|
||||
for (auto index = 0UL; index < num_lights; ++index)
|
||||
{
|
||||
*traffic_signals++ = file_reader.ReadOne<NodeID>();
|
||||
}
|
||||
|
||||
return number_of_nodes;
|
||||
|
@ -207,13 +207,23 @@ 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(),
|
||||
ExternalMemoryNodeSTXXLCompare(),
|
||||
stxxl_memory);
|
||||
stxxl::sort(
|
||||
all_nodes_list.begin(), all_nodes_list.end(), QueryNodeSTXXLCompare(), stxxl_memory);
|
||||
TIMER_STOP(sorting_nodes);
|
||||
log << "ok, after " << TIMER_SEC(sorting_nodes) << "s";
|
||||
}
|
||||
@ -625,6 +635,40 @@ void ExtractionContainers::WriteNodes(storage::io::FileWriter &file_out) const
|
||||
log << "ok, after " << TIMER_SEC(write_nodes) << "s";
|
||||
}
|
||||
|
||||
{
|
||||
util::UnbufferedLog log;
|
||||
log << "Writing barrier nodes ... ";
|
||||
TIMER_START(write_nodes);
|
||||
std::vector<NodeID> internal_barrier_nodes;
|
||||
for (const auto id : barrier_nodes)
|
||||
{
|
||||
auto iter = external_to_internal_node_id_map.find(id);
|
||||
if (iter != external_to_internal_node_id_map.end())
|
||||
{
|
||||
internal_barrier_nodes.push_back(iter->second);
|
||||
}
|
||||
}
|
||||
storage::serialization::write(file_out, internal_barrier_nodes);
|
||||
log << "ok, after " << TIMER_SEC(write_nodes) << "s";
|
||||
}
|
||||
|
||||
{
|
||||
util::UnbufferedLog log;
|
||||
log << "Writing traffic light nodes ... ";
|
||||
TIMER_START(write_nodes);
|
||||
std::vector<NodeID> internal_traffic_lights;
|
||||
for (const auto id : traffic_lights)
|
||||
{
|
||||
auto iter = external_to_internal_node_id_map.find(id);
|
||||
if (iter != external_to_internal_node_id_map.end())
|
||||
{
|
||||
internal_traffic_lights.push_back(iter->second);
|
||||
}
|
||||
}
|
||||
storage::serialization::write(file_out, internal_traffic_lights);
|
||||
log << "ok, after " << TIMER_SEC(write_nodes) << "s";
|
||||
}
|
||||
|
||||
util::Log() << "Processed " << max_internal_node_id << " nodes";
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "extractor/extractor_callbacks.hpp"
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/extraction_containers.hpp"
|
||||
#include "extractor/extraction_node.hpp"
|
||||
#include "extractor/extraction_way.hpp"
|
||||
#include "extractor/guidance/road_classification.hpp"
|
||||
#include "extractor/profile_properties.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction.hpp"
|
||||
|
||||
#include "util/for_each_pair.hpp"
|
||||
@ -56,12 +56,21 @@ ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containe
|
||||
void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
|
||||
const ExtractionNode &result_node)
|
||||
{
|
||||
const auto id = OSMNodeID{static_cast<std::uint64_t>(input_node.id())};
|
||||
|
||||
external_memory.all_nodes_list.push_back(
|
||||
{util::toFixed(util::UnsafeFloatLongitude{input_node.location().lon()}),
|
||||
util::toFixed(util::UnsafeFloatLatitude{input_node.location().lat()}),
|
||||
OSMNodeID{static_cast<std::uint64_t>(input_node.id())},
|
||||
result_node.barrier,
|
||||
result_node.traffic_lights});
|
||||
QueryNode{util::toFixed(util::UnsafeFloatLongitude{input_node.location().lon()}),
|
||||
util::toFixed(util::UnsafeFloatLatitude{input_node.location().lat()}),
|
||||
id});
|
||||
|
||||
if (result_node.barrier)
|
||||
{
|
||||
external_memory.barrier_nodes.push_back(id);
|
||||
}
|
||||
if (result_node.traffic_lights)
|
||||
{
|
||||
external_memory.traffic_lights.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtractorCallbacks::ProcessRestriction(
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "extractor/guidance/intersection_generator.hpp"
|
||||
|
||||
#include "extractor/geojson_debug_policies.hpp"
|
||||
|
||||
#include "util/geojson_debug_logger.hpp"
|
||||
|
||||
#include "util/assert.hpp"
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "extractor/restriction_parser.hpp"
|
||||
#include "extractor/profile_properties.hpp"
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
|
||||
#include "util/conditional_restrictions.hpp"
|
||||
#include "util/log.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "extractor/scripting_environment_lua.hpp"
|
||||
|
||||
#include "extractor/external_memory_node.hpp"
|
||||
#include "extractor/extraction_helper_functions.hpp"
|
||||
#include "extractor/extraction_node.hpp"
|
||||
#include "extractor/extraction_segment.hpp"
|
||||
@ -8,6 +7,7 @@
|
||||
#include "extractor/extraction_way.hpp"
|
||||
#include "extractor/internal_extractor_edge.hpp"
|
||||
#include "extractor/profile_properties.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/raster_source.hpp"
|
||||
#include "extractor/restriction_parser.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
@ -409,11 +409,8 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
"duration",
|
||||
&InternalExtractorEdge::duration_data);
|
||||
|
||||
context.state.new_usertype<ExternalMemoryNode>("EdgeTarget",
|
||||
"lon",
|
||||
&lonToDouble<ExternalMemoryNode>,
|
||||
"lat",
|
||||
&latToDouble<ExternalMemoryNode>);
|
||||
context.state.new_usertype<QueryNode>(
|
||||
"EdgeTarget", "lon", &lonToDouble<QueryNode>, "lat", &latToDouble<QueryNode>);
|
||||
|
||||
context.state.new_usertype<util::Coordinate>("Coordinate",
|
||||
"lon",
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/exception.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/route_parameters.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user