Ref'ed and consted parameters. Gives some extra performance when
creating grid.
This commit is contained in:
parent
811d77eccb
commit
086e10671f
@ -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 ) {
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
|
||||
template<typename EdgeT>
|
||||
void ConstructGrid(std::vector<EdgeT> & 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<GridEntry>& entriesWithSameRAMIndex, unsigned long fileOffset ) {
|
||||
unsigned FillCell(std::vector<GridEntry>& entriesWithSameRAMIndex, const unsigned long fileOffset ) {
|
||||
vector<char> 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<BresenhamPixel> 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<BresenhamPixel> &indexList) {
|
||||
void GetListOfIndexesForEdgeAndGridSize(const _Coordinate& start, const _Coordinate& target, std::vector<BresenhamPixel> &indexList) {
|
||||
double lat1 = start.lat/100000.;
|
||||
double lon1 = start.lon/100000.;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user