Add update functionality to osrm-customize

All speed file flags are compatible with osrm-contract.
This commit is contained in:
Patrick Niklaus
2017-03-10 22:35:46 +00:00
committed by Patrick Niklaus
parent c6e9cc8024
commit 907f933a54
21 changed files with 266 additions and 93 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
namespace osrm
{
namespace customize
namespace customizer
{
class CellCustomizer
+2 -2
View File
@@ -5,7 +5,7 @@
namespace osrm
{
namespace customize
namespace customizer
{
class Customizer
@@ -14,7 +14,7 @@ class Customizer
int Run(const CustomizationConfig &config);
};
} // namespace customize
} // namespace customizer
} // namespace osrm
#endif // OSRM_CUSTOMIZE_CUSTOMIZER_HPP
+10 -1
View File
@@ -1,6 +1,8 @@
#ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
#define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP
#include "updater/updater_config.hpp"
#include <boost/filesystem/path.hpp>
#include <array>
@@ -8,7 +10,7 @@
namespace osrm
{
namespace customize
namespace customizer
{
struct CustomizationConfig
@@ -33,6 +35,10 @@ struct CustomizationConfig
edge_based_graph_path = basepath + ".osrm.ebg";
mld_partition_path = basepath + ".osrm.partition";
mld_storage_path = basepath + ".osrm.cells";
mld_graph_path = basepath + ".osrm.mldgr";
updater_config.osrm_input_path = basepath + ".osrm";
updater_config.UseDefaultOutputNames();
}
// might be changed to the node based graph at some point
@@ -40,8 +46,11 @@ struct CustomizationConfig
boost::filesystem::path edge_based_graph_path;
boost::filesystem::path mld_partition_path;
boost::filesystem::path mld_storage_path;
boost::filesystem::path mld_graph_path;
unsigned requested_num_threads;
updater::UpdaterConfig updater_config;
};
}
}
+49
View File
@@ -0,0 +1,49 @@
#ifndef OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP
#define OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP
#include "extractor/edge_based_edge.hpp"
#include "partition/edge_based_graph.hpp"
#include "util/static_graph.hpp"
#include "util/typedefs.hpp"
#include <boost/filesystem/path.hpp>
namespace osrm
{
namespace customizer
{
struct StaticEdgeBasedGraph;
namespace io
{
void read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph);
void write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph);
}
using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
struct StaticEdgeBasedGraph : util::StaticGraph<EdgeBasedGraphEdgeData>
{
using Base = util::StaticGraph<EdgeBasedGraphEdgeData>;
using Base::Base;
friend void io::read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph);
friend void io::write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph);
};
struct StaticEdgeBasedGraphView : util::StaticGraph<EdgeBasedGraphEdgeData, true>
{
using Base = util::StaticGraph<EdgeBasedGraphEdgeData, true>;
using Base::Base;
};
struct StaticEdgeBasedGraphEdge : StaticEdgeBasedGraph::InputEdge
{
using Base = StaticEdgeBasedGraph::InputEdge;
using Base::Base;
};
}
}
#endif
+36
View File
@@ -0,0 +1,36 @@
#ifndef OSRM_CUSTOMIZER_IO_HPP
#define OSRM_CUSTOMIZER_IO_HPP
#include "customizer/edge_based_graph.hpp"
#include "storage/io.hpp"
namespace osrm
{
namespace customizer
{
namespace io
{
inline void read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
reader.DeserializeVector(graph.node_array);
reader.DeserializeVector(graph.edge_array);
}
inline void write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};
writer.SerializeVector(graph.node_array);
writer.SerializeVector(graph.edge_array);
}
}
}
}
#endif