superclass partition_config with io_config

This commit is contained in:
Pepijn Schoen 2017-04-29 10:43:36 +02:00 committed by Daniel J. H
parent 2c7cb5baba
commit a9b6686725
3 changed files with 11 additions and 39 deletions

View File

@ -6,12 +6,14 @@
#include <array>
#include <string>
#include "storage/io_config.hpp"
namespace osrm
{
namespace partition
{
struct PartitionConfig
struct PartitionConfig final : storage::IOConfig
{
PartitionConfig()
: requested_num_threads(0), balance(1.2), boundary_factor(0.25), num_optimizing_cuts(10),
@ -20,42 +22,6 @@ struct PartitionConfig
{
}
void UseDefaults()
{
std::string basepath = base_path.string();
const std::string ext = ".osrm";
const auto pos = basepath.find(ext);
if (pos != std::string::npos)
{
basepath.replace(pos, ext.size(), "");
}
else
{
// unknown extension
}
edge_based_graph_path = basepath + ".osrm.ebg";
compressed_node_based_graph_path = basepath + ".osrm.cnbg";
cnbg_ebg_mapping_path = basepath + ".osrm.cnbg_to_ebg";
file_index_path = basepath + ".osrm.fileIndex";
partition_path = basepath + ".osrm.partition";
storage_path = basepath + ".osrm.cells";
node_data_path = basepath + ".osrm.ebg_nodes";
hsgr_path = basepath + ".osrm.hsgr";
}
// might be changed to the node based graph at some point
boost::filesystem::path base_path;
boost::filesystem::path edge_based_graph_path;
boost::filesystem::path compressed_node_based_graph_path;
boost::filesystem::path cnbg_ebg_mapping_path;
boost::filesystem::path partition_path;
boost::filesystem::path file_index_path;
boost::filesystem::path storage_path;
boost::filesystem::path node_data_path;
boost::filesystem::path hsgr_path;
unsigned requested_num_threads;
double balance;

View File

@ -42,6 +42,8 @@ struct IOConfig
level_path = {osrm_input_path.string() + ".level"};
node_path = {osrm_input_path.string() + ".enw"};
edge_based_graph_path = {osrm_input_path.string() + ".ebg"};
compressed_node_based_graph_path = {osrm_input_path.string() + ".cnbg"};
cnbg_ebg_mapping_path = {osrm_input_path.string() + ".cnbg_to_ebg"};
}
boost::filesystem::path osrm_input_path;
@ -70,6 +72,10 @@ struct IOConfig
boost::filesystem::path level_path;
boost::filesystem::path node_path;
boost::filesystem::path edge_based_graph_path;
boost::filesystem::path compressed_node_based_graph_path;
boost::filesystem::path cnbg_ebg_mapping_path;
};
}
}

View File

@ -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.base_path),
boost::program_options::value<boost::filesystem::path>(&config.osrm_input_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.UseDefaults();
partition_config.UseDefaultOutputNames();
if (1 > partition_config.requested_num_threads)
{