Moved raw outputs to the appropriate macros
This commit is contained in:
parent
928e1178b1
commit
fd3ce305f4
@ -28,7 +28,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#undef VERBOSE2
|
#undef VERBOSE2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <climits>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -60,8 +61,7 @@ std::vector<_Restriction> inputRestrictions;
|
|||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
if(argc < 3) {
|
if(argc < 3) {
|
||||||
cerr << "usage: " << std::endl << argv[0] << " <osrm-data> <osrm-restrictions>" << std::endl;
|
ERR("usage: " << std::endl << argv[0] << " <osrm-data> <osrm-restrictions>");
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
INFO("Using restrictions from file: " << argv[2]);
|
INFO("Using restrictions from file: " << argv[2]);
|
||||||
ifstream restrictionsInstream(argv[2], ios::binary);
|
ifstream restrictionsInstream(argv[2], ios::binary);
|
||||||
@ -83,17 +83,17 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
omp_set_num_threads(numberOfThreads);
|
omp_set_num_threads(numberOfThreads);
|
||||||
|
|
||||||
std::cout << "preprocessing data from input file " << argv[1];
|
INFO("preprocessing data from input file " << argv[1] << " using STL"
|
||||||
#ifdef _GLIBCXX_PARALLEL
|
#ifdef _GLIBCXX_PARALLEL
|
||||||
std::cout << " using STL parallel mode" << std::endl;
|
"parallel (GCC)"
|
||||||
#else
|
#else
|
||||||
std::cout << " using STL serial mode" << std::endl;
|
"serial"
|
||||||
#endif
|
#endif
|
||||||
|
" mode");
|
||||||
ifstream in;
|
ifstream in;
|
||||||
in.open (argv[1], ifstream::in | ifstream::binary);
|
in.open (argv[1], ifstream::in | ifstream::binary);
|
||||||
if (!in.is_open()) {
|
if (!in.is_open()) {
|
||||||
cerr << "Cannot open " << argv[1] << std::endl; exit(-1);
|
ERR("Cannot open " << argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
char nodeOut[1024];
|
char nodeOut[1024];
|
||||||
@ -132,24 +132,23 @@ int main (int argc, char *argv[]) {
|
|||||||
DELETE(edgeBasedGraphFactory);
|
DELETE(edgeBasedGraphFactory);
|
||||||
|
|
||||||
WritableGrid * writeableGrid = new WritableGrid();
|
WritableGrid * writeableGrid = new WritableGrid();
|
||||||
std::cout << "building grid ..." << std::flush;
|
INFO("building grid ...");
|
||||||
writeableGrid->ConstructGrid(nodeBasedEdgeList, &internalToExternaleNodeMapping, ramIndexOut, fileIndexOut);
|
writeableGrid->ConstructGrid(nodeBasedEdgeList, &internalToExternaleNodeMapping, ramIndexOut, fileIndexOut);
|
||||||
DELETE( writeableGrid );
|
DELETE( writeableGrid );
|
||||||
std::cout << "writing node map ..." << std::flush;
|
|
||||||
ofstream mapOutFile(nodeOut, ios::binary);
|
|
||||||
|
|
||||||
for(NodeID i = 0; i < internalToExternaleNodeMapping.size(); i++) {
|
INFO("writing node map ...");
|
||||||
mapOutFile.write((char *)&(internalToExternaleNodeMapping.at(i)), sizeof(NodeInfo));
|
std::ofstream mapOutFile(nodeOut, ios::binary);
|
||||||
|
BOOST_FOREACH(NodeInfo & info, internalToExternaleNodeMapping) {
|
||||||
|
mapOutFile.write((char *)&(info), sizeof(NodeInfo));
|
||||||
}
|
}
|
||||||
mapOutFile.close();
|
mapOutFile.close();
|
||||||
std::cout << "ok" << std::endl;
|
|
||||||
|
|
||||||
internalToExternaleNodeMapping.clear();
|
internalToExternaleNodeMapping.clear();
|
||||||
std::vector<NodeInfo>().swap(internalToExternaleNodeMapping);
|
std::vector<NodeInfo>().swap(internalToExternaleNodeMapping);
|
||||||
inputRestrictions.clear();
|
inputRestrictions.clear();
|
||||||
std::vector<_Restriction>().swap(inputRestrictions);
|
std::vector<_Restriction>().swap(inputRestrictions);
|
||||||
|
|
||||||
std::cout << "initializing contractor ..." << std::flush;
|
INFO("initializing contractor");
|
||||||
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
||||||
double contractionStartedTimestamp(get_timestamp());
|
double contractionStartedTimestamp(get_timestamp());
|
||||||
contractor->Run();
|
contractor->Run();
|
||||||
@ -160,24 +159,25 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
ContractionCleanup * cleanup = new ContractionCleanup(n, contractedEdges);
|
ContractionCleanup * cleanup = new ContractionCleanup(n, contractedEdges);
|
||||||
contractedEdges.clear();
|
contractedEdges.clear();
|
||||||
|
std::vector<ContractionCleanup::Edge>().swap(contractedEdges);
|
||||||
cleanup->Run();
|
cleanup->Run();
|
||||||
|
|
||||||
std::vector< InputEdge> cleanedEdgeList;
|
std::vector< InputEdge> cleanedEdgeList;
|
||||||
cleanup->GetData(cleanedEdgeList);
|
cleanup->GetData(cleanedEdgeList);
|
||||||
DELETE( cleanup );
|
DELETE( cleanup );
|
||||||
|
|
||||||
std::cout << "Serializing edges " << std::flush;
|
INFO("Serializing edges ");
|
||||||
ofstream edgeOutFile(edgeOut, ios::binary);
|
ofstream edgeOutFile(edgeOut, ios::binary);
|
||||||
Percent p(cleanedEdgeList.size());
|
Percent p(cleanedEdgeList.size());
|
||||||
for(std::vector< InputEdge>::iterator it = cleanedEdgeList.begin(); it != cleanedEdgeList.end(); it++) {
|
BOOST_FOREACH(InputEdge & edge, cleanedEdgeList) {
|
||||||
p.printIncrement();
|
p.printIncrement();
|
||||||
edgeOutFile.write((char *)&(it->data), sizeof(EdgeData));
|
edgeOutFile.write((char *)&(edge.data), sizeof(EdgeData));
|
||||||
edgeOutFile.write((char *)&(it->source), sizeof(NodeID));
|
edgeOutFile.write((char *)&(edge.source), sizeof(NodeID));
|
||||||
edgeOutFile.write((char *)&(it->target), sizeof(NodeID));
|
edgeOutFile.write((char *)&(edge.target), sizeof(NodeID));
|
||||||
}
|
}
|
||||||
edgeOutFile.close();
|
edgeOutFile.close();
|
||||||
cleanedEdgeList.clear();
|
cleanedEdgeList.clear();
|
||||||
|
|
||||||
std::cout << "finished" << std::endl;
|
INFO("finished preprocessing");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user