superclass contractor_config with io_config
This commit is contained in:
parent
29160eec9c
commit
2c7cb5baba
@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef CONTRACTOR_OPTIONS_HPP
|
#ifndef CONTRACTOR_OPTIONS_HPP
|
||||||
#define CONTRACTOR_OPTIONS_HPP
|
#define CONTRACTOR_OPTIONS_HPP
|
||||||
|
|
||||||
|
#include "storage/storage_config.hpp"
|
||||||
#include "updater/updater_config.hpp"
|
#include "updater/updater_config.hpp"
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
@ -39,31 +40,24 @@ namespace osrm
|
|||||||
namespace contractor
|
namespace contractor
|
||||||
{
|
{
|
||||||
|
|
||||||
struct ContractorConfig
|
struct ContractorConfig final : storage::IOConfig
|
||||||
{
|
{
|
||||||
ContractorConfig() : requested_num_threads(0) {}
|
ContractorConfig() : requested_num_threads(0) {}
|
||||||
|
|
||||||
|
ContractorConfig(const boost::filesystem::path &base) : requested_num_threads(0), IOConfig(base)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Infer the output names from the path of the .osrm file
|
// Infer the output names from the path of the .osrm file
|
||||||
void UseDefaultOutputNames()
|
void UseDefaultOutputNames()
|
||||||
{
|
{
|
||||||
level_output_path = osrm_input_path.string() + ".level";
|
IOConfig::UseDefaultOutputNames();
|
||||||
core_output_path = osrm_input_path.string() + ".core";
|
|
||||||
graph_output_path = osrm_input_path.string() + ".hsgr";
|
|
||||||
node_file_path = osrm_input_path.string() + ".enw";
|
|
||||||
updater_config.osrm_input_path = osrm_input_path;
|
updater_config.osrm_input_path = osrm_input_path;
|
||||||
updater_config.UseDefaultOutputNames();
|
updater_config.UseDefaultOutputNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
updater::UpdaterConfig updater_config;
|
updater::UpdaterConfig updater_config;
|
||||||
|
|
||||||
boost::filesystem::path osrm_input_path;
|
|
||||||
|
|
||||||
std::string level_output_path;
|
|
||||||
std::string core_output_path;
|
|
||||||
std::string graph_output_path;
|
|
||||||
|
|
||||||
std::string node_file_path;
|
|
||||||
|
|
||||||
bool use_cached_priority;
|
bool use_cached_priority;
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads;
|
||||||
|
@ -47,7 +47,7 @@ int Contractor::Run()
|
|||||||
util::Log() << "Reading node weights.";
|
util::Log() << "Reading node weights.";
|
||||||
std::vector<EdgeWeight> node_weights;
|
std::vector<EdgeWeight> node_weights;
|
||||||
{
|
{
|
||||||
storage::io::FileReader reader(config.node_file_path,
|
storage::io::FileReader reader(config.node_path,
|
||||||
storage::io::FileReader::VerifyFingerprint);
|
storage::io::FileReader::VerifyFingerprint);
|
||||||
storage::serialization::read(reader, node_weights);
|
storage::serialization::read(reader, node_weights);
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ int Contractor::Run()
|
|||||||
std::vector<float> node_levels;
|
std::vector<float> node_levels;
|
||||||
if (config.use_cached_priority)
|
if (config.use_cached_priority)
|
||||||
{
|
{
|
||||||
files::readLevels(config.level_output_path, node_levels);
|
files::readLevels(config.level_path, node_levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
util::DeallocatingVector<QueryEdge> contracted_edge_list;
|
util::DeallocatingVector<QueryEdge> contracted_edge_list;
|
||||||
@ -90,15 +90,15 @@ int Contractor::Run()
|
|||||||
RangebasedCRC32 crc32_calculator;
|
RangebasedCRC32 crc32_calculator;
|
||||||
const unsigned checksum = crc32_calculator(contracted_edge_list);
|
const unsigned checksum = crc32_calculator(contracted_edge_list);
|
||||||
|
|
||||||
files::writeGraph(config.graph_output_path,
|
files::writeGraph(config.hsgr_data_path,
|
||||||
checksum,
|
checksum,
|
||||||
QueryGraph{max_edge_id + 1, std::move(contracted_edge_list)});
|
QueryGraph{max_edge_id + 1, std::move(contracted_edge_list)});
|
||||||
}
|
}
|
||||||
|
|
||||||
files::writeCoreMarker(config.core_output_path, is_core_node);
|
files::writeCoreMarker(config.core_data_path, is_core_node);
|
||||||
if (!config.use_cached_priority)
|
if (!config.use_cached_priority)
|
||||||
{
|
{
|
||||||
files::writeLevels(config.level_output_path, node_levels);
|
files::writeLevels(config.level_path, node_levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_STOP(preparing);
|
TIMER_STOP(preparing);
|
||||||
|
Loading…
Reference in New Issue
Block a user