Don't use bool flags on ExternalMemoryNode because they blow up the struct
This commit is contained in:
committed by
Patrick Niklaus
parent
b12fee5c0a
commit
fef0344be0
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user