Use GetPath with file names over accessing member variables
This commit is contained in:
committed by
Daniel J. H
parent
e208485c17
commit
d9e8caf369
@@ -30,7 +30,7 @@ int main(int argc, const char *argv[]) try
|
||||
|
||||
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
||||
EngineConfig config;
|
||||
config.storage_config = {argv[1]};
|
||||
config.storage_config.UseDefaultOutputNames(argv[1]);
|
||||
config.use_shared_memory = false;
|
||||
|
||||
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
||||
|
||||
@@ -47,7 +47,7 @@ int Contractor::Run()
|
||||
util::Log() << "Reading node weights.";
|
||||
std::vector<EdgeWeight> node_weights;
|
||||
{
|
||||
storage::io::FileReader reader(config.node_path,
|
||||
storage::io::FileReader reader(config.GetPath(".osrm.enw"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, node_weights);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ int Contractor::Run()
|
||||
std::vector<float> node_levels;
|
||||
if (config.use_cached_priority)
|
||||
{
|
||||
files::readLevels(config.level_path, node_levels);
|
||||
files::readLevels(config.GetPath(".osrm.level"), node_levels);
|
||||
}
|
||||
|
||||
util::DeallocatingVector<QueryEdge> contracted_edge_list;
|
||||
@@ -90,15 +90,15 @@ int Contractor::Run()
|
||||
RangebasedCRC32 crc32_calculator;
|
||||
const unsigned checksum = crc32_calculator(contracted_edge_list);
|
||||
|
||||
files::writeGraph(config.hsgr_data_path,
|
||||
files::writeGraph(config.GetPath(".osrm.hsgr"),
|
||||
checksum,
|
||||
QueryGraph{max_edge_id + 1, std::move(contracted_edge_list)});
|
||||
}
|
||||
|
||||
files::writeCoreMarker(config.core_data_path, is_core_node);
|
||||
files::writeCoreMarker(config.GetPath(".osrm.core"), is_core_node);
|
||||
if (!config.use_cached_priority)
|
||||
{
|
||||
files::writeLevels(config.level_path, node_levels);
|
||||
files::writeLevels(config.GetPath(".osrm.level"), node_levels);
|
||||
}
|
||||
|
||||
TIMER_STOP(preparing);
|
||||
|
||||
@@ -98,12 +98,12 @@ int Customizer::Run(const CustomizationConfig &config)
|
||||
TIMER_START(loading_data);
|
||||
|
||||
partition::MultiLevelPartition mlp;
|
||||
partition::files::readPartition(config.mld_partition_path, mlp);
|
||||
partition::files::readPartition(config.GetPath(".osrm.partition"), mlp);
|
||||
|
||||
auto edge_based_graph = LoadAndUpdateEdgeExpandedGraph(config, mlp);
|
||||
|
||||
partition::CellStorage storage;
|
||||
partition::files::readCells(config.mld_storage_path, storage);
|
||||
partition::files::readCells(config.GetPath(".osrm.cells"), storage);
|
||||
TIMER_STOP(loading_data);
|
||||
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
|
||||
|
||||
@@ -114,12 +114,12 @@ int Customizer::Run(const CustomizationConfig &config)
|
||||
util::Log() << "Cells customization took " << TIMER_SEC(cell_customize) << " seconds";
|
||||
|
||||
TIMER_START(writing_mld_data);
|
||||
partition::files::writeCells(config.mld_storage_path, storage);
|
||||
partition::files::writeCells(config.GetPath(".osrm.cells"), storage);
|
||||
TIMER_STOP(writing_mld_data);
|
||||
util::Log() << "MLD customization writing took " << TIMER_SEC(writing_mld_data) << " seconds";
|
||||
|
||||
TIMER_START(writing_graph);
|
||||
partition::files::writeGraph(config.mld_graph_path, *edge_based_graph);
|
||||
partition::files::writeGraph(config.GetPath(".osrm.mldgr"), *edge_based_graph);
|
||||
TIMER_STOP(writing_graph);
|
||||
util::Log() << "Graph writing took " << TIMER_SEC(writing_graph) << " seconds";
|
||||
|
||||
|
||||
@@ -7,15 +7,9 @@ namespace engine
|
||||
|
||||
bool EngineConfig::IsValid() const
|
||||
{
|
||||
const bool all_path_are_empty =
|
||||
storage_config.ram_index_path.empty() && storage_config.file_index_path.empty() &&
|
||||
storage_config.hsgr_data_path.empty() &&
|
||||
storage_config.node_based_nodes_data_path.empty() &&
|
||||
storage_config.edge_based_nodes_data_path.empty() &&
|
||||
storage_config.edges_data_path.empty() && storage_config.core_data_path.empty() &&
|
||||
storage_config.geometries_path.empty() && storage_config.timestamp_path.empty() &&
|
||||
storage_config.datasource_names_path.empty() &&
|
||||
storage_config.datasource_indexes_path.empty() && storage_config.names_data_path.empty();
|
||||
// check whether a base_bath has been defined by verifying an empty extension
|
||||
// leads to an empty path
|
||||
const bool all_path_are_empty = storage_config.GetPath("").empty();
|
||||
|
||||
const auto unlimited_or_more_than = [](const int v, const int limit) {
|
||||
return v == -1 || v > limit;
|
||||
|
||||
+25
-25
@@ -134,7 +134,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
node_is_startpoint,
|
||||
edge_based_node_weights,
|
||||
edge_based_edge_list,
|
||||
config.intersection_class_path.string(),
|
||||
config.GetPath(".osrm.icd").string(),
|
||||
turn_restrictions,
|
||||
turn_lane_map);
|
||||
|
||||
@@ -146,7 +146,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
util::Log() << "Saving edge-based node weights to file.";
|
||||
TIMER_START(timer_write_node_weights);
|
||||
{
|
||||
storage::io::FileWriter writer(config.node_path,
|
||||
storage::io::FileWriter writer(config.GetPath(".osrm.enw"),
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
storage::serialization::write(writer, edge_based_node_weights);
|
||||
}
|
||||
@@ -164,12 +164,12 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
TIMER_STOP(rtree);
|
||||
|
||||
util::Log() << "Writing nodes for nodes-based and edges-based graphs ...";
|
||||
files::writeNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
files::writeNodeData(config.edge_based_nodes_data_path, edge_based_nodes_container);
|
||||
files::writeNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
files::writeNodeData(config.GetPath(".osrm.ebg_nodes"), edge_based_nodes_container);
|
||||
|
||||
util::Log() << "Writing edge-based-graph edges ... " << std::flush;
|
||||
TIMER_START(write_edges);
|
||||
files::writeEdgeBasedGraph(config.edge_graph_output_path, max_edge_id, edge_based_edge_list);
|
||||
files::writeEdgeBasedGraph(config.GetPath(".osrm.ebg"), max_edge_id, edge_based_edge_list);
|
||||
TIMER_STOP(write_edges);
|
||||
util::Log() << "ok, after " << TIMER_SEC(write_edges) << "s";
|
||||
|
||||
@@ -183,7 +183,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
||||
util::Log() << "Expansion: " << nodes_per_second << " nodes/sec and " << edges_per_second
|
||||
<< " edges/sec";
|
||||
util::Log() << "To prepare the data for routing, run: "
|
||||
<< "./osrm-contract " << config.osrm_path;
|
||||
<< "./osrm-contract " << config.GetPath(".osrm");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
}
|
||||
util::Log() << "timestamp: " << timestamp;
|
||||
|
||||
storage::io::FileWriter timestamp_file(config.timestamp_path,
|
||||
storage::io::FileWriter timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
storage::io::FileWriter::GenerateFingerprint);
|
||||
|
||||
timestamp_file.WriteFrom(timestamp.c_str(), timestamp.length());
|
||||
@@ -330,13 +330,13 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
}
|
||||
|
||||
extraction_containers.PrepareData(scripting_environment,
|
||||
config.osrm_path.string(),
|
||||
config.turn_restrictions_path.string(),
|
||||
config.names_data_path.string());
|
||||
config.GetPath(".osrm").string(),
|
||||
config.GetPath(".osrm.restrictions").string(),
|
||||
config.GetPath(".osrm.names").string());
|
||||
|
||||
auto profile_properties = scripting_environment.GetProfileProperties();
|
||||
SetClassNames(classes_map, profile_properties);
|
||||
files::writeProfileProperties(config.properties_path.string(), profile_properties);
|
||||
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
|
||||
|
||||
TIMER_STOP(extracting);
|
||||
util::Log() << "extraction finished after " << TIMER_SEC(extracting) << "s";
|
||||
@@ -411,7 +411,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
|
||||
std::vector<util::Coordinate> &coordiantes,
|
||||
extractor::PackedOSMIDs &osm_node_ids)
|
||||
{
|
||||
storage::io::FileReader file_reader(config.osrm_path,
|
||||
storage::io::FileReader file_reader(config.GetPath(".osrm"),
|
||||
storage::io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto barriers_iter = inserter(barriers, end(barriers));
|
||||
@@ -428,7 +428,7 @@ Extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barriers,
|
||||
|
||||
if (edge_list.empty())
|
||||
{
|
||||
throw util::exception("Node-based-graph (" + config.osrm_path.string() +
|
||||
throw util::exception("Node-based-graph (" + config.GetPath(".osrm").string() +
|
||||
") contains no edges." + SOURCE_REF);
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
*node_based_graph,
|
||||
compressed_edge_container);
|
||||
|
||||
util::NameTable name_table(config.names_data_path.string());
|
||||
util::NameTable name_table(config.GetPath(".osrm.names").string());
|
||||
|
||||
EdgeBasedGraphFactory edge_based_graph_factory(
|
||||
node_based_graph,
|
||||
@@ -481,12 +481,12 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
turn_lane_map);
|
||||
|
||||
edge_based_graph_factory.Run(scripting_environment,
|
||||
config.edges_data_path.string(),
|
||||
config.turn_lane_data_path.string(),
|
||||
config.turn_weight_penalties_path.string(),
|
||||
config.turn_duration_penalties_path.string(),
|
||||
config.turn_penalties_index_path.string(),
|
||||
config.cnbg_ebg_mapping_path.string());
|
||||
config.GetPath(".osrm.edges").string(),
|
||||
config.GetPath(".osrm.tld").string(),
|
||||
config.GetPath(".osrm.turn_weight_penalties").string(),
|
||||
config.GetPath(".osrm.turn_duration_penalties").string(),
|
||||
config.GetPath(".osrm.turn_penalties_index").string(),
|
||||
config.GetPath(".osrm.cnbg_to_ebg").string());
|
||||
|
||||
compressed_edge_container.PrintStatistics();
|
||||
|
||||
@@ -509,7 +509,7 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
|
||||
compressed_node_based_graph_writing = std::async(std::launch::async, [&] {
|
||||
WriteCompressedNodeBasedGraph(
|
||||
config.compressed_node_based_graph_path.string(), *node_based_graph, coordinates);
|
||||
config.GetPath(".osrm.cnbg").string(), *node_based_graph, coordinates);
|
||||
});
|
||||
|
||||
{
|
||||
@@ -518,9 +518,9 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
|
||||
std::tie(turn_lane_offsets, turn_lane_masks) =
|
||||
guidance::transformTurnLaneMapIntoArrays(turn_lane_map);
|
||||
files::writeTurnLaneDescriptions(
|
||||
config.turn_lane_description_path, turn_lane_offsets, turn_lane_masks);
|
||||
config.GetPath(".osrm.tls"), turn_lane_offsets, turn_lane_masks);
|
||||
}
|
||||
files::writeSegmentData(config.geometries_path,
|
||||
files::writeSegmentData(config.GetPath(".osrm.geometry"),
|
||||
*compressed_edge_container.ToSegmentData());
|
||||
|
||||
edge_based_graph_factory.GetEdgeBasedEdges(edge_based_edge_list);
|
||||
@@ -583,8 +583,8 @@ void Extractor::BuildRTree(std::vector<EdgeBasedNodeSegment> edge_based_node_seg
|
||||
|
||||
TIMER_START(construction);
|
||||
util::StaticRTree<EdgeBasedNodeSegment> rtree(edge_based_node_segments,
|
||||
config.ram_index_path.string(),
|
||||
config.file_index_path.string(),
|
||||
config.GetPath(".osrm.ramIndex").string(),
|
||||
config.GetPath(".osrm.fileIndex").string(),
|
||||
coordinates);
|
||||
|
||||
TIMER_STOP(construction);
|
||||
|
||||
@@ -98,7 +98,7 @@ void LogGeojson(const std::string &filename, const std::vector<std::uint32_t> &b
|
||||
auto getGraphBisection(const PartitionConfig &config)
|
||||
{
|
||||
auto compressed_node_based_graph =
|
||||
LoadCompressedNodeBasedGraph(config.compressed_node_based_graph_path.string());
|
||||
LoadCompressedNodeBasedGraph(config.GetPath(".osrm.cnbg").string());
|
||||
|
||||
util::Log() << "Loaded compressed node based graph: "
|
||||
<< compressed_node_based_graph.edges.size() << " edges, "
|
||||
@@ -137,10 +137,10 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
// For details see #3205
|
||||
|
||||
std::vector<extractor::NBGToEBG> mapping;
|
||||
extractor::files::readNBGMapping(config.cnbg_ebg_mapping_path.string(), mapping);
|
||||
extractor::files::readNBGMapping(config.GetPath(".osrm.cnbg_to_ebg").string(), mapping);
|
||||
util::Log() << "Loaded node based graph to edge based graph mapping";
|
||||
|
||||
auto edge_based_graph = LoadEdgeBasedGraph(config.edge_based_graph_path);
|
||||
auto edge_based_graph = LoadEdgeBasedGraph(config.GetPath(".osrm.ebg").string());
|
||||
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
||||
<< edge_based_graph.GetNumberOfEdges() << " edges, "
|
||||
<< edge_based_graph.GetNumberOfNodes() << " nodes";
|
||||
@@ -185,21 +185,21 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
renumber(partitions, permutation);
|
||||
{
|
||||
boost::iostreams::mapped_file segment_region;
|
||||
auto segments =
|
||||
util::mmapFile<extractor::EdgeBasedNodeSegment>(config.file_index_path, segment_region);
|
||||
auto segments = util::mmapFile<extractor::EdgeBasedNodeSegment>(
|
||||
config.GetPath(".osrm.fileIndex"), segment_region);
|
||||
renumber(segments, permutation);
|
||||
}
|
||||
{
|
||||
extractor::EdgeBasedNodeDataContainer node_data;
|
||||
extractor::files::readNodeData(config.node_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
renumber(node_data, permutation);
|
||||
extractor::files::writeNodeData(config.node_data_path, node_data);
|
||||
extractor::files::writeNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
}
|
||||
if (boost::filesystem::exists(config.hsgr_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
util::Log(logWARNING) << "Found existing .osrm.hsgr file, removing. You need to re-run "
|
||||
"osrm-contract after osrm-partition.";
|
||||
boost::filesystem::remove(config.hsgr_path);
|
||||
boost::filesystem::remove(config.GetPath(".osrm.hsgr"));
|
||||
}
|
||||
TIMER_STOP(renumber);
|
||||
util::Log() << "Renumbered data in " << TIMER_SEC(renumber) << " seconds";
|
||||
@@ -215,9 +215,9 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
util::Log() << "CellStorage constructed in " << TIMER_SEC(cell_storage) << " seconds";
|
||||
|
||||
TIMER_START(writing_mld_data);
|
||||
files::writePartition(config.partition_path, mlp);
|
||||
files::writeCells(config.storage_path, storage);
|
||||
extractor::files::writeEdgeBasedGraph(config.edge_based_graph_path,
|
||||
files::writePartition(config.GetPath(".osrm.partition"), mlp);
|
||||
files::writeCells(config.GetPath(".osrm.cells"), storage);
|
||||
extractor::files::writeEdgeBasedGraph(config.GetPath(".osrm.ebg"),
|
||||
edge_based_graph.GetNumberOfNodes() - 1,
|
||||
graphToEdges(edge_based_graph));
|
||||
TIMER_STOP(writing_mld_data);
|
||||
|
||||
+58
-50
@@ -206,21 +206,22 @@ int Storage::Run(int max_wait)
|
||||
void Storage::PopulateLayout(DataLayout &layout)
|
||||
{
|
||||
{
|
||||
auto absolute_file_index_path = boost::filesystem::absolute(config.file_index_path);
|
||||
auto absolute_file_index_path =
|
||||
boost::filesystem::absolute(config.GetPath(".osrm.fileIndex"));
|
||||
|
||||
layout.SetBlockSize<char>(DataLayout::FILE_INDEX_PATH,
|
||||
absolute_file_index_path.string().length() + 1);
|
||||
}
|
||||
|
||||
{
|
||||
util::Log() << "load names from: " << config.names_data_path;
|
||||
util::Log() << "load names from: " << config.GetPath(".osrm.names");
|
||||
// number of entries in name index
|
||||
io::FileReader name_file(config.names_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader name_file(config.GetPath(".osrm.names"), io::FileReader::VerifyFingerprint);
|
||||
layout.SetBlockSize<char>(DataLayout::NAME_CHAR_DATA, name_file.GetSize());
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader reader(config.turn_lane_description_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.tls"), io::FileReader::VerifyFingerprint);
|
||||
auto num_offsets = reader.ReadVectorSize<std::uint32_t>();
|
||||
auto num_masks = reader.ReadVectorSize<extractor::guidance::TurnLaneType::Mask>();
|
||||
|
||||
@@ -231,7 +232,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// Loading information for original edges
|
||||
{
|
||||
io::FileReader edges_file(config.edges_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader edges_file(config.GetPath(".osrm.edges"), io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_original_edges = edges_file.ReadElementCount64();
|
||||
|
||||
// note: settings this all to the same size is correct, we extract them from the same struct
|
||||
@@ -246,7 +247,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader nodes_data_file(config.edge_based_nodes_data_path,
|
||||
io::FileReader nodes_data_file(config.GetPath(".osrm.ebg_nodes"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto nodes_number = nodes_data_file.ReadElementCount64();
|
||||
|
||||
@@ -257,9 +258,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<extractor::ClassData>(DataLayout::CLASSES_LIST, nodes_number);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.hsgr_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
io::FileReader reader(config.hsgr_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.hsgr"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
reader.Skip<std::uint32_t>(1); // checksum
|
||||
auto num_nodes = reader.ReadVectorSize<contractor::QueryGraph::NodeArrayEntry>();
|
||||
@@ -282,7 +283,8 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load rsearch tree size
|
||||
{
|
||||
io::FileReader tree_node_file(config.ram_index_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader tree_node_file(config.GetPath(".osrm.ramIndex"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto tree_size = tree_node_file.ReadElementCount64();
|
||||
layout.SetBlockSize<RTreeNode>(DataLayout::R_SEARCH_TREE, tree_size);
|
||||
@@ -297,15 +299,17 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// read timestampsize
|
||||
{
|
||||
io::FileReader timestamp_file(config.timestamp_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto timestamp_size = timestamp_file.GetSize();
|
||||
layout.SetBlockSize<char>(DataLayout::TIMESTAMP, timestamp_size);
|
||||
}
|
||||
|
||||
// load core marker size
|
||||
if (boost::filesystem::exists(config.core_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.core")))
|
||||
{
|
||||
io::FileReader core_marker_file(config.core_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader core_marker_file(config.GetPath(".osrm.core"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_core_markers = core_marker_file.ReadElementCount64();
|
||||
layout.SetBlockSize<unsigned>(DataLayout::CH_CORE_MARKER, number_of_core_markers);
|
||||
}
|
||||
@@ -316,7 +320,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load turn weight penalties
|
||||
{
|
||||
io::FileReader turn_weight_penalties_file(config.turn_weight_penalties_path,
|
||||
io::FileReader turn_weight_penalties_file(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_weight_penalties_file.ReadElementCount64();
|
||||
layout.SetBlockSize<TurnPenalty>(DataLayout::TURN_WEIGHT_PENALTIES, number_of_penalties);
|
||||
@@ -324,7 +328,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load turn duration penalties
|
||||
{
|
||||
io::FileReader turn_duration_penalties_file(config.turn_duration_penalties_path,
|
||||
io::FileReader turn_duration_penalties_file(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_duration_penalties_file.ReadElementCount64();
|
||||
layout.SetBlockSize<TurnPenalty>(DataLayout::TURN_DURATION_PENALTIES, number_of_penalties);
|
||||
@@ -332,7 +336,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load coordinate size
|
||||
{
|
||||
io::FileReader node_file(config.node_based_nodes_data_path,
|
||||
io::FileReader node_file(config.GetPath(".osrm.nbg_nodes"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto coordinate_list_size = node_file.ReadElementCount64();
|
||||
layout.SetBlockSize<util::Coordinate>(DataLayout::COORDINATE_LIST, coordinate_list_size);
|
||||
@@ -348,7 +352,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
// load geometries sizes
|
||||
{
|
||||
io::FileReader reader(config.geometries_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.geometry"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto number_of_geometries_indices = reader.ReadVectorSize<unsigned>();
|
||||
layout.SetBlockSize<unsigned>(DataLayout::GEOMETRIES_INDEX, number_of_geometries_indices);
|
||||
@@ -389,7 +393,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
}
|
||||
|
||||
{
|
||||
io::FileReader reader(config.intersection_class_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.icd"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
auto num_discreate_bearings = reader.ReadVectorSize<DiscreteBearing>();
|
||||
layout.SetBlockSize<DiscreteBearing>(DataLayout::BEARING_VALUES, num_discreate_bearings);
|
||||
@@ -413,7 +417,7 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
{
|
||||
// Loading turn lane data
|
||||
io::FileReader lane_data_file(config.turn_lane_data_path,
|
||||
io::FileReader lane_data_file(config.GetPath(".osrm.tld"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto lane_tuple_count = lane_data_file.ReadElementCount64();
|
||||
layout.SetBlockSize<util::guidance::LaneTupleIdPair>(DataLayout::TURN_LANE_DATA,
|
||||
@@ -422,9 +426,10 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
{
|
||||
// Loading MLD Data
|
||||
if (boost::filesystem::exists(config.mld_partition_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.partition")))
|
||||
{
|
||||
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.partition"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
reader.Skip<partition::MultiLevelPartition::LevelData>(1);
|
||||
layout.SetBlockSize<partition::MultiLevelPartition::LevelData>(
|
||||
@@ -442,9 +447,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.cells")))
|
||||
{
|
||||
io::FileReader reader(config.mld_storage_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.cells"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto weights_count = reader.ReadVectorSize<EdgeWeight>();
|
||||
layout.SetBlockSize<EdgeWeight>(DataLayout::MLD_CELL_WEIGHTS, weights_count);
|
||||
@@ -472,9 +477,9 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_LEVEL_OFFSETS, 0);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_graph_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.mldgr")))
|
||||
{
|
||||
io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader reader(config.GetPath(".osrm.mldgr"), io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto num_nodes =
|
||||
reader.ReadVectorSize<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry>();
|
||||
@@ -509,7 +514,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
// read actual data into shared memory object //
|
||||
|
||||
// Load the HSGR file
|
||||
if (boost::filesystem::exists(config.hsgr_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))
|
||||
{
|
||||
auto graph_nodes_ptr = layout.GetBlockPtr<contractor::QueryGraphView::NodeArrayEntry, true>(
|
||||
memory_ptr, storage::DataLayout::CH_GRAPH_NODE_LIST);
|
||||
@@ -523,7 +528,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
graph_edges_ptr, layout.num_entries[storage::DataLayout::CH_GRAPH_EDGE_LIST]);
|
||||
|
||||
contractor::QueryGraphView graph_view(std::move(node_list), std::move(edge_list));
|
||||
contractor::files::readGraph(config.hsgr_data_path, *checksum, graph_view);
|
||||
contractor::files::readGraph(config.GetPath(".osrm.hsgr"), *checksum, graph_view);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -543,7 +548,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
file_index_path_ptr + layout.GetBlockSize(DataLayout::FILE_INDEX_PATH),
|
||||
0);
|
||||
const auto absolute_file_index_path =
|
||||
boost::filesystem::absolute(config.file_index_path).string();
|
||||
boost::filesystem::absolute(config.GetPath(".osrm.fileIndex")).string();
|
||||
BOOST_ASSERT(static_cast<std::size_t>(layout.GetBlockSize(DataLayout::FILE_INDEX_PATH)) >=
|
||||
absolute_file_index_path.size());
|
||||
std::copy(
|
||||
@@ -552,7 +557,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// Name data
|
||||
{
|
||||
io::FileReader name_file(config.names_data_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader name_file(config.GetPath(".osrm.names"), io::FileReader::VerifyFingerprint);
|
||||
std::size_t name_file_size = name_file.GetSize();
|
||||
|
||||
BOOST_ASSERT(name_file_size == layout.GetBlockSize(DataLayout::NAME_CHAR_DATA));
|
||||
@@ -564,7 +569,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// Turn lane data
|
||||
{
|
||||
io::FileReader lane_data_file(config.turn_lane_data_path,
|
||||
io::FileReader lane_data_file(config.GetPath(".osrm.tld"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto lane_tuple_count = lane_data_file.ReadElementCount64();
|
||||
@@ -590,8 +595,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
util::vector_view<extractor::guidance::TurnLaneType::Mask> masks(
|
||||
masks_ptr, layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
||||
|
||||
extractor::files::readTurnLaneDescriptions(
|
||||
config.turn_lane_description_path, offsets, masks);
|
||||
extractor::files::readTurnLaneDescriptions(config.GetPath(".osrm.tls"), offsets, masks);
|
||||
}
|
||||
|
||||
// Load edge-based nodes data
|
||||
@@ -627,7 +631,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(travel_modes),
|
||||
std::move(classes));
|
||||
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
}
|
||||
|
||||
// Load original edge data
|
||||
@@ -664,7 +668,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(pre_turn_bearings),
|
||||
std::move(post_turn_bearings));
|
||||
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
}
|
||||
|
||||
// load compressed geometry
|
||||
@@ -729,13 +733,14 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(geometry_rev_duration_list),
|
||||
std::move(datasources_list)};
|
||||
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
}
|
||||
|
||||
{
|
||||
const auto datasources_names_ptr = layout.GetBlockPtr<extractor::Datasources, true>(
|
||||
memory_ptr, DataLayout::DATASOURCES_NAMES);
|
||||
extractor::files::readDatasources(config.datasource_names_path, *datasources_names_ptr);
|
||||
extractor::files::readDatasources(config.GetPath(".osrm.datasource_names"),
|
||||
*datasources_names_ptr);
|
||||
}
|
||||
|
||||
// Loading list of coordinates
|
||||
@@ -752,12 +757,12 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]),
|
||||
layout.num_entries[DataLayout::COORDINATE_LIST]);
|
||||
|
||||
extractor::files::readNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
extractor::files::readNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
}
|
||||
|
||||
// load turn weight penalties
|
||||
{
|
||||
io::FileReader turn_weight_penalties_file(config.turn_weight_penalties_path,
|
||||
io::FileReader turn_weight_penalties_file(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_weight_penalties_file.ReadElementCount64();
|
||||
const auto turn_weight_penalties_ptr =
|
||||
@@ -767,7 +772,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// load turn duration penalties
|
||||
{
|
||||
io::FileReader turn_duration_penalties_file(config.turn_duration_penalties_path,
|
||||
io::FileReader turn_duration_penalties_file(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto number_of_penalties = turn_duration_penalties_file.ReadElementCount64();
|
||||
const auto turn_duration_penalties_ptr =
|
||||
@@ -777,7 +782,8 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// store timestamp
|
||||
{
|
||||
io::FileReader timestamp_file(config.timestamp_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader timestamp_file(config.GetPath(".osrm.timestamp"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
const auto timestamp_size = timestamp_file.GetSize();
|
||||
|
||||
const auto timestamp_ptr =
|
||||
@@ -788,7 +794,8 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
// store search tree portion of rtree
|
||||
{
|
||||
io::FileReader tree_node_file(config.ram_index_path, io::FileReader::VerifyFingerprint);
|
||||
io::FileReader tree_node_file(config.GetPath(".osrm.ramIndex"),
|
||||
io::FileReader::VerifyFingerprint);
|
||||
// perform this read so that we're at the right stream position for the next
|
||||
// read.
|
||||
tree_node_file.Skip<std::uint64_t>(1);
|
||||
@@ -805,21 +812,22 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
layout.num_entries[DataLayout::R_SEARCH_TREE_LEVELS]);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.core_data_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.core")))
|
||||
{
|
||||
auto core_marker_ptr =
|
||||
layout.GetBlockPtr<unsigned, true>(memory_ptr, storage::DataLayout::CH_CORE_MARKER);
|
||||
util::vector_view<bool> is_core_node(
|
||||
core_marker_ptr, layout.num_entries[storage::DataLayout::CH_CORE_MARKER]);
|
||||
|
||||
contractor::files::readCoreMarker(config.core_data_path, is_core_node);
|
||||
contractor::files::readCoreMarker(config.GetPath(".osrm.core"), is_core_node);
|
||||
}
|
||||
|
||||
// load profile properties
|
||||
{
|
||||
const auto profile_properties_ptr = layout.GetBlockPtr<extractor::ProfileProperties, true>(
|
||||
memory_ptr, DataLayout::PROPERTIES);
|
||||
extractor::files::readProfileProperties(config.properties_path, *profile_properties_ptr);
|
||||
extractor::files::readProfileProperties(config.GetPath(".osrm.properties"),
|
||||
*profile_properties_ptr);
|
||||
}
|
||||
|
||||
// Load intersection data
|
||||
@@ -856,12 +864,12 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
entry_class_ptr, layout.num_entries[storage::DataLayout::ENTRY_CLASS]);
|
||||
|
||||
extractor::files::readIntersections(
|
||||
config.intersection_class_path, intersection_bearings_view, entry_classes);
|
||||
config.GetPath(".osrm.icd"), intersection_bearings_view, entry_classes);
|
||||
}
|
||||
|
||||
{
|
||||
// Loading MLD Data
|
||||
if (boost::filesystem::exists(config.mld_partition_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.partition")))
|
||||
{
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_LEVEL_DATA) > 0);
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELL_TO_CHILDREN) > 0);
|
||||
@@ -885,10 +893,10 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
partition::MultiLevelPartitionView mlp{
|
||||
std::move(level_data), std::move(partition), std::move(cell_to_children)};
|
||||
partition::files::readPartition(config.mld_partition_path, mlp);
|
||||
partition::files::readPartition(config.GetPath(".osrm.partition"), mlp);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.cells")))
|
||||
{
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELLS) > 0);
|
||||
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS) > 0);
|
||||
@@ -936,10 +944,10 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
std::move(destination_boundary),
|
||||
std::move(cells),
|
||||
std::move(level_offsets)};
|
||||
partition::files::readCells(config.mld_storage_path, storage);
|
||||
partition::files::readCells(config.GetPath(".osrm.cells"), storage);
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(config.mld_graph_path))
|
||||
if (boost::filesystem::exists(config.GetPath(".osrm.mldgr")))
|
||||
{
|
||||
|
||||
auto graph_nodes_ptr =
|
||||
@@ -962,7 +970,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
customizer::MultiLevelEdgeBasedGraphView graph_view(
|
||||
std::move(node_list), std::move(edge_list), std::move(node_to_offset));
|
||||
partition::files::readGraph(config.mld_graph_path, graph_view);
|
||||
partition::files::readGraph(config.GetPath(".osrm.mldgr"), graph_view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&contractor_config.base_path),
|
||||
"Input file in .osm, .osm.bz2 or .osm.pbf format");
|
||||
|
||||
// positional option
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
contractor_config.UseDefaultOutputNames();
|
||||
contractor_config.UseDefaultOutputNames(contractor_config.base_path);
|
||||
|
||||
if (1 > contractor_config.requested_num_threads)
|
||||
{
|
||||
@@ -169,14 +169,14 @@ int main(int argc, char *argv[]) try
|
||||
<< "! This setting may have performance side-effects.";
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << contractor_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << contractor_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
util::Log() << "Input file: " << contractor_config.osrm_path.filename().string();
|
||||
util::Log() << "Input file: " << contractor_config.GetPath(".osrm").filename().string();
|
||||
util::Log() << "Threads: " << contractor_config.requested_num_threads;
|
||||
|
||||
tbb::task_scheduler_init init(contractor_config.requested_num_threads);
|
||||
|
||||
@@ -72,7 +72,7 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&customization_config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@@ -145,7 +145,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
customization_config.UseDefaultOutputNames();
|
||||
customization_config.UseDefaultOutputNames(customization_config.base_path);
|
||||
|
||||
if (1 > customization_config.requested_num_threads)
|
||||
{
|
||||
@@ -153,9 +153,9 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(customization_config.osrm_path))
|
||||
if (!boost::filesystem::is_regular_file(customization_config.GetPath(".osrm")))
|
||||
{
|
||||
util::Log(logERROR) << "Input file " << customization_config.osrm_path.string()
|
||||
util::Log(logERROR) << "Input file " << customization_config.GetPath(".osrm").string()
|
||||
<< " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[]) try
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
extractor_config.UseDefaultOutputNames();
|
||||
extractor_config.UseDefaultOutputNames(extractor_config.input_path);
|
||||
|
||||
if (1 > extractor_config.requested_num_threads)
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ return_code parseArguments(int argc, char *argv[], partition::PartitionConfig &c
|
||||
boost::program_options::options_description hidden_options("Hidden options");
|
||||
hidden_options.add_options()(
|
||||
"input,i",
|
||||
boost::program_options::value<boost::filesystem::path>(&config.osrm_path),
|
||||
boost::program_options::value<boost::filesystem::path>(&config.base_path),
|
||||
"Input file in .osrm format");
|
||||
|
||||
// positional option
|
||||
@@ -199,7 +199,7 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
// set the default in/output names
|
||||
partition_config.UseDefaultOutputNames();
|
||||
partition_config.UseDefaultOutputNames(partition_config.base_path);
|
||||
|
||||
if (1 > partition_config.requested_num_threads)
|
||||
{
|
||||
@@ -219,9 +219,9 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
};
|
||||
|
||||
if (!check_file(partition_config.edge_based_graph_path) ||
|
||||
!check_file(partition_config.cnbg_ebg_mapping_path) ||
|
||||
!check_file(partition_config.compressed_node_based_graph_path))
|
||||
if (!check_file(partition_config.GetPath(".osrm.ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg_to_ebg")) ||
|
||||
!check_file(partition_config.GetPath(".osrm.cnbg")))
|
||||
{
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ int main(int argc, const char *argv[]) try
|
||||
}
|
||||
if (!base_path.empty())
|
||||
{
|
||||
config.storage_config = storage::StorageConfig(base_path);
|
||||
config.storage_config.UseDefaultOutputNames(base_path);
|
||||
}
|
||||
if (!config.use_shared_memory && !config.storage_config.IsValid())
|
||||
{
|
||||
|
||||
+2
-1
@@ -163,7 +163,8 @@ int main(const int argc, const char *argv[]) try
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
storage::StorageConfig config(base_path);
|
||||
storage::StorageConfig config;
|
||||
config.UseDefaultOutputNames(base_path);
|
||||
if (!config.IsValid())
|
||||
{
|
||||
util::Log(logERROR) << "Config contains invalid file paths. Exiting!";
|
||||
|
||||
+27
-19
@@ -105,13 +105,13 @@ void checkWeightsConsistency(
|
||||
const std::vector<osrm::extractor::EdgeBasedEdge> &edge_based_edge_list)
|
||||
{
|
||||
extractor::SegmentDataContainer segment_data;
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
|
||||
extractor::EdgeBasedNodeDataContainer node_data;
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
|
||||
extractor::TurnDataContainer turn_data;
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
|
||||
for (auto &edge : edge_based_edge_list)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ void saveDatasourcesNames(const UpdaterConfig &config)
|
||||
source++;
|
||||
}
|
||||
|
||||
extractor::files::writeDatasources(config.datasource_names_path, sources);
|
||||
extractor::files::writeDatasources(config.GetPath(".osrm.datasource_names"), sources);
|
||||
}
|
||||
|
||||
std::vector<std::uint64_t>
|
||||
@@ -404,7 +404,7 @@ updateTurnPenalties(const UpdaterConfig &config,
|
||||
// Mapped file pointer for turn indices
|
||||
boost::iostreams::mapped_file_source turn_index_region;
|
||||
auto turn_index_blocks = util::mmapFile<extractor::lookup::TurnIndexBlock>(
|
||||
config.turn_penalties_index_path, turn_index_region);
|
||||
config.GetPath(".osrm.turn_penalties_index"), turn_index_region);
|
||||
|
||||
// Get the turn penalty and update to the new value if required
|
||||
std::vector<std::uint64_t> updated_turns;
|
||||
@@ -490,7 +490,7 @@ updateConditionalTurns(const UpdaterConfig &config,
|
||||
// Mapped file pointer for turn indices
|
||||
boost::iostreams::mapped_file_source turn_index_region;
|
||||
auto turn_index_blocks = util::mmapFile<extractor::lookup::TurnIndexBlock>(
|
||||
config.turn_penalties_index_path, turn_index_region);
|
||||
config.GetPath(".osrm.turn_penalties_index"), turn_index_region);
|
||||
|
||||
std::vector<std::uint64_t> updated_turns;
|
||||
if (conditional_turns.size() == 0)
|
||||
@@ -566,11 +566,11 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
extractor::PackedOSMIDs osm_node_ids;
|
||||
|
||||
extractor::files::readEdgeBasedGraph(
|
||||
config.edge_based_graph_path, max_edge_id, edge_based_edge_list);
|
||||
extractor::files::readNodes(config.node_based_nodes_data_path, coordinates, osm_node_ids);
|
||||
config.GetPath(".osrm.ebg"), max_edge_id, edge_based_edge_list);
|
||||
extractor::files::readNodes(config.GetPath(".osrm.nbg_nodes"), coordinates, osm_node_ids);
|
||||
|
||||
const bool update_conditional_turns =
|
||||
!config.turn_restrictions_path.empty() && config.valid_now;
|
||||
!config.GetPath(".osrm.restrictions").empty() && config.valid_now;
|
||||
const bool update_edge_weights = !config.segment_speed_lookup_paths.empty();
|
||||
const bool update_turn_penalties = !config.turn_penalty_lookup_paths.empty();
|
||||
|
||||
@@ -593,33 +593,35 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
if (update_edge_weights || update_turn_penalties || update_conditional_turns)
|
||||
{
|
||||
const auto load_segment_data = [&] {
|
||||
extractor::files::readSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::readSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
};
|
||||
|
||||
const auto load_node_data = [&] {
|
||||
extractor::files::readNodeData(config.edge_based_nodes_data_path, node_data);
|
||||
extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data);
|
||||
};
|
||||
|
||||
const auto load_edge_data = [&] {
|
||||
extractor::files::readTurnData(config.edges_data_path, turn_data);
|
||||
extractor::files::readTurnData(config.GetPath(".osrm.edges"), turn_data);
|
||||
};
|
||||
|
||||
const auto load_turn_weight_penalties = [&] {
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_weight_penalties_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, turn_weight_penalties);
|
||||
};
|
||||
|
||||
const auto load_turn_duration_penalties = [&] {
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_duration_penalties_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
FileReader::VerifyFingerprint);
|
||||
storage::serialization::read(reader, turn_duration_penalties);
|
||||
};
|
||||
|
||||
const auto load_profile_properties = [&] {
|
||||
// Propagate profile properties to contractor configuration structure
|
||||
storage::io::FileReader profile_properties_file(
|
||||
config.properties_path, storage::io::FileReader::VerifyFingerprint);
|
||||
config.GetPath(".osrm.properties"), storage::io::FileReader::VerifyFingerprint);
|
||||
profile_properties = profile_properties_file.ReadOne<extractor::ProfileProperties>();
|
||||
};
|
||||
|
||||
@@ -635,7 +637,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
if (update_conditional_turns)
|
||||
{
|
||||
using storage::io::FileReader;
|
||||
FileReader reader(config.turn_restrictions_path, FileReader::VerifyFingerprint);
|
||||
FileReader reader(config.GetPath(".osrm.restrictions"), FileReader::VerifyFingerprint);
|
||||
extractor::serialization::read(reader, conditional_turns);
|
||||
}
|
||||
|
||||
@@ -652,7 +654,7 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
coordinates,
|
||||
osm_node_ids);
|
||||
// Now save out the updated compressed geometries
|
||||
extractor::files::writeSegmentData(config.geometries_path, segment_data);
|
||||
extractor::files::writeSegmentData(config.GetPath(".osrm.geometry"), segment_data);
|
||||
TIMER_STOP(segment);
|
||||
util::Log() << "Updating segment data took " << TIMER_MSEC(segment) << "ms.";
|
||||
}
|
||||
@@ -845,8 +847,14 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
};
|
||||
|
||||
tbb::parallel_invoke(
|
||||
[&] { save_penalties(config.turn_weight_penalties_path, turn_weight_penalties); },
|
||||
[&] { save_penalties(config.turn_duration_penalties_path, turn_duration_penalties); });
|
||||
[&] {
|
||||
save_penalties(config.GetPath(".osrm.turn_weight_penalties"),
|
||||
turn_weight_penalties);
|
||||
},
|
||||
[&] {
|
||||
save_penalties(config.GetPath(".osrm.turn_duration_penalties"),
|
||||
turn_duration_penalties);
|
||||
});
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
|
||||
Reference in New Issue
Block a user