From bb98bc92ef6ba351a1d7dcd3613d53d7eaebcf41 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Thu, 26 Apr 2012 11:19:45 +0200 Subject: [PATCH] Moving temporary storage of edge-expanded graph to external memory --- Contractor/EdgeBasedGraphFactory.cpp | 3 +-- Contractor/EdgeBasedGraphFactory.h | 6 +++--- createHierarchy.cpp | 14 +++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index 1f9d67205..bc3b8677f 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -125,12 +125,11 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector().swap(inputEdges); std::vector<_NodeBasedEdge>(edges).swap(edges); std::sort( edges.begin(), edges.end() ); - INFO("edges size: " << edges.size() << ", capacity: " << edges.capacity()); _nodeBasedGraph.reset(new _NodeBasedDynamicGraph( nodes, edges )); } -void EdgeBasedGraphFactory::GetEdgeBasedEdges(std::vector< EdgeBasedEdge >& outputEdgeList ) { +void EdgeBasedGraphFactory::GetEdgeBasedEdges(stxxl::vector< EdgeBasedEdge >& outputEdgeList ) { GUARANTEE(0 == outputEdgeList.size(), "Vector passed to EdgeBasedGraphFactory::GetEdgeBasedEdges(..) is not empty"); GUARANTEE(0 != edgeBasedEdges.size(), "No edges in edge based graph"); diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index ac9dd3d54..2f85cc903 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -30,7 +30,7 @@ #include #include - +#include #include #include "../typedefs.h" @@ -103,7 +103,7 @@ private: RestrictionMap _restrictionMap; - std::vector edgeBasedEdges; + stxxl::vector edgeBasedEdges; std::vector edgeBasedNodes; std::vector originalEdgeData; std::vector inputNodeInfoList; @@ -127,7 +127,7 @@ public: explicit EdgeBasedGraphFactory(int nodes, std::vector & inputEdges, std::vector & _bollardNodes, std::vector & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector & nI, boost::property_tree::ptree speedProfile, std::string & srtm); void Run(); - void GetEdgeBasedEdges( std::vector< EdgeBasedEdge >& edges ); + void GetEdgeBasedEdges( stxxl::vector< EdgeBasedEdge >& edges ); void GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes); void GetOriginalEdgeData( std::vector< OriginalEdgeData> & originalEdgeData); short AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w) const; diff --git a/createHierarchy.cpp b/createHierarchy.cpp index 04b34d17d..cfeee3af0 100644 --- a/createHierarchy.cpp +++ b/createHierarchy.cpp @@ -131,14 +131,14 @@ int main (int argc, char *argv[]) { std::vector().swap(bollardNodes); std::vector().swap(trafficLightNodes); NodeID edgeBasedNodeNumber = edgeBasedGraphFactory->GetNumberOfNodes(); - std::vector edgeBasedEdgeList; + stxxl::vector edgeBasedEdgeList; edgeBasedGraphFactory->GetEdgeBasedEdges(edgeBasedEdgeList); - stxxl::vector externalEdgeBasedEdgeList; - BOOST_FOREACH(EdgeBasedEdge & edge, edgeBasedEdgeList) { - externalEdgeBasedEdgeList.push_back(edge); - } - std::vector().swap(edgeBasedEdgeList); +// stxxl::vector externalEdgeBasedEdgeList; +// BOOST_FOREACH(EdgeBasedEdge & edge, edgeBasedEdgeList) { +// externalEdgeBasedEdgeList.push_back(edge); +// } +// std::vector().swap(edgeBasedEdgeList); /*** * Writing info on original (node-based) nodes @@ -186,7 +186,7 @@ int main (int argc, char *argv[]) { */ INFO("initializing contractor"); - Contractor* contractor = new Contractor( edgeBasedNodeNumber, externalEdgeBasedEdgeList ); + Contractor* contractor = new Contractor( edgeBasedNodeNumber, edgeBasedEdgeList ); double contractionStartedTimestamp(get_timestamp()); contractor->Run(); INFO("Contraction took " << get_timestamp() - contractionStartedTimestamp << " sec");