Merge fixed

This commit is contained in:
DennisOSRM
2011-12-13 11:08:40 +01:00
20 changed files with 118 additions and 951 deletions
+9 -13
View File
@@ -40,11 +40,8 @@ private:
parent = p;
}
};
#ifdef _MANYCORES
typedef BinaryHeap< NodeID, NodeID, int, _HeapData, DenseStorage<NodeID, NodeID> > _Heap;
#else
typedef BinaryHeap< NodeID, NodeID, int, _CleanupHeapData > _Heap;
#endif
struct _ThreadData {
_Heap* _heapForward;
_Heap* _heapBackward;
@@ -52,8 +49,7 @@ private:
_heapBackward = new _Heap(nodes);
_heapForward = new _Heap(nodes);
}
~_ThreadData()
{
~_ThreadData() {
delete _heapBackward;
delete _heapForward;
}
@@ -65,13 +61,13 @@ public:
NodeID source;
NodeID target;
struct EdgeData {
NodeID via;
unsigned nameID;
int distance;
bool shortcut;
bool forward;
bool backward;
short turnInstruction;
NodeID via;
unsigned nameID;
int distance;
short turnInstruction;
bool shortcut:1;
bool forward:1;
bool backward:1;
} data;
//sorts by source and other attributes
+9 -10
View File
@@ -41,16 +41,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
class Contractor {
private:
struct _EdgeBasedContractorEdgeData {
unsigned distance;
unsigned originalEdges;
unsigned via;
unsigned nameID;
bool shortcut;
bool forward;
bool backward;
short turnInstruction;
unsigned distance;
unsigned originalEdges;
unsigned via;
unsigned nameID;
short turnInstruction;
bool shortcut:1;
bool forward:1;
bool backward:1;
} data;
struct _HeapData {
@@ -107,7 +106,7 @@ public:
edge.data.distance = (std::max)((int)i->weight(), 1 );
assert( edge.data.distance > 0 );
#ifndef NDEBUG
#ifdef NDEBUG
if ( edge.data.distance > 24 * 60 * 60 * 10 ) {
std::cout << "Edge Weight too large -> May lead to invalid CH" << std::endl;
continue;
+8 -8
View File
@@ -132,7 +132,7 @@ void EdgeBasedGraphFactory::Run() {
++secondRestrictionIterator;
} while(u == secondRestrictionIterator->fromNode);
}
if(_nodeBasedGraph->EndEdges(v) == _nodeBasedGraph->BeginEdges(v) + 1 && _nodeBasedGraph->GetEdgeData(e1).type != 14 ) {
if(_nodeBasedGraph->EndEdges(v) == _nodeBasedGraph->BeginEdges(v) + 1 && _nodeBasedGraph->GetEdgeData(e1).type != INT_MAX) {
EdgeBasedNode currentNode;
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;
currentNode.lat1 = inputNodeInfoList[u].lat;
@@ -205,7 +205,7 @@ void EdgeBasedGraphFactory::Run() {
EdgeBasedEdge newEdge(edgeBasedSource, edgeBasedTarget, v, nameID, distance, true, false, turnInstruction);
edgeBasedEdges.push_back(newEdge);
if(_nodeBasedGraph->GetEdgeData(e1).type != 14 ) {
if(_nodeBasedGraph->GetEdgeData(e1).type != INT_MAX ) {
EdgeBasedNode currentNode;
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;
currentNode.lat1 = inputNodeInfoList[u].lat;
@@ -213,12 +213,12 @@ void EdgeBasedGraphFactory::Run() {
currentNode.lat2 = inputNodeInfoList[v].lat;
currentNode.lon2 = inputNodeInfoList[v].lon;
currentNode.id = edgeBasedSource;
short startHeight = srtmLookup.height(currentNode.lon1/100000.,currentNode.lat1/100000. );
short targetHeight = srtmLookup.height(currentNode.lon2/100000.,currentNode.lat2/100000. );
short heightDiff = startHeight - targetHeight;
double increase = (heightDiff/ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2));
if(heightDiff != 0)
INFO("Increase at turn: " << heightDiff << ", edge length: " << ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2) << ", percentage: " << increase ); //incorporate height diff;
// short startHeight = srtmLookup.height(currentNode.lon1/100000.,currentNode.lat1/100000. );
// short targetHeight = srtmLookup.height(currentNode.lon2/100000.,currentNode.lat2/100000. );
// short heightDiff = startHeight - targetHeight;
// double increase = (heightDiff/ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2));
// if(heightDiff != 0)
// INFO("Increase at turn: " << heightDiff << ", edge length: " << ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2) << ", percentage: " << increase ); //incorporate height diff;
currentNode.weight = distance;
edgeBasedNodes.push_back(currentNode);
}