Port .enw file to tar format

This commit is contained in:
Patrick Niklaus 2018-03-21 12:06:17 +00:00
parent b8260e44fa
commit 2b010fc6f3
3 changed files with 20 additions and 10 deletions

View File

@ -439,6 +439,24 @@ void writeNames(const boost::filesystem::path &path, const NameTableT &table)
serialization::write(writer, "/common/names", table); serialization::write(writer, "/common/names", table);
} }
template <typename NodeWeigtsVectorT>
void readEdgeBasedNodeWeights(const boost::filesystem::path &path, NodeWeigtsVectorT &weights)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
storage::serialization::read(reader, "/extractor/edge_based_node_weights", weights);
}
template <typename NodeWeigtsVectorT>
void writeEdgeBasedNodeWeights(const boost::filesystem::path &path, const NodeWeigtsVectorT &weights)
{
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
storage::tar::FileWriter writer{path, fingerprint};
storage::serialization::write(writer, "/extractor/edge_based_node_weights", weights);
}
} }
} }
} }

View File

@ -63,11 +63,7 @@ int Contractor::Run()
util::Log() << "Reading node weights."; util::Log() << "Reading node weights.";
std::vector<EdgeWeight> node_weights; std::vector<EdgeWeight> node_weights;
{ extractor::files::readEdgeBasedNodeWeights(config.GetPath(".osrm.enw"), node_weights);
storage::io::FileReader reader(config.GetPath(".osrm.enw"),
storage::io::FileReader::VerifyFingerprint);
storage::serialization::read(reader, node_weights);
}
util::Log() << "Done reading node weights."; util::Log() << "Done reading node weights.";
util::Log() << "Loading edge-expanded graph representation"; util::Log() << "Loading edge-expanded graph representation";

View File

@ -325,11 +325,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
util::Log() << "Saving edge-based node weights to file."; util::Log() << "Saving edge-based node weights to file.";
TIMER_START(timer_write_node_weights); TIMER_START(timer_write_node_weights);
{ extractor::files::writeEdgeBasedNodeWeights(config.GetPath(".osrm.enw"), edge_based_node_weights);
storage::io::FileWriter writer(config.GetPath(".osrm.enw"),
storage::io::FileWriter::GenerateFingerprint);
storage::serialization::write(writer, edge_based_node_weights);
}
TIMER_STOP(timer_write_node_weights); TIMER_STOP(timer_write_node_weights);
util::Log() << "Done writing. (" << TIMER_SEC(timer_write_node_weights) << ")"; util::Log() << "Done writing. (" << TIMER_SEC(timer_write_node_weights) << ")";