Space requirements are better now
This commit is contained in:
parent
d32734af0b
commit
8d008f9dcc
@ -51,7 +51,7 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
assert( edge.data.distance > 0 );
|
assert( edge.data.distance > 0 );
|
||||||
edge.data.shortcut = false;
|
edge.data.shortcut = false;
|
||||||
edge.data.roundabout = i->isRoundabout();
|
edge.data.roundabout = i->isRoundabout();
|
||||||
edge.data.middleName.nameID = i->name();
|
edge.data.nameID = i->name();
|
||||||
edge.data.type = i->type();
|
edge.data.type = i->type();
|
||||||
edge.data.forward = i->isForward();
|
edge.data.forward = i->isForward();
|
||||||
edge.data.backward = i->isBackward();
|
edge.data.backward = i->isBackward();
|
||||||
@ -66,7 +66,6 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO("edges.size()=" << edges.size());
|
|
||||||
|
|
||||||
#ifdef _GLIBCXX_PARALLEL
|
#ifdef _GLIBCXX_PARALLEL
|
||||||
__gnu_parallel::sort( edges.begin(), edges.end() );
|
__gnu_parallel::sort( edges.begin(), edges.end() );
|
||||||
@ -79,14 +78,12 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EdgeBasedGraphFactory::GetEdgeBasedEdges( std::vector< EdgeBasedEdge >& edges ) {
|
void EdgeBasedGraphFactory::GetEdgeBasedEdges( std::vector< EdgeBasedEdge >& outputEdgeList ) {
|
||||||
|
|
||||||
GUARANTEE(0 == edges.size(), "Vector passed to " << __FUNCTION__ << " is not empty");
|
GUARANTEE(0 == outputEdgeList.size(), "Vector passed to EdgeBasedGraphFactory::GetEdgeBasedEdges(..) is not empty");
|
||||||
GUARANTEE(0 != edgeBasedEdges.size(), "No edges in edge based graph");
|
GUARANTEE(0 != edgeBasedEdges.size(), "No edges in edge based graph");
|
||||||
|
|
||||||
BOOST_FOREACH ( EdgeBasedEdge currentEdge, edgeBasedEdges) {
|
edgeBasedEdges.swap(outputEdgeList);
|
||||||
edges.push_back(currentEdge);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes) {
|
void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes) {
|
||||||
@ -97,8 +94,6 @@ void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nod
|
|||||||
void EdgeBasedGraphFactory::Run() {
|
void EdgeBasedGraphFactory::Run() {
|
||||||
INFO("Generating Edge based representation of input data");
|
INFO("Generating Edge based representation of input data");
|
||||||
|
|
||||||
_edgeBasedGraph.reset(new _EdgeBasedDynamicGraph(_nodeBasedGraph->GetNumberOfEdges() ) );
|
|
||||||
|
|
||||||
std::vector<_Restriction>::iterator restrictionIterator = inputRestrictions.begin();
|
std::vector<_Restriction>::iterator restrictionIterator = inputRestrictions.begin();
|
||||||
Percent p(_nodeBasedGraph->GetNumberOfNodes());
|
Percent p(_nodeBasedGraph->GetNumberOfNodes());
|
||||||
int numberOfResolvedRestrictions(0);
|
int numberOfResolvedRestrictions(0);
|
||||||
@ -141,25 +136,21 @@ void EdgeBasedGraphFactory::Run() {
|
|||||||
ERR("edgeBasedTarget" << edgeBasedTarget << ">" << _nodeBasedGraph->GetNumberOfEdges());
|
ERR("edgeBasedTarget" << edgeBasedTarget << ">" << _nodeBasedGraph->GetNumberOfEdges());
|
||||||
}
|
}
|
||||||
|
|
||||||
_EdgeBasedEdge newEdge;
|
|
||||||
newEdge.source = edgeBasedSource;
|
|
||||||
newEdge.target = edgeBasedTarget;
|
|
||||||
|
|
||||||
//incorporate turn costs, this is just a simple model and can (read: must) be extended
|
//incorporate turn costs, this is just a simple model and can (read: must) be extended
|
||||||
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
|
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
|
||||||
|
|
||||||
newEdge.data.distance = (int)( _nodeBasedGraph->GetEdgeData(e1).distance *(1+std::abs((angle-180.)/180.)));
|
unsigned distance = (int)( _nodeBasedGraph->GetEdgeData(e1).distance *(1+std::abs((angle-180.)/180.)));
|
||||||
newEdge.data.forward = true;
|
unsigned nameID = _nodeBasedGraph->GetEdgeData(e2).nameID;
|
||||||
newEdge.data.backward = false;
|
short turnInstruction = AnalyzeTurn(u, v, w);
|
||||||
newEdge.data.via = v;
|
|
||||||
newEdge.data.nameID = _nodeBasedGraph->GetEdgeData(e2).middleName.nameID;
|
//create edge-based graph edge
|
||||||
newEdge.data.turnInstruction = AnalyzeTurn(u, v, w);
|
//EdgeBasedEdge(NodeID s, NodeID t, NodeID v, unsigned n1, EdgeWeight w, bool f, bool b, short ty)
|
||||||
//create Edge for NearestNeighborlookup
|
EdgeBasedEdge newEdge(edgeBasedSource, edgeBasedTarget, v, nameID, distance, true, false, turnInstruction);
|
||||||
edgeBasedEdges.push_back(newEdge);
|
edgeBasedEdges.push_back(newEdge);
|
||||||
EdgeBasedNode currentNode;
|
EdgeBasedNode currentNode;
|
||||||
|
|
||||||
if(_nodeBasedGraph->GetEdgeData(e1).type != 14) {
|
if(_nodeBasedGraph->GetEdgeData(e1).type != 14) {
|
||||||
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).middleName.nameID;
|
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;
|
||||||
currentNode.lat1 = inputNodeInfoList[u].lat;
|
currentNode.lat1 = inputNodeInfoList[u].lat;
|
||||||
currentNode.lon1 = inputNodeInfoList[u].lon;
|
currentNode.lon1 = inputNodeInfoList[u].lon;
|
||||||
currentNode.lat2 = inputNodeInfoList[v].lat;
|
currentNode.lat2 = inputNodeInfoList[v].lat;
|
||||||
@ -188,8 +179,8 @@ short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const N
|
|||||||
_NodeBasedDynamicGraph::EdgeIterator edge1 = _nodeBasedGraph->FindEdge(u, v);
|
_NodeBasedDynamicGraph::EdgeIterator edge1 = _nodeBasedGraph->FindEdge(u, v);
|
||||||
_NodeBasedDynamicGraph::EdgeIterator edge2 = _nodeBasedGraph->FindEdge(v, w);
|
_NodeBasedDynamicGraph::EdgeIterator edge2 = _nodeBasedGraph->FindEdge(v, w);
|
||||||
|
|
||||||
_NodeBasedDynamicGraph::EdgeData data1 = _nodeBasedGraph->GetEdgeData(edge1);
|
_NodeBasedDynamicGraph::EdgeData & data1 = _nodeBasedGraph->GetEdgeData(edge1);
|
||||||
_NodeBasedDynamicGraph::EdgeData data2 = _nodeBasedGraph->GetEdgeData(edge2);
|
_NodeBasedDynamicGraph::EdgeData & data2 = _nodeBasedGraph->GetEdgeData(edge2);
|
||||||
|
|
||||||
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
|
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
|
||||||
|
|
||||||
@ -214,7 +205,7 @@ short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const N
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If street names stay the same and if we are certain that it is not a roundabout, we skip it.
|
//If street names stay the same and if we are certain that it is not a roundabout, we skip it.
|
||||||
if(data1.middleName.nameID == data2.middleName.nameID)
|
if(data1.nameID == data2.nameID)
|
||||||
return TurnInstructions.NoTurn;
|
return TurnInstructions.NoTurn;
|
||||||
|
|
||||||
return TurnInstructions.GetTurnDirectionOfInstruction(angle);
|
return TurnInstructions.GetTurnDirectionOfInstruction(angle);
|
||||||
|
@ -37,21 +37,15 @@
|
|||||||
|
|
||||||
class EdgeBasedGraphFactory {
|
class EdgeBasedGraphFactory {
|
||||||
private:
|
private:
|
||||||
union _MiddleName {
|
|
||||||
unsigned middle;
|
|
||||||
unsigned nameID;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _NodeBasedEdgeData {
|
struct _NodeBasedEdgeData {
|
||||||
int distance;
|
int distance;
|
||||||
unsigned edgeBasedNodeID;
|
unsigned edgeBasedNodeID;
|
||||||
unsigned originalEdges;
|
unsigned nameID;
|
||||||
bool shortcut;
|
bool shortcut:1;
|
||||||
bool forward;
|
bool forward:1;
|
||||||
bool backward;
|
bool backward:1;
|
||||||
bool roundabout;
|
bool roundabout:1;
|
||||||
short type;
|
short type;
|
||||||
_MiddleName middleName;
|
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
struct _EdgeBasedEdgeData {
|
struct _EdgeBasedEdgeData {
|
||||||
@ -83,16 +77,13 @@ public:
|
|||||||
unsigned weight;
|
unsigned weight;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef DynamicGraph< _EdgeBasedEdgeData> _EdgeBasedDynamicGraph;
|
|
||||||
typedef _EdgeBasedDynamicGraph::InputEdge _EdgeBasedEdge;
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<_NodeBasedDynamicGraph> _nodeBasedGraph;
|
boost::shared_ptr<_NodeBasedDynamicGraph> _nodeBasedGraph;
|
||||||
boost::shared_ptr<_EdgeBasedDynamicGraph> _edgeBasedGraph;
|
|
||||||
|
|
||||||
std::vector<_Restriction> & inputRestrictions;
|
std::vector<_Restriction> & inputRestrictions;
|
||||||
std::vector<NodeInfo> & inputNodeInfoList;
|
std::vector<NodeInfo> & inputNodeInfoList;
|
||||||
|
|
||||||
std::vector<_EdgeBasedEdge> edgeBasedEdges;
|
std::vector<EdgeBasedEdge> edgeBasedEdges;
|
||||||
std::vector<EdgeBasedNode> edgeBasedNodes;
|
std::vector<EdgeBasedNode> edgeBasedNodes;
|
||||||
|
|
||||||
template<class CoordinateT>
|
template<class CoordinateT>
|
||||||
|
@ -92,24 +92,24 @@ public:
|
|||||||
_via(myEdge.data.via),
|
_via(myEdge.data.via),
|
||||||
_nameID1(myEdge.data.nameID),
|
_nameID1(myEdge.data.nameID),
|
||||||
_weight(myEdge.data.distance),
|
_weight(myEdge.data.distance),
|
||||||
forward(myEdge.data.forward),
|
_forward(myEdge.data.forward),
|
||||||
backward(myEdge.data.backward),
|
_backward(myEdge.data.backward),
|
||||||
_turnInstruction(myEdge.data.turnInstruction) { }
|
_turnInstruction(myEdge.data.turnInstruction) { }
|
||||||
|
|
||||||
/** Default constructor. target and weight are set to 0.*/
|
/** Default constructor. target and weight are set to 0.*/
|
||||||
EdgeBasedEdge() :
|
EdgeBasedEdge() :
|
||||||
_source(0), _target(0), _via(0), _nameID1(0), _weight(0), forward(0), backward(0), _turnInstruction(0) { assert(false); } //shall not be used.
|
_source(0), _target(0), _via(0), _nameID1(0), _weight(0), _forward(0), _backward(0), _turnInstruction(0) { assert(false); } //shall not be used.
|
||||||
|
|
||||||
explicit EdgeBasedEdge(NodeID s, NodeID t, NodeID v, unsigned n1, unsigned n2, EdgeWeight w, bool f, bool b, short ty) :
|
explicit EdgeBasedEdge(NodeID s, NodeID t, NodeID v, unsigned n1, EdgeWeight w, bool f, bool b, short ty) :
|
||||||
_source(s), _target(t), _via(v), _nameID1(n1), _weight(w), forward(f), backward(b), _turnInstruction(ty) { assert(ty >= 0); }
|
_source(s), _target(t), _via(v), _nameID1(n1), _weight(w), _forward(f), _backward(b), _turnInstruction(ty) { assert(ty >= 0); }
|
||||||
|
|
||||||
NodeID target() const {return _target; }
|
NodeID target() const {return _target; }
|
||||||
NodeID source() const {return _source; }
|
NodeID source() const {return _source; }
|
||||||
EdgeWeight weight() const {return _weight; }
|
EdgeWeight weight() const {return _weight; }
|
||||||
NodeID via() const { return _via; }
|
NodeID via() const { return _via; }
|
||||||
short turnInstruction() const { assert(_turnInstruction >= 0); return _turnInstruction; }
|
short turnInstruction() const { assert(_turnInstruction >= 0); return _turnInstruction; }
|
||||||
bool isBackward() const { return backward; }
|
bool isBackward() const { return _backward; }
|
||||||
bool isForward() const { return forward; }
|
bool isForward() const { return _forward; }
|
||||||
|
|
||||||
unsigned getNameIDOfTurnTarget() const { return _nameID1; }
|
unsigned getNameIDOfTurnTarget() const { return _nameID1; }
|
||||||
|
|
||||||
@ -117,10 +117,9 @@ public:
|
|||||||
NodeID _target;
|
NodeID _target;
|
||||||
NodeID _via;
|
NodeID _via;
|
||||||
unsigned _nameID1;
|
unsigned _nameID1;
|
||||||
// unsigned _nameID2;
|
|
||||||
EdgeWeight _weight;
|
EdgeWeight _weight;
|
||||||
bool forward;
|
bool _forward;
|
||||||
bool backward;
|
bool _backward;
|
||||||
short _turnInstruction;
|
short _turnInstruction;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,6 @@ void omp_set_num_threads(int i) {}
|
|||||||
#include "Contractor/EdgeBasedGraphFactory.h"
|
#include "Contractor/EdgeBasedGraphFactory.h"
|
||||||
#include "DataStructures/BinaryHeap.h"
|
#include "DataStructures/BinaryHeap.h"
|
||||||
#include "DataStructures/ExtractorStructs.h"
|
#include "DataStructures/ExtractorStructs.h"
|
||||||
#include "DataStructures/LevelInformation.h"
|
|
||||||
#include "DataStructures/NNGrid.h"
|
#include "DataStructures/NNGrid.h"
|
||||||
#include "Util/BaseConfiguration.h"
|
#include "Util/BaseConfiguration.h"
|
||||||
#include "Util/InputFileUtil.h"
|
#include "Util/InputFileUtil.h"
|
||||||
@ -63,12 +62,12 @@ typedef DynamicGraph<EdgeData>::InputEdge InputEdge;
|
|||||||
typedef StaticGraph<EdgeData>::InputEdge StaticEdge;
|
typedef StaticGraph<EdgeData>::InputEdge StaticEdge;
|
||||||
typedef BaseConfiguration ContractorConfiguration;
|
typedef BaseConfiguration ContractorConfiguration;
|
||||||
|
|
||||||
vector<NodeInfo> int2ExtNodeMap;
|
std::vector<NodeInfo> internalToExternaleNodeMapping;
|
||||||
vector<_Restriction> inputRestrictions;
|
std::vector<_Restriction> inputRestrictions;
|
||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
if(argc < 3) {
|
if(argc < 3) {
|
||||||
cerr << "usage: " << endl << argv[0] << " <osrm-data> <osrm-restrictions>" << endl;
|
cerr << "usage: " << std::endl << argv[0] << " <osrm-data> <osrm-restrictions>" << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
INFO("Using restrictions from file: " << argv[2]);
|
INFO("Using restrictions from file: " << argv[2]);
|
||||||
@ -91,17 +90,17 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
omp_set_num_threads(numberOfThreads);
|
omp_set_num_threads(numberOfThreads);
|
||||||
|
|
||||||
cout << "preprocessing data from input file " << argv[1];
|
std::cout << "preprocessing data from input file " << argv[1];
|
||||||
#ifdef _GLIBCXX_PARALLEL
|
#ifdef _GLIBCXX_PARALLEL
|
||||||
cout << " using STL parallel mode" << std::endl;
|
std::cout << " using STL parallel mode" << std::endl;
|
||||||
#else
|
#else
|
||||||
cout << " using STL serial mode" << std::endl;
|
std::cout << " using STL serial mode" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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] << endl; exit(-1);
|
cerr << "Cannot open " << argv[1] << std::endl; exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char nodeOut[1024];
|
char nodeOut[1024];
|
||||||
@ -122,11 +121,14 @@ int main (int argc, char *argv[]) {
|
|||||||
strcat(fileIndexOut, ".fileIndex");
|
strcat(fileIndexOut, ".fileIndex");
|
||||||
strcat(levelInfoOut, ".levels");
|
strcat(levelInfoOut, ".levels");
|
||||||
|
|
||||||
vector<ImportEdge> edgeList;
|
std::vector<ImportEdge> edgeList;
|
||||||
NodeID n = readBinaryOSRMGraphFromStream(in, edgeList, &int2ExtNodeMap, inputRestrictions);
|
NodeID n = readBinaryOSRMGraphFromStream(in, edgeList, &internalToExternaleNodeMapping, inputRestrictions);
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
EdgeBasedGraphFactory * edgeBasedGraphFactory = new EdgeBasedGraphFactory (n, edgeList, inputRestrictions, int2ExtNodeMap);
|
EdgeBasedGraphFactory * edgeBasedGraphFactory = new EdgeBasedGraphFactory (n, edgeList, inputRestrictions, internalToExternaleNodeMapping);
|
||||||
|
edgeList.clear();
|
||||||
|
std::vector<ImportEdge>().swap(edgeList);
|
||||||
|
|
||||||
edgeBasedGraphFactory->Run();
|
edgeBasedGraphFactory->Run();
|
||||||
n = edgeBasedGraphFactory->GetNumberOfNodes();
|
n = edgeBasedGraphFactory->GetNumberOfNodes();
|
||||||
std::vector<EdgeBasedEdge> edgeBasedEdgeList;
|
std::vector<EdgeBasedEdge> edgeBasedEdgeList;
|
||||||
@ -134,52 +136,32 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
std::vector<EdgeBasedGraphFactory::EdgeBasedNode> nodeBasedEdgeList;
|
std::vector<EdgeBasedGraphFactory::EdgeBasedNode> nodeBasedEdgeList;
|
||||||
edgeBasedGraphFactory->GetEdgeBasedNodes(nodeBasedEdgeList);
|
edgeBasedGraphFactory->GetEdgeBasedNodes(nodeBasedEdgeList);
|
||||||
INFO("size of nodeBasedEdgeList: " << nodeBasedEdgeList.size());
|
|
||||||
DELETE(edgeBasedGraphFactory);
|
DELETE(edgeBasedGraphFactory);
|
||||||
|
|
||||||
WritableGrid * writeableGrid = new WritableGrid();
|
WritableGrid * writeableGrid = new WritableGrid();
|
||||||
cout << "building grid ..." << flush;
|
std::cout << "building grid ..." << std::flush;
|
||||||
writeableGrid->ConstructGrid(nodeBasedEdgeList, &int2ExtNodeMap, ramIndexOut, fileIndexOut);
|
writeableGrid->ConstructGrid(nodeBasedEdgeList, &internalToExternaleNodeMapping, ramIndexOut, fileIndexOut);
|
||||||
delete writeableGrid;
|
DELETE( writeableGrid );
|
||||||
std::cout << "writing node map ..." << std::flush;
|
std::cout << "writing node map ..." << std::flush;
|
||||||
ofstream mapOutFile(nodeOut, ios::binary);
|
ofstream mapOutFile(nodeOut, ios::binary);
|
||||||
|
|
||||||
for(NodeID i = 0; i < int2ExtNodeMap.size(); i++) {
|
for(NodeID i = 0; i < internalToExternaleNodeMapping.size(); i++) {
|
||||||
mapOutFile.write((char *)&(int2ExtNodeMap.at(i)), sizeof(NodeInfo));
|
mapOutFile.write((char *)&(internalToExternaleNodeMapping.at(i)), sizeof(NodeInfo));
|
||||||
}
|
}
|
||||||
mapOutFile.close();
|
mapOutFile.close();
|
||||||
std::cout << "ok" << std::endl;
|
std::cout << "ok" << std::endl;
|
||||||
|
|
||||||
int2ExtNodeMap.clear();
|
internalToExternaleNodeMapping.clear();
|
||||||
|
std::vector<NodeInfo>().swap(internalToExternaleNodeMapping);
|
||||||
|
inputRestrictions.clear();
|
||||||
|
std::vector<_Restriction>().swap(inputRestrictions);
|
||||||
|
|
||||||
cout << "initializing contractor ..." << flush;
|
std::cout << "initializing contractor ..." << std::flush;
|
||||||
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
Contractor* contractor = new Contractor( n, edgeBasedEdgeList );
|
||||||
double contractionStartedTimestamp(get_timestamp());
|
double contractionStartedTimestamp(get_timestamp());
|
||||||
contractor->Run();
|
contractor->Run();
|
||||||
INFO("Contraction took " << get_timestamp() - contractionStartedTimestamp << " sec");
|
INFO("Contraction took " << get_timestamp() - contractionStartedTimestamp << " sec");
|
||||||
|
|
||||||
LevelInformation * levelInfo = contractor->GetLevelInformation();
|
|
||||||
std::cout << "sorting level info" << std::endl;
|
|
||||||
for(unsigned currentLevel = levelInfo->GetNumberOfLevels(); currentLevel>0; currentLevel--) {
|
|
||||||
std::vector<unsigned> & level = levelInfo->GetLevel(currentLevel-1);
|
|
||||||
std::sort(level.begin(), level.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "writing level info" << std::endl;
|
|
||||||
ofstream levelOutFile(levelInfoOut, ios::binary);
|
|
||||||
unsigned numberOfLevels = levelInfo->GetNumberOfLevels();
|
|
||||||
levelOutFile.write((char *)&numberOfLevels, sizeof(unsigned));
|
|
||||||
for(unsigned currentLevel = 0; currentLevel < levelInfo->GetNumberOfLevels(); currentLevel++ ) {
|
|
||||||
std::vector<unsigned> & level = levelInfo->GetLevel(currentLevel);
|
|
||||||
unsigned sizeOfLevel = level.size();
|
|
||||||
levelOutFile.write((char *)&sizeOfLevel, sizeof(unsigned));
|
|
||||||
for(unsigned currentLevelEntry = 0; currentLevelEntry < sizeOfLevel; currentLevelEntry++) {
|
|
||||||
unsigned node = level[currentLevelEntry];
|
|
||||||
levelOutFile.write((char *)&node, sizeof(unsigned));
|
|
||||||
assert(node < n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
levelOutFile.close();
|
|
||||||
std::vector< ContractionCleanup::Edge > contractedEdges;
|
std::vector< ContractionCleanup::Edge > contractedEdges;
|
||||||
contractor->GetEdges( contractedEdges );
|
contractor->GetEdges( contractedEdges );
|
||||||
|
|
||||||
@ -189,9 +171,9 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
std::vector< InputEdge> cleanedEdgeList;
|
std::vector< InputEdge> cleanedEdgeList;
|
||||||
cleanup->GetData(cleanedEdgeList);
|
cleanup->GetData(cleanedEdgeList);
|
||||||
delete cleanup;
|
DELETE( cleanup );
|
||||||
|
|
||||||
cout << "Serializing edges " << flush;
|
std::cout << "Serializing edges " << std::flush;
|
||||||
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++) {
|
for(std::vector< InputEdge>::iterator it = cleanedEdgeList.begin(); it != cleanedEdgeList.end(); it++) {
|
||||||
@ -203,6 +185,6 @@ int main (int argc, char *argv[]) {
|
|||||||
edgeOutFile.close();
|
edgeOutFile.close();
|
||||||
cleanedEdgeList.clear();
|
cleanedEdgeList.clear();
|
||||||
|
|
||||||
cout << "finished" << endl;
|
std::cout << "finished" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user