barrier=bollard is now used. Fixes ticket #9 and saves about .5% RAM in

metropolitan areas
This commit is contained in:
DennisOSRM
2012-01-02 13:09:20 +01:00
parent 057e3a936e
commit 70256146fc
9 changed files with 111 additions and 67 deletions
+15 -1
View File
@@ -29,13 +29,25 @@
#include "EdgeBasedGraphFactory.h"
template<>
EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, std::string & srtm)
EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<NodeID> & bn, std::vector<NodeID> & tl, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, std::string & srtm)
: inputRestrictions(irs), inputNodeInfoList(nI)/*, srtmLookup(srtm) */{
#ifdef _GLIBCXX_PARALLEL
__gnu_parallel::sort(inputRestrictions.begin(), inputRestrictions.end(), CmpRestrictionByFrom);
#else
std::sort(inputRestrictions.begin(), inputRestrictions.end(), CmpRestrictionByFrom);
BOOST_FOREACH(NodeID id, bn) {
_bollardNodes.Add(id, true);
}
BOOST_FOREACH(NodeID id, tl) {
_trafficLights.Add(id, true);
}
INFO("bollards: " << _bollardNodes.Size());
INFO("signals: " << _trafficLights.Size());
#endif
std::vector< _NodeBasedEdge > edges;
@@ -117,6 +129,8 @@ void EdgeBasedGraphFactory::Run() {
for(_NodeBasedDynamicGraph::EdgeIterator e1 = _nodeBasedGraph->BeginEdges(u); e1 < _nodeBasedGraph->EndEdges(u); ++e1) {
++nodeBasedEdgeCounter;
_NodeBasedDynamicGraph::NodeIterator v = _nodeBasedGraph->GetTarget(e1);
if(_bollardNodes.Find(v) == true)
continue;
//loop over all reachable edges (v,w)
bool isOnlyAllowed(false);
+4 -1
View File
@@ -31,6 +31,7 @@
#include "../typedefs.h"
#include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/ExtractorStructs.h"
#include "../DataStructures/HashTable.h"
#include "../DataStructures/ImportEdge.h"
#include "../DataStructures/Percent.h"
#include "../DataStructures/TurnInstructions.h"
@@ -82,6 +83,8 @@ public:
private:
boost::shared_ptr<_NodeBasedDynamicGraph> _nodeBasedGraph;
HashTable<NodeID, bool> _bollardNodes;
HashTable<NodeID, bool> _trafficLights;
std::vector<_Restriction> & inputRestrictions;
std::vector<NodeInfo> & inputNodeInfoList;
@@ -95,7 +98,7 @@ private:
public:
template< class InputEdgeT >
explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI, std::string & srtm);
explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<NodeID> & _bollardNodes, std::vector<NodeID> & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI, std::string & srtm);
virtual ~EdgeBasedGraphFactory();
void Run();