diff --git a/DataStructures/DynamicGraph.h b/DataStructures/DynamicGraph.h index 404c6028c..addd7872f 100644 --- a/DataStructures/DynamicGraph.h +++ b/DataStructures/DynamicGraph.h @@ -49,7 +49,7 @@ class DynamicGraph { m_nodes.reserve( m_numNodes ); m_nodes.resize( m_numNodes ); - m_edges.reserve( m_numNodes * 1.2 ); + m_edges.reserve( m_numNodes * 1.1 ); m_edges.resize( m_numNodes ); } DynamicGraph( int nodes, const std::vector< InputEdge > &graph ) @@ -69,7 +69,7 @@ class DynamicGraph { m_nodes[node].edges = edge - lastEdge; position += m_nodes[node].edges; } - m_edges.reserve( position * 1.2 ); + m_edges.reserve( position * 1.1 ); m_edges.resize( position ); edge = 0; for ( NodeIterator node = 0; node < m_numNodes; ++node ) { diff --git a/DataStructures/NNGrid.h b/DataStructures/NNGrid.h index 3054c176f..4eae38452 100644 --- a/DataStructures/NNGrid.h +++ b/DataStructures/NNGrid.h @@ -100,6 +100,7 @@ public: template void ConstructGrid(std::vector & edgeList, char * ramIndexOut, char * fileIndexOut) { + //TODO: Implement this using STXXL-Streams #ifndef ROUTED Percent p(edgeList.size()); BOOST_FOREACH(EdgeT & edge, edgeList) { @@ -298,7 +299,7 @@ private: return (std::fabs(d1 - d2) < 0.0001); } - unsigned FillCell(std::vector& entriesWithSameRAMIndex, unsigned long fileOffset ) { + unsigned FillCell(std::vector& entriesWithSameRAMIndex, const unsigned long fileOffset ) { vector tmpBuffer(32*32*4096,0); unsigned long indexIntoTmpBuffer = 0; unsigned numberOfWrittenBytes = 0; @@ -373,7 +374,7 @@ private: ++counter; } - BOOST_FOREACH(GridEntry entry, vectorWithSameFileIndex) { + BOOST_FOREACH(const GridEntry & entry, vectorWithSameFileIndex) { char * data = (char *)&(entry.edge); for(unsigned i = 0; i < sizeof(_GridEdge); ++i) { tmpBuffer[index+counter] = data[i]; @@ -419,7 +420,7 @@ private: localStream->read((char *)&result[currentSizeOfResult], lengthOfBucket*sizeof(_GridEdge)); } - void AddEdge(_GridEdge edge) { + void AddEdge(const _GridEdge & edge) { #ifndef ROUTED std::vector indexList; GetListOfIndexesForEdgeAndGridSize(edge.startCoord, edge.targetCoord, indexList); @@ -468,7 +469,7 @@ private: return (p-x)*(p-x) + (q-y)*(q-y); } - void GetListOfIndexesForEdgeAndGridSize(_Coordinate& start, _Coordinate& target, std::vector &indexList) { + void GetListOfIndexesForEdgeAndGridSize(const _Coordinate& start, const _Coordinate& target, std::vector &indexList) { double lat1 = start.lat/100000.; double lon1 = start.lon/100000.;